Files
grafana/public/app/core/profiler.ts
T

31 lines
761 B
TypeScript
Raw Normal View History

import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
export class Profiler {
panelsRendered: number;
enabled: boolean;
$rootScope: GrafanaRootScope;
2018-05-24 15:26:27 +02:00
window: any;
init(config: any, $rootScope: GrafanaRootScope) {
this.$rootScope = $rootScope;
2018-05-24 15:26:27 +02:00
this.window = window;
if (!this.enabled) {
return;
}
}
2019-05-13 09:38:19 +02:00
renderingCompleted() {
// add render counter to root scope
// used by phantomjs render.js to know when panel has rendered
2016-07-29 15:04:51 +02:00
this.panelsRendered = (this.panelsRendered || 0) + 1;
2018-05-24 15:26:27 +02:00
// this window variable is used by backend rendering tools to know
// all panels have completed rendering
this.window.panelsRendered = this.panelsRendered;
}
}
2018-08-29 14:26:50 +02:00
const profiler = new Profiler();
2017-12-19 16:06:54 +01:00
export { profiler };