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