@@ -31,13 +31,15 @@ export class PanelCtrl {
31
31
height : any ;
32
32
containerHeight : any ;
33
33
events : Emitter ;
34
+ timing : any ;
34
35
35
36
constructor ( $scope , $injector ) {
36
37
this . $injector = $injector ;
37
38
this . $scope = $scope ;
38
39
this . $timeout = $injector . get ( '$timeout' ) ;
39
40
this . editorTabIndex = 0 ;
40
41
this . events = new Emitter ( ) ;
42
+ this . timing = { } ;
41
43
42
44
var plugin = config . panels [ this . panel . type ] ;
43
45
if ( plugin ) {
@@ -58,6 +60,20 @@ export class PanelCtrl {
58
60
59
61
renderingCompleted ( ) {
60
62
this . $scope . $root . performance . panelsRendered ++ ;
63
+ this . timing . renderEnd = new Date ( ) . getTime ( ) ;
64
+ if ( this . $scope . $root . profilingEnabled ) {
65
+ this . $scope . $root . performance . panels . push ( {
66
+ panelId : this . panel . id ,
67
+ query : this . timing . queryEnd - this . timing . queryStart ,
68
+ render : this . timing . renderEnd - this . timing . renderStart ,
69
+ } ) ;
70
+
71
+ if ( this . $scope . $root . performance . panelsRendered === this . $scope . $root . performance . panelCount ) {
72
+ this . $scope . $root . performance . allPanelsRendered = new Date ( ) . getTime ( ) ;
73
+ var timeTaken = this . $scope . $root . performance . allPanelsRendered - this . $scope . $root . performance . dashboardLoadStart ;
74
+ console . log ( "Dashboard::Performance - All panels rendered in " + timeTaken + " ms" ) ;
75
+ }
76
+ }
61
77
}
62
78
63
79
refresh ( ) {
@@ -169,6 +185,7 @@ export class PanelCtrl {
169
185
}
170
186
171
187
this . calculatePanelHeight ( ) ;
188
+ this . timing . renderStart = new Date ( ) . getTime ( ) ;
172
189
this . events . emit ( 'render' , payload ) ;
173
190
}
174
191
0 commit comments