@openrewrite/rewrite 8.63.0 → 8.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/java/index.d.ts +1 -0
- package/dist/java/index.d.ts.map +1 -1
- package/dist/java/index.js +1 -0
- package/dist/java/index.js.map +1 -1
- package/dist/java/rpc.d.ts +2 -0
- package/dist/java/rpc.d.ts.map +1 -1
- package/dist/java/rpc.js +749 -410
- package/dist/java/rpc.js.map +1 -1
- package/dist/java/tree.d.ts +1 -1
- package/dist/java/tree.d.ts.map +1 -1
- package/dist/java/type-visitor.d.ts +48 -0
- package/dist/java/type-visitor.d.ts.map +1 -0
- package/dist/java/type-visitor.js +260 -0
- package/dist/java/type-visitor.js.map +1 -0
- package/dist/java/type.d.ts +2 -0
- package/dist/java/type.d.ts.map +1 -1
- package/dist/java/type.js +0 -317
- package/dist/java/type.js.map +1 -1
- package/dist/java/visitor.d.ts.map +1 -1
- package/dist/java/visitor.js +579 -363
- package/dist/java/visitor.js.map +1 -1
- package/dist/javascript/preconditions.d.ts +1 -1
- package/dist/javascript/preconditions.d.ts.map +1 -1
- package/dist/javascript/preconditions.js +7 -6
- package/dist/javascript/preconditions.js.map +1 -1
- package/dist/javascript/rpc.js +430 -350
- package/dist/javascript/rpc.js.map +1 -1
- package/dist/javascript/tree.d.ts +1 -1
- package/dist/javascript/tree.d.ts.map +1 -1
- package/dist/javascript/type-mapping.d.ts.map +1 -1
- package/dist/javascript/type-mapping.js +7 -0
- package/dist/javascript/type-mapping.js.map +1 -1
- package/dist/javascript/visitor.d.ts.map +1 -1
- package/dist/javascript/visitor.js +504 -309
- package/dist/javascript/visitor.js.map +1 -1
- package/dist/json/visitor.d.ts.map +1 -1
- package/dist/json/visitor.js +46 -21
- package/dist/json/visitor.js.map +1 -1
- package/dist/rpc/queue.d.ts +7 -4
- package/dist/rpc/queue.d.ts.map +1 -1
- package/dist/rpc/queue.js +22 -32
- package/dist/rpc/queue.js.map +1 -1
- package/dist/rpc/request/generate.d.ts.map +1 -1
- package/dist/rpc/request/generate.js +2 -3
- package/dist/rpc/request/generate.js.map +1 -1
- package/dist/rpc/request/get-languages.d.ts.map +1 -1
- package/dist/rpc/request/get-languages.js +4 -3
- package/dist/rpc/request/get-languages.js.map +1 -1
- package/dist/rpc/request/get-object.d.ts +1 -1
- package/dist/rpc/request/get-object.d.ts.map +1 -1
- package/dist/rpc/request/get-object.js +8 -7
- package/dist/rpc/request/get-object.js.map +1 -1
- package/dist/rpc/request/get-recipes.d.ts.map +1 -1
- package/dist/rpc/request/get-recipes.js +2 -2
- package/dist/rpc/request/get-recipes.js.map +1 -1
- package/dist/rpc/request/index.d.ts +1 -0
- package/dist/rpc/request/index.d.ts.map +1 -1
- package/dist/rpc/request/index.js +1 -0
- package/dist/rpc/request/index.js.map +1 -1
- package/dist/rpc/request/install-recipes.d.ts.map +1 -1
- package/dist/rpc/request/install-recipes.js +30 -21
- package/dist/rpc/request/install-recipes.js.map +1 -1
- package/dist/rpc/request/metrics.d.ts +10 -10
- package/dist/rpc/request/metrics.d.ts.map +1 -1
- package/dist/rpc/request/metrics.js +38 -31
- package/dist/rpc/request/metrics.js.map +1 -1
- package/dist/rpc/request/parse.d.ts.map +1 -1
- package/dist/rpc/request/parse.js +10 -12
- package/dist/rpc/request/parse.js.map +1 -1
- package/dist/rpc/request/prepare-recipe.d.ts.map +1 -1
- package/dist/rpc/request/prepare-recipe.js +4 -4
- package/dist/rpc/request/prepare-recipe.js.map +1 -1
- package/dist/rpc/request/print.d.ts +1 -1
- package/dist/rpc/request/print.d.ts.map +1 -1
- package/dist/rpc/request/print.js +10 -6
- package/dist/rpc/request/print.js.map +1 -1
- package/dist/rpc/request/trace-get-object.d.ts +5 -0
- package/dist/rpc/request/trace-get-object.d.ts.map +1 -0
- package/dist/rpc/request/trace-get-object.js +3 -0
- package/dist/rpc/request/trace-get-object.js.map +1 -0
- package/dist/rpc/request/visit.d.ts.map +1 -1
- package/dist/rpc/request/visit.js +2 -3
- package/dist/rpc/request/visit.js.map +1 -1
- package/dist/rpc/rewrite-rpc.d.ts +2 -3
- package/dist/rpc/rewrite-rpc.d.ts.map +1 -1
- package/dist/rpc/rewrite-rpc.js +14 -5
- package/dist/rpc/rewrite-rpc.js.map +1 -1
- package/dist/rpc/server.d.ts.map +1 -1
- package/dist/rpc/server.js +15 -44
- package/dist/rpc/server.js.map +1 -1
- package/dist/rpc/trace.d.ts +1 -1
- package/dist/rpc/trace.d.ts.map +1 -1
- package/dist/rpc/trace.js +3 -3
- package/dist/rpc/trace.js.map +1 -1
- package/dist/util.d.ts +6 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +14 -0
- package/dist/util.js.map +1 -1
- package/dist/version.txt +1 -1
- package/package.json +1 -1
- package/src/java/index.ts +1 -0
- package/src/java/rpc.ts +726 -537
- package/src/java/tree.ts +1 -1
- package/src/java/type-visitor.ts +241 -0
- package/src/java/type.ts +13 -277
- package/src/java/visitor.ts +581 -378
- package/src/javascript/preconditions.ts +7 -6
- package/src/javascript/rpc.ts +431 -360
- package/src/javascript/tree.ts +1 -1
- package/src/javascript/type-mapping.ts +7 -0
- package/src/javascript/visitor.ts +505 -310
- package/src/json/visitor.ts +47 -22
- package/src/rpc/queue.ts +20 -17
- package/src/rpc/request/generate.ts +31 -25
- package/src/rpc/request/get-languages.ts +18 -10
- package/src/rpc/request/get-object.ts +42 -34
- package/src/rpc/request/get-recipes.ts +15 -8
- package/src/rpc/request/index.ts +1 -0
- package/src/rpc/request/install-recipes.ts +96 -79
- package/src/rpc/request/metrics.ts +54 -48
- package/src/rpc/request/parse.ts +31 -25
- package/src/rpc/request/prepare-recipe.ts +31 -23
- package/src/rpc/request/print.ts +28 -14
- package/src/rpc/request/trace-get-object.ts +4 -0
- package/src/rpc/request/visit.ts +22 -16
- package/src/rpc/rewrite-rpc.ts +23 -10
- package/src/rpc/server.ts +17 -52
- package/src/rpc/trace.ts +3 -3
- package/src/util.ts +14 -0
- package/dist/rpc/chrome-profiler.d.ts +0 -25
- package/dist/rpc/chrome-profiler.d.ts.map +0 -1
- package/dist/rpc/chrome-profiler.js +0 -405
- package/dist/rpc/chrome-profiler.js.map +0 -1
- package/src/rpc/chrome-profiler.ts +0 -373
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 the original author or authors.
|
|
3
|
-
* <p>
|
|
4
|
-
* Licensed under the Moderne Source Available License (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
* <p>
|
|
8
|
-
* https://docs.moderne.io/licensing/moderne-source-available-license
|
|
9
|
-
* <p>
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import * as fs from 'fs';
|
|
17
|
-
import * as path from 'path';
|
|
18
|
-
import * as v8 from 'v8';
|
|
19
|
-
import * as inspector from 'inspector';
|
|
20
|
-
|
|
21
|
-
export class ChromeProfiler {
|
|
22
|
-
private traceEvents: any[] = [];
|
|
23
|
-
private memoryInterval?: NodeJS.Timeout;
|
|
24
|
-
private saveInterval?: NodeJS.Timeout;
|
|
25
|
-
private session?: inspector.Session;
|
|
26
|
-
private readonly pid = process.pid;
|
|
27
|
-
private readonly tid = 1; // Main thread
|
|
28
|
-
private readonly tracePath: string;
|
|
29
|
-
private exitHandlersRegistered = false;
|
|
30
|
-
private startTime: number = 0;
|
|
31
|
-
private ttsCounter: number = 0;
|
|
32
|
-
private lastProfileTime: number = 0;
|
|
33
|
-
private profileNodes = new Map();
|
|
34
|
-
|
|
35
|
-
constructor(outputPath?: string) {
|
|
36
|
-
this.tracePath = outputPath || path.join(process.cwd(), 'chrome-trace.json');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async start() {
|
|
40
|
-
this.startTime = Date.now() * 1000; // Convert to microseconds
|
|
41
|
-
this.lastProfileTime = this.startTime;
|
|
42
|
-
|
|
43
|
-
// Add initial metadata events
|
|
44
|
-
this.addMetadataEvents();
|
|
45
|
-
|
|
46
|
-
// Start V8 Inspector session for CPU profiling
|
|
47
|
-
this.session = new inspector.Session();
|
|
48
|
-
this.session.connect();
|
|
49
|
-
|
|
50
|
-
// Enable and start CPU profiling
|
|
51
|
-
await this.enableCpuProfiling();
|
|
52
|
-
|
|
53
|
-
// Start collecting memory data
|
|
54
|
-
this.startMemoryTracking();
|
|
55
|
-
|
|
56
|
-
// Save trace periodically and collect CPU profile samples
|
|
57
|
-
this.saveInterval = setInterval(async () => {
|
|
58
|
-
await this.collectCpuProfile();
|
|
59
|
-
this.saveTrace();
|
|
60
|
-
}, 10000); // Save every 10 seconds
|
|
61
|
-
|
|
62
|
-
// Register exit handlers
|
|
63
|
-
if (!this.exitHandlersRegistered) {
|
|
64
|
-
this.registerExitHandlers();
|
|
65
|
-
this.exitHandlersRegistered = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private async enableCpuProfiling() {
|
|
70
|
-
if (!this.session) return;
|
|
71
|
-
|
|
72
|
-
// Enable profiler
|
|
73
|
-
await new Promise<void>((resolve, reject) => {
|
|
74
|
-
this.session!.post('Profiler.enable', (err) => {
|
|
75
|
-
if (err) reject(err);
|
|
76
|
-
else resolve();
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Start sampling
|
|
81
|
-
await new Promise<void>((resolve, reject) => {
|
|
82
|
-
this.session!.post('Profiler.start', {
|
|
83
|
-
// Sample at high frequency for detailed profiling
|
|
84
|
-
samplingInterval: 100
|
|
85
|
-
}, (err) => {
|
|
86
|
-
if (err) reject(err);
|
|
87
|
-
else resolve();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Subscribe to console profile events
|
|
92
|
-
this.session.on('Profiler.consoleProfileStarted', (params: any) => {
|
|
93
|
-
this.traceEvents.push({
|
|
94
|
-
cat: 'disabled-by-default-devtools.timeline',
|
|
95
|
-
name: 'Profile',
|
|
96
|
-
ph: 'P',
|
|
97
|
-
id: params.id || '1',
|
|
98
|
-
pid: this.pid,
|
|
99
|
-
tid: this.tid,
|
|
100
|
-
ts: Date.now() * 1000
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private addMetadataEvents() {
|
|
106
|
-
// Thread name metadata
|
|
107
|
-
this.traceEvents.push({
|
|
108
|
-
args: { name: 'CrRendererMain' },
|
|
109
|
-
cat: '__metadata',
|
|
110
|
-
name: 'thread_name',
|
|
111
|
-
ph: 'M',
|
|
112
|
-
pid: this.pid,
|
|
113
|
-
tid: this.tid,
|
|
114
|
-
ts: 0
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// Process name metadata
|
|
118
|
-
this.traceEvents.push({
|
|
119
|
-
args: { name: 'Node.js' },
|
|
120
|
-
cat: '__metadata',
|
|
121
|
-
name: 'process_name',
|
|
122
|
-
ph: 'M',
|
|
123
|
-
pid: this.pid,
|
|
124
|
-
tid: 0,
|
|
125
|
-
ts: 0
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// TracingStartedInBrowser event - required for Chrome DevTools
|
|
129
|
-
this.traceEvents.push({
|
|
130
|
-
args: {
|
|
131
|
-
data: {
|
|
132
|
-
frameTreeNodeId: 1,
|
|
133
|
-
frames: [{
|
|
134
|
-
frame: '0x1',
|
|
135
|
-
name: '',
|
|
136
|
-
processId: this.pid,
|
|
137
|
-
url: 'node://process'
|
|
138
|
-
}],
|
|
139
|
-
persistentIds: true
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
cat: 'disabled-by-default-devtools.timeline',
|
|
143
|
-
name: 'TracingStartedInBrowser',
|
|
144
|
-
ph: 'I',
|
|
145
|
-
pid: this.pid,
|
|
146
|
-
s: 't',
|
|
147
|
-
tid: this.tid,
|
|
148
|
-
ts: this.startTime,
|
|
149
|
-
tts: this.ttsCounter++
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
private startMemoryTracking() {
|
|
154
|
-
// Collect memory data every 50ms (matching Chrome's frequency)
|
|
155
|
-
this.memoryInterval = setInterval(() => {
|
|
156
|
-
const memStats = v8.getHeapStatistics();
|
|
157
|
-
const timestamp = Date.now() * 1000;
|
|
158
|
-
|
|
159
|
-
// UpdateCounters event with correct format
|
|
160
|
-
this.traceEvents.push({
|
|
161
|
-
args: {
|
|
162
|
-
data: {
|
|
163
|
-
jsHeapSizeUsed: memStats.used_heap_size,
|
|
164
|
-
jsEventListeners: 0,
|
|
165
|
-
documents: 1,
|
|
166
|
-
nodes: 0
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
cat: 'disabled-by-default-devtools.timeline',
|
|
170
|
-
name: 'UpdateCounters',
|
|
171
|
-
ph: 'I', // Instant event, not Counter
|
|
172
|
-
pid: this.pid,
|
|
173
|
-
s: 't', // Required for instant events
|
|
174
|
-
tid: this.tid,
|
|
175
|
-
ts: timestamp,
|
|
176
|
-
tts: this.ttsCounter++
|
|
177
|
-
});
|
|
178
|
-
}, 50); // Every 50ms
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
private saveTrace() {
|
|
182
|
-
const trace = {
|
|
183
|
-
metadata: {
|
|
184
|
-
'command-line': process.argv.join(' '),
|
|
185
|
-
'cpu-brand': 'Node.js V8',
|
|
186
|
-
'dataOrigin': 'TraceEvents',
|
|
187
|
-
'highres-ticks': true,
|
|
188
|
-
'hostname': 'localhost',
|
|
189
|
-
'num-cpus': require('os').cpus().length,
|
|
190
|
-
'physical-memory': require('os').totalmem(),
|
|
191
|
-
'platform': process.platform,
|
|
192
|
-
'process-uptime': process.uptime(),
|
|
193
|
-
'product-version': `Node.js ${process.version}`,
|
|
194
|
-
'protocol-version': '1.0',
|
|
195
|
-
'source': 'NodeProfiler',
|
|
196
|
-
'startTime': new Date(this.startTime / 1000).toISOString(),
|
|
197
|
-
'trace-config': '',
|
|
198
|
-
'user-agent': `Node.js/${process.version}`,
|
|
199
|
-
'v8-version': process.versions.v8
|
|
200
|
-
},
|
|
201
|
-
traceEvents: this.traceEvents
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
fs.writeFileSync(this.tracePath, JSON.stringify(trace, null, 2));
|
|
206
|
-
} catch (e) {
|
|
207
|
-
// Ignore write errors
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
private async collectCpuProfile() {
|
|
212
|
-
if (!this.session) return;
|
|
213
|
-
|
|
214
|
-
try {
|
|
215
|
-
// Stop current profiling to get samples
|
|
216
|
-
const profile = await new Promise<any>((resolve, reject) => {
|
|
217
|
-
this.session!.post('Profiler.stop', (err, params) => {
|
|
218
|
-
if (err) reject(err);
|
|
219
|
-
else resolve(params.profile);
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
// Convert CPU profile samples to trace events
|
|
224
|
-
if (profile && profile.samples) {
|
|
225
|
-
this.addCpuProfileSamples(profile);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Restart profiling for the next interval
|
|
229
|
-
await new Promise<void>((resolve, reject) => {
|
|
230
|
-
this.session!.post('Profiler.start', {
|
|
231
|
-
samplingInterval: 100
|
|
232
|
-
}, (err) => {
|
|
233
|
-
if (err) reject(err);
|
|
234
|
-
else resolve();
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
} catch (e) {
|
|
238
|
-
// Ignore errors and try to restart
|
|
239
|
-
try {
|
|
240
|
-
await new Promise<void>((resolve, reject) => {
|
|
241
|
-
this.session!.post('Profiler.start', {
|
|
242
|
-
samplingInterval: 100
|
|
243
|
-
}, (err) => {
|
|
244
|
-
if (err) reject(err);
|
|
245
|
-
else resolve();
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
} catch (e2) {
|
|
249
|
-
// Ignore restart errors
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
async stop() {
|
|
255
|
-
// Clear intervals
|
|
256
|
-
if (this.memoryInterval) {
|
|
257
|
-
clearInterval(this.memoryInterval);
|
|
258
|
-
this.memoryInterval = undefined;
|
|
259
|
-
}
|
|
260
|
-
if (this.saveInterval) {
|
|
261
|
-
clearInterval(this.saveInterval);
|
|
262
|
-
this.saveInterval = undefined;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Collect final CPU profile
|
|
266
|
-
await this.collectCpuProfile();
|
|
267
|
-
|
|
268
|
-
// Disconnect session
|
|
269
|
-
if (this.session) {
|
|
270
|
-
this.session.disconnect();
|
|
271
|
-
this.session = undefined;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// Save final trace
|
|
275
|
-
this.saveTrace();
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
private addCpuProfileSamples(profile: any) {
|
|
279
|
-
if (!profile.samples || !profile.timeDeltas || !profile.nodes) return;
|
|
280
|
-
|
|
281
|
-
// Use the last profile time as starting point to maintain continuity
|
|
282
|
-
let currentTime = this.lastProfileTime;
|
|
283
|
-
|
|
284
|
-
// Update nodes map with new nodes
|
|
285
|
-
profile.nodes.forEach((node: any) => {
|
|
286
|
-
this.profileNodes.set(node.id, node);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
// Convert samples to trace events with actual function names
|
|
290
|
-
profile.samples.forEach((nodeId: number, index: number) => {
|
|
291
|
-
const node = this.profileNodes.get(nodeId);
|
|
292
|
-
if (!node) return;
|
|
293
|
-
|
|
294
|
-
currentTime += (profile.timeDeltas[index] || 0);
|
|
295
|
-
|
|
296
|
-
const callFrame = node.callFrame;
|
|
297
|
-
if (callFrame) {
|
|
298
|
-
// Clean up function name for display
|
|
299
|
-
let functionName = callFrame.functionName || '(anonymous)';
|
|
300
|
-
if (functionName === '' || functionName === '(root)') {
|
|
301
|
-
functionName = '(program)';
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// Extract filename from URL or use a meaningful default
|
|
305
|
-
let url = callFrame.url || '';
|
|
306
|
-
let fileName: string;
|
|
307
|
-
|
|
308
|
-
if (url) {
|
|
309
|
-
// Clean up the URL for display
|
|
310
|
-
if (url.startsWith('file://')) {
|
|
311
|
-
url = url.substring(7);
|
|
312
|
-
}
|
|
313
|
-
const parts = url.split('/');
|
|
314
|
-
fileName = parts[parts.length - 1] || url;
|
|
315
|
-
|
|
316
|
-
// Special handling for node internals
|
|
317
|
-
if (url.startsWith('node:')) {
|
|
318
|
-
fileName = url;
|
|
319
|
-
}
|
|
320
|
-
} else {
|
|
321
|
-
// No URL - try to provide context from function name
|
|
322
|
-
if (functionName === '(garbage collector)') {
|
|
323
|
-
fileName = 'v8::gc';
|
|
324
|
-
} else if (functionName === '(idle)') {
|
|
325
|
-
fileName = 'v8::idle';
|
|
326
|
-
} else if (functionName === '(program)') {
|
|
327
|
-
fileName = 'main';
|
|
328
|
-
} else if (functionName.includes('::')) {
|
|
329
|
-
// C++ internal function
|
|
330
|
-
fileName = 'native';
|
|
331
|
-
} else {
|
|
332
|
-
// JavaScript code without source mapping
|
|
333
|
-
fileName = 'javascript';
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
this.traceEvents.push({
|
|
338
|
-
args: {
|
|
339
|
-
data: {
|
|
340
|
-
columnNumber: callFrame.columnNumber || 0,
|
|
341
|
-
frame: `0x${nodeId.toString(16)}`,
|
|
342
|
-
functionName: functionName,
|
|
343
|
-
lineNumber: callFrame.lineNumber || 0,
|
|
344
|
-
scriptId: String(callFrame.scriptId || 0),
|
|
345
|
-
url: url || fileName // Use fileName as URL if no real URL
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
cat: 'devtools.timeline',
|
|
349
|
-
dur: Math.max(profile.timeDeltas[index] || 1, 1),
|
|
350
|
-
name: 'FunctionCall',
|
|
351
|
-
ph: 'X',
|
|
352
|
-
pid: this.pid,
|
|
353
|
-
tid: this.tid,
|
|
354
|
-
ts: Math.floor(currentTime),
|
|
355
|
-
tts: this.ttsCounter++
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
// Update lastProfileTime to maintain continuity for the next batch
|
|
361
|
-
this.lastProfileTime = currentTime;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
private registerExitHandlers() {
|
|
365
|
-
const cleanup = async () => {
|
|
366
|
-
await this.stop();
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
process.once('beforeExit', cleanup);
|
|
370
|
-
process.once('SIGINT', cleanup);
|
|
371
|
-
process.once('SIGTERM', cleanup);
|
|
372
|
-
}
|
|
373
|
-
}
|