MCPcopy Index your code
hub / github.com/witheve/Eve / PerformanceTracker

Class PerformanceTracker

src/runtime/performance.ts:42–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42export class PerformanceTracker extends NoopPerformanceTracker {
43
44 time: (start?) => number | number[] | string;
45
46 constructor() {
47 super();
48 this.reset();
49 this.time = time;
50 }
51
52 reset() {
53 this.storeTime = 0;
54 this.storeCalls = 0;
55 this.lookupTime = 0;
56 this.lookupCalls = 0;
57 this.sendTime = 0;
58 this.sendCalls = 0;
59 this.fixpointTime = 0;
60 this.fixpointCalls = 0;
61 this.blockCheckTime = 0;
62 this.blockCheckCalls = 0;
63 this.blockTime = {};
64 this.blockTimeMax = {};
65 this.blockTimeMin = {};
66 this.blockCalls = {};
67 }
68
69 lookup(start) {
70 this.lookupTime += time(start) as number;
71 this.lookupCalls++;
72 }
73
74 store(start) {
75 this.storeTime += time(start) as number;
76 this.storeCalls++;
77 }
78
79 block(name, start) {
80 if(this.blockTime[name] === undefined) {
81 this.blockTime[name] = 0;
82 this.blockCalls[name] = 0;
83 this.blockTimeMax[name] = -Infinity;
84 this.blockTimeMin[name] = Infinity;
85 }
86 let total = time(start) as number;
87 this.blockTime[name] += total;
88 this.blockCalls[name]++;
89 if(total > this.blockTimeMax[name]) {
90 this.blockTimeMax[name] = total;
91 }
92 if(total < this.blockTimeMin[name]) {
93 this.blockTimeMin[name] = total;
94 }
95 }
96
97 send(start) {
98 this.sendTime += time(start) as number;
99 this.sendCalls++;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected