1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.time = exports.DevTimer = void 0;
|
4 | const builder_util_1 = require("builder-util");
|
5 | class DevTimer {
|
6 | constructor(label) {
|
7 | this.label = label;
|
8 | this.start = process.hrtime();
|
9 | }
|
10 | endAndGet() {
|
11 | const end = process.hrtime(this.start);
|
12 | return `${end[0]}s ${Math.round(end[1] / 1000000)}ms`;
|
13 | }
|
14 | end() {
|
15 | console.info(`${this.label}: ${this.endAndGet()}`);
|
16 | }
|
17 | }
|
18 | exports.DevTimer = DevTimer;
|
19 | class ProductionTimer {
|
20 | end() {
|
21 |
|
22 | }
|
23 | }
|
24 | function time(label) {
|
25 | return builder_util_1.debug.enabled ? new DevTimer(label) : new ProductionTimer();
|
26 | }
|
27 | exports.time = time;
|
28 |
|
\ | No newline at end of file |