2017-12-04 12:07:41 +00:00
|
|
|
/**
|
|
|
|
* @flow
|
|
|
|
* Trace representation wrapper
|
|
|
|
*/
|
|
|
|
import type PerformanceMonitoring from './';
|
|
|
|
|
2017-05-24 11:37:52 +00:00
|
|
|
export default class Trace {
|
2017-12-04 12:07:41 +00:00
|
|
|
identifier: string;
|
|
|
|
perf: PerformanceMonitoring;
|
2017-05-24 11:37:52 +00:00
|
|
|
|
2017-12-04 12:07:41 +00:00
|
|
|
constructor(perf: PerformanceMonitoring, identifier: string) {
|
2017-05-24 11:37:52 +00:00
|
|
|
this.perf = perf;
|
|
|
|
this.identifier = identifier;
|
|
|
|
}
|
|
|
|
|
2017-12-04 12:07:41 +00:00
|
|
|
start(): void {
|
2017-06-30 16:23:32 +00:00
|
|
|
this.perf._native.start(this.identifier);
|
2017-05-24 11:37:52 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 12:07:41 +00:00
|
|
|
stop(): void {
|
2017-06-30 16:23:32 +00:00
|
|
|
this.perf._native.stop(this.identifier);
|
2017-05-24 11:37:52 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 12:07:41 +00:00
|
|
|
incrementCounter(event: string): void {
|
2017-06-30 16:23:32 +00:00
|
|
|
this.perf._native.incrementCounter(this.identifier, event);
|
2017-05-24 11:37:52 +00:00
|
|
|
}
|
|
|
|
}
|