Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
0ca6b671
Commit
0ca6b671
authored
Aug 14, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some performance profiling code
parent
9390b1ee
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
22 deletions
+31
-22
src/app/controllers/console-ctrl.js
+0
-1
src/app/controllers/dash.js
+3
-3
src/app/controllers/grafanaCtrl.js
+24
-16
src/app/services/panelSrv.js
+4
-2
No files found.
src/app/controllers/console-ctrl.js
View file @
0ca6b671
...
...
@@ -98,7 +98,6 @@ function (angular, _, moment) {
$httpProvider
.
interceptors
.
push
(
'mupp'
);
});
module
.
controller
(
'ConsoleCtrl'
,
function
(
$scope
)
{
$scope
.
events
=
events
;
...
...
src/app/controllers/dash.js
View file @
0ca6b671
...
...
@@ -26,9 +26,9 @@ function (angular, $, config, _) {
$scope
.
setupDashboard
=
function
(
event
,
dashboardData
)
{
timer
.
cancel_all
();
$
s
cope
.
performance
.
dashboardLoadStart
=
new
Date
().
getTime
();
$
s
cope
.
performance
.
panelsInitialized
=
0
;
$
s
cope
.
performance
.
panelsRendered
=
0
;
$
rootS
cope
.
performance
.
dashboardLoadStart
=
new
Date
().
getTime
();
$
rootS
cope
.
performance
.
panelsInitialized
=
0
;
$
rootS
cope
.
performance
.
panelsRendered
=
0
;
$scope
.
dashboard
=
dashboardSrv
.
create
(
dashboardData
);
$scope
.
dashboardViewState
=
dashboardViewStateSrv
.
create
(
$scope
);
...
...
src/app/controllers/grafanaCtrl.js
View file @
0ca6b671
...
...
@@ -12,29 +12,21 @@ function (angular, config, _, $) {
module
.
controller
(
'GrafanaCtrl'
,
function
(
$scope
,
alertSrv
,
grafanaVersion
,
$rootScope
)
{
$scope
.
grafanaVersion
=
grafanaVersion
[
0
]
===
'@'
?
'master'
:
grafanaVersion
;
$scope
.
performance
=
{
loadStart
:
new
Date
().
getTime
()
};
var
count
=
0
;
$scope
.
$watch
(
function
()
{
console
.
log
(
1
);
count
++
;
},
function
()
{
});
$scope
.
consoleEnabled
=
(
window
.
localStorage
&&
window
.
localStorage
.
grafanaConsole
===
'true'
);
setTimeout
(
function
()
{
console
.
log
(
"Dashboard::Performance Total Digests: "
+
count
);
console
.
log
(
"Dashboard::Performance Total Watchers: "
+
$scope
.
getTotalWatcherCount
());
console
.
log
(
"Dashboard::Performance Total ScopeCount: "
+
$scope
.
performance
.
scopeCount
);
},
3000
);
$rootScope
.
profilingEnabled
=
(
window
.
localStorage
&&
window
.
localStorage
.
profilingEnabled
===
'true'
);
$rootScope
.
performance
=
{
loadStart
:
new
Date
().
getTime
()
};
$scope
.
init
=
function
()
{
$scope
.
_
=
_
;
if
(
$rootScope
.
profilingEnabled
)
{
$scope
.
initProfiling
();
}
$scope
.
dashAlerts
=
alertSrv
;
$scope
.
grafana
=
{
style
:
'dark'
};
$scope
.
consoleEnabled
=
(
window
.
localStorage
&&
window
.
localStorage
.
grafanaConsole
===
'true'
);
};
$scope
.
toggleConsole
=
function
()
{
...
...
@@ -80,10 +72,26 @@ function (angular, config, _, $) {
};
f
(
root
);
$
s
cope
.
performance
.
scopeCount
=
scopes
;
$
rootS
cope
.
performance
.
scopeCount
=
scopes
;
return
count
;
};
$scope
.
initProfiling
=
function
()
{
var
count
=
0
;
$scope
.
$watch
(
function
()
{
console
.
log
(
1
);
count
++
;
},
function
()
{
});
setTimeout
(
function
()
{
console
.
log
(
"Dashboard::Performance Total Digests: "
+
count
);
console
.
log
(
"Dashboard::Performance Total Watchers: "
+
$scope
.
getTotalWatcherCount
());
console
.
log
(
"Dashboard::Performance Total ScopeCount: "
+
$scope
.
performance
.
scopeCount
);
},
3000
);
};
$scope
.
init
();
});
...
...
src/app/services/panelSrv.js
View file @
0ca6b671
...
...
@@ -130,11 +130,13 @@ function (angular, _) {
}
}
$scope
.
performance
.
panelsInitialized
++
;
if
(
$scope
.
performance
.
panelsInitialized
===
$scope
.
dashboard
.
rows
.
length
)
{
if
(
$rootScope
.
profilingEnabled
)
{
$rootScope
.
performance
.
panelsInitialized
++
;
if
(
$rootScope
.
performance
.
panelsInitialized
===
$scope
.
dashboard
.
rows
.
length
)
{
var
timeTaken
=
new
Date
().
getTime
()
-
$scope
.
performance
.
dashboardLoadStart
;
console
.
log
(
"Dashboard::Performance - All panels initialized in "
+
timeTaken
+
" ms"
);
}
}
};
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment