1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | class ModuleProfile {
|
9 | constructor() {
|
10 | this.startTime = Date.now();
|
11 | this.factory = 0;
|
12 | this.restoring = 0;
|
13 | this.integration = 0;
|
14 | this.building = 0;
|
15 | this.storing = 0;
|
16 | this.additionalFactories = 0;
|
17 | this.additionalIntegration = 0;
|
18 | }
|
19 |
|
20 | markFactoryStart() {
|
21 | this.factoryStartTime = Date.now();
|
22 | }
|
23 |
|
24 | markFactoryEnd() {
|
25 | this.factoryEndTime = Date.now();
|
26 | this.factory = this.factoryEndTime - this.factoryStartTime;
|
27 | }
|
28 |
|
29 | markRestoringStart() {
|
30 | this.restoringStartTime = Date.now();
|
31 | }
|
32 |
|
33 | markRestoringEnd() {
|
34 | this.restoringEndTime = Date.now();
|
35 | this.restoring = this.restoringEndTime - this.restoringStartTime;
|
36 | }
|
37 |
|
38 | markIntegrationStart() {
|
39 | this.integrationStartTime = Date.now();
|
40 | }
|
41 |
|
42 | markIntegrationEnd() {
|
43 | this.integrationEndTime = Date.now();
|
44 | this.integration = this.integrationEndTime - this.integrationStartTime;
|
45 | }
|
46 |
|
47 | markBuildingStart() {
|
48 | this.buildingStartTime = Date.now();
|
49 | }
|
50 |
|
51 | markBuildingEnd() {
|
52 | this.buildingEndTime = Date.now();
|
53 | this.building = this.buildingEndTime - this.buildingStartTime;
|
54 | }
|
55 |
|
56 | markStoringStart() {
|
57 | this.storingStartTime = Date.now();
|
58 | }
|
59 |
|
60 | markStoringEnd() {
|
61 | this.storingEndTime = Date.now();
|
62 | this.storing = this.storingEndTime - this.storingStartTime;
|
63 | }
|
64 |
|
65 |
|
66 |
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 | mergeInto(realProfile) {
|
73 | if (this.factory > realProfile.additionalFactories)
|
74 | realProfile.additionalFactories = this.factory;
|
75 | if (this.integration > realProfile.additionalIntegration)
|
76 | realProfile.additionalIntegration = this.integration;
|
77 | }
|
78 | }
|
79 |
|
80 | module.exports = ModuleProfile;
|