@coherent.js/devtools 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.js +2117 -0
- package/dist/index.js.map +7 -0
- package/dist/inspector.js +397 -0
- package/dist/inspector.js.map +7 -0
- package/dist/logger.js +469 -0
- package/dist/logger.js.map +7 -0
- package/dist/profiler.js +508 -0
- package/dist/profiler.js.map +7 -0
- package/package.json +43 -0
- package/types/index.d.ts +214 -0
package/dist/profiler.js
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
// src/profiler.js
|
|
2
|
+
var PerformanceProfiler = class {
|
|
3
|
+
constructor(options = {}) {
|
|
4
|
+
this.options = {
|
|
5
|
+
enabled: true,
|
|
6
|
+
sampleRate: 1,
|
|
7
|
+
// 1.0 = 100% sampling
|
|
8
|
+
slowThreshold: 16,
|
|
9
|
+
// 16ms = 60fps
|
|
10
|
+
trackMemory: typeof performance !== "undefined" && performance.memory,
|
|
11
|
+
maxSamples: options.maxSamples || 1e3,
|
|
12
|
+
...options
|
|
13
|
+
};
|
|
14
|
+
this.measurements = [];
|
|
15
|
+
this.sessions = /* @__PURE__ */ new Map();
|
|
16
|
+
this.currentSession = null;
|
|
17
|
+
this.marks = /* @__PURE__ */ new Map();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Start a profiling session
|
|
21
|
+
*/
|
|
22
|
+
start(name = "default") {
|
|
23
|
+
if (!this.options.enabled) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (this.options.sampleRate < 1 && Math.random() > this.options.sampleRate) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const session = {
|
|
30
|
+
id: this.generateId(),
|
|
31
|
+
name,
|
|
32
|
+
startTime: Date.now(),
|
|
33
|
+
measurements: [],
|
|
34
|
+
marks: [],
|
|
35
|
+
active: true
|
|
36
|
+
};
|
|
37
|
+
this.sessions.set(session.id, session);
|
|
38
|
+
this.currentSession = session;
|
|
39
|
+
if (typeof performance !== "undefined" && performance.mark) {
|
|
40
|
+
performance.mark(`coherent-session-start-${session.id}`);
|
|
41
|
+
}
|
|
42
|
+
return session.id;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Stop a profiling session
|
|
46
|
+
*/
|
|
47
|
+
stop(sessionId) {
|
|
48
|
+
if (!sessionId) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const session = this.sessions.get(sessionId);
|
|
52
|
+
if (!session) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
session.endTime = Date.now();
|
|
56
|
+
session.duration = session.endTime - session.startTime;
|
|
57
|
+
session.active = false;
|
|
58
|
+
if (typeof performance !== "undefined" && performance.mark) {
|
|
59
|
+
performance.mark(`coherent-session-end-${session.id}`);
|
|
60
|
+
}
|
|
61
|
+
if (this.currentSession === session) {
|
|
62
|
+
this.currentSession = null;
|
|
63
|
+
}
|
|
64
|
+
this.measurements.push(session);
|
|
65
|
+
if (this.measurements.length > this.options.maxSamples) {
|
|
66
|
+
this.measurements.shift();
|
|
67
|
+
}
|
|
68
|
+
return this.analyzeSession(session);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start measuring a render
|
|
72
|
+
*/
|
|
73
|
+
startRender(componentName, props = {}) {
|
|
74
|
+
if (!this.options.enabled) return null;
|
|
75
|
+
if (Math.random() > this.options.sampleRate) return null;
|
|
76
|
+
const measurementId = this.generateId();
|
|
77
|
+
const measurement = {
|
|
78
|
+
id: measurementId,
|
|
79
|
+
componentName,
|
|
80
|
+
props,
|
|
81
|
+
startTime: Date.now(),
|
|
82
|
+
startMemory: this.getMemoryUsage(),
|
|
83
|
+
phase: "render"
|
|
84
|
+
};
|
|
85
|
+
this.marks.set(measurementId, measurement);
|
|
86
|
+
if (typeof performance !== "undefined" && performance.mark) {
|
|
87
|
+
performance.mark(`coherent-render-start-${measurementId}`);
|
|
88
|
+
}
|
|
89
|
+
return measurementId;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* End measuring a render
|
|
93
|
+
*/
|
|
94
|
+
endRender(measurementId, result = {}) {
|
|
95
|
+
if (!measurementId || !this.marks.has(measurementId)) return null;
|
|
96
|
+
const measurement = this.marks.get(measurementId);
|
|
97
|
+
measurement.endTime = Date.now();
|
|
98
|
+
measurement.duration = measurement.endTime - measurement.startTime;
|
|
99
|
+
measurement.endMemory = this.getMemoryUsage();
|
|
100
|
+
measurement.memoryDelta = measurement.endMemory - measurement.startMemory;
|
|
101
|
+
measurement.result = result;
|
|
102
|
+
measurement.slow = measurement.duration > this.options.slowThreshold;
|
|
103
|
+
if (typeof performance !== "undefined" && performance.mark) {
|
|
104
|
+
performance.mark(`coherent-render-end-${measurementId}`);
|
|
105
|
+
if (performance.measure) {
|
|
106
|
+
try {
|
|
107
|
+
performance.measure(
|
|
108
|
+
`coherent-render-${measurementId}`,
|
|
109
|
+
`coherent-render-start-${measurementId}`,
|
|
110
|
+
`coherent-render-end-${measurementId}`
|
|
111
|
+
);
|
|
112
|
+
} catch {
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
this.measurements.push(measurement);
|
|
117
|
+
if (this.currentSession) {
|
|
118
|
+
this.currentSession.measurements.push(measurement);
|
|
119
|
+
}
|
|
120
|
+
this.marks.delete(measurementId);
|
|
121
|
+
return measurement;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Mark a point in time
|
|
125
|
+
*/
|
|
126
|
+
mark(name, data = {}) {
|
|
127
|
+
const mark = {
|
|
128
|
+
name,
|
|
129
|
+
timestamp: Date.now(),
|
|
130
|
+
data,
|
|
131
|
+
memory: this.getMemoryUsage()
|
|
132
|
+
};
|
|
133
|
+
if (this.currentSession) {
|
|
134
|
+
this.currentSession.marks.push(mark);
|
|
135
|
+
}
|
|
136
|
+
if (typeof performance !== "undefined" && performance.mark) {
|
|
137
|
+
performance.mark(`coherent-mark-${name}`);
|
|
138
|
+
}
|
|
139
|
+
return mark;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Measure time between two marks
|
|
143
|
+
*/
|
|
144
|
+
measure(startMark, endMark) {
|
|
145
|
+
const start = this.findMark(startMark);
|
|
146
|
+
const end = this.findMark(endMark);
|
|
147
|
+
if (!start || !end) {
|
|
148
|
+
throw new Error("Mark not found");
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
duration: end.timestamp - start.timestamp,
|
|
152
|
+
startMark: start.name,
|
|
153
|
+
endMark: end.name
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get memory usage
|
|
158
|
+
*/
|
|
159
|
+
getMemoryUsage() {
|
|
160
|
+
if (typeof performance !== "undefined" && performance.memory) {
|
|
161
|
+
return {
|
|
162
|
+
used: performance.memory.usedJSHeapSize,
|
|
163
|
+
total: performance.memory.totalJSHeapSize,
|
|
164
|
+
limit: performance.memory.jsHeapSizeLimit
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Find a mark by name
|
|
171
|
+
*/
|
|
172
|
+
findMark(name) {
|
|
173
|
+
if (!this.currentSession) return null;
|
|
174
|
+
return this.currentSession.marks.find((m) => m.name === name);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get all measurements
|
|
178
|
+
*/
|
|
179
|
+
getMeasurements(filter = {}) {
|
|
180
|
+
let results = [...this.measurements];
|
|
181
|
+
if (filter.componentName) {
|
|
182
|
+
results = results.filter((m) => m.componentName === filter.componentName);
|
|
183
|
+
}
|
|
184
|
+
if (filter.slow) {
|
|
185
|
+
results = results.filter((m) => m.slow);
|
|
186
|
+
}
|
|
187
|
+
if (filter.minDuration) {
|
|
188
|
+
results = results.filter((m) => m.duration >= filter.minDuration);
|
|
189
|
+
}
|
|
190
|
+
if (filter.limit) {
|
|
191
|
+
results = results.slice(0, filter.limit);
|
|
192
|
+
}
|
|
193
|
+
return results;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Analyze a session
|
|
197
|
+
*/
|
|
198
|
+
analyzeSession(session) {
|
|
199
|
+
const measurements = session.measurements;
|
|
200
|
+
if (measurements.length === 0) {
|
|
201
|
+
return {
|
|
202
|
+
session: session.id,
|
|
203
|
+
duration: session.duration,
|
|
204
|
+
measurements: 0,
|
|
205
|
+
analysis: null
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const durations = measurements.map((m) => m.duration);
|
|
209
|
+
const sorted = [...durations].sort((a, b) => a - b);
|
|
210
|
+
return {
|
|
211
|
+
session: session.id,
|
|
212
|
+
name: session.name,
|
|
213
|
+
duration: session.duration,
|
|
214
|
+
measurements: measurements.length,
|
|
215
|
+
analysis: {
|
|
216
|
+
total: durations.reduce((a, b) => a + b, 0),
|
|
217
|
+
average: durations.reduce((a, b) => a + b, 0) / durations.length,
|
|
218
|
+
median: sorted[Math.floor(sorted.length / 2)],
|
|
219
|
+
min: Math.min(...durations),
|
|
220
|
+
max: Math.max(...durations),
|
|
221
|
+
p95: sorted[Math.floor(sorted.length * 0.95)],
|
|
222
|
+
p99: sorted[Math.floor(sorted.length * 0.99)],
|
|
223
|
+
slowRenders: measurements.filter((m) => m.slow).length,
|
|
224
|
+
slowPercentage: measurements.filter((m) => m.slow).length / measurements.length * 100
|
|
225
|
+
},
|
|
226
|
+
byComponent: this.groupByComponent(measurements),
|
|
227
|
+
slowest: measurements.sort((a, b) => b.duration - a.duration).slice(0, 10).map((m) => ({
|
|
228
|
+
component: m.componentName,
|
|
229
|
+
duration: m.duration,
|
|
230
|
+
timestamp: m.startTime
|
|
231
|
+
}))
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Group measurements by component
|
|
236
|
+
*/
|
|
237
|
+
groupByComponent(measurements) {
|
|
238
|
+
const groups = {};
|
|
239
|
+
measurements.forEach((m) => {
|
|
240
|
+
if (!groups[m.componentName]) {
|
|
241
|
+
groups[m.componentName] = {
|
|
242
|
+
count: 0,
|
|
243
|
+
totalDuration: 0,
|
|
244
|
+
durations: []
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
groups[m.componentName].count++;
|
|
248
|
+
groups[m.componentName].totalDuration += m.duration;
|
|
249
|
+
groups[m.componentName].durations.push(m.duration);
|
|
250
|
+
});
|
|
251
|
+
Object.keys(groups).forEach((name) => {
|
|
252
|
+
const group = groups[name];
|
|
253
|
+
group.average = group.totalDuration / group.count;
|
|
254
|
+
group.min = Math.min(...group.durations);
|
|
255
|
+
group.max = Math.max(...group.durations);
|
|
256
|
+
});
|
|
257
|
+
return groups;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get performance summary
|
|
261
|
+
*/
|
|
262
|
+
getSummary() {
|
|
263
|
+
const allMeasurements = this.measurements;
|
|
264
|
+
if (allMeasurements.length === 0) {
|
|
265
|
+
return {
|
|
266
|
+
totalMeasurements: 0,
|
|
267
|
+
totalSessions: this.sessions.size,
|
|
268
|
+
analysis: null
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
const durations = allMeasurements.map((m) => m.duration);
|
|
272
|
+
return {
|
|
273
|
+
totalMeasurements: allMeasurements.length,
|
|
274
|
+
totalSessions: this.sessions.size,
|
|
275
|
+
slowRenders: allMeasurements.filter((m) => m.slow).length,
|
|
276
|
+
analysis: {
|
|
277
|
+
average: durations.reduce((a, b) => a + b, 0) / durations.length,
|
|
278
|
+
min: Math.min(...durations),
|
|
279
|
+
max: Math.max(...durations),
|
|
280
|
+
slowPercentage: allMeasurements.filter((m) => m.slow).length / allMeasurements.length * 100
|
|
281
|
+
},
|
|
282
|
+
byComponent: this.groupByComponent(allMeasurements),
|
|
283
|
+
recentSlow: allMeasurements.filter((m) => m.slow).slice(-10).map((m) => ({
|
|
284
|
+
component: m.componentName,
|
|
285
|
+
duration: m.duration,
|
|
286
|
+
timestamp: m.startTime
|
|
287
|
+
}))
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get statistics
|
|
292
|
+
*/
|
|
293
|
+
getStatistics() {
|
|
294
|
+
if (this.measurements.length === 0) {
|
|
295
|
+
return { mean: 0, median: 0, min: 0, max: 0, stdDev: 0 };
|
|
296
|
+
}
|
|
297
|
+
const durations = this.measurements.map((m) => m.duration);
|
|
298
|
+
const sum = durations.reduce((a, b) => a + b, 0);
|
|
299
|
+
const mean = sum / durations.length;
|
|
300
|
+
const sorted = [...durations].sort((a, b) => a - b);
|
|
301
|
+
const median = sorted[Math.floor(sorted.length / 2)];
|
|
302
|
+
const variance = durations.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / durations.length;
|
|
303
|
+
const stdDev = Math.sqrt(variance);
|
|
304
|
+
return {
|
|
305
|
+
mean,
|
|
306
|
+
median,
|
|
307
|
+
min: Math.min(...durations),
|
|
308
|
+
max: Math.max(...durations),
|
|
309
|
+
stdDev
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Get bottlenecks
|
|
314
|
+
*/
|
|
315
|
+
getBottlenecks(threshold = null) {
|
|
316
|
+
const slowThreshold = threshold || this.options.slowThreshold;
|
|
317
|
+
return this.measurements.filter((m) => m.duration > slowThreshold).sort((a, b) => b.duration - a.duration).map((m) => ({
|
|
318
|
+
name: m.name,
|
|
319
|
+
duration: m.duration,
|
|
320
|
+
timestamp: m.startTime
|
|
321
|
+
}));
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get metrics
|
|
325
|
+
*/
|
|
326
|
+
getMetrics() {
|
|
327
|
+
const operationCounts = {};
|
|
328
|
+
this.measurements.forEach((m) => {
|
|
329
|
+
operationCounts[m.name] = (operationCounts[m.name] || 0) + 1;
|
|
330
|
+
});
|
|
331
|
+
const totalDuration = this.measurements.reduce((sum, m) => sum + m.duration, 0);
|
|
332
|
+
return {
|
|
333
|
+
totalOperations: this.measurements.length,
|
|
334
|
+
totalDuration,
|
|
335
|
+
operationCounts,
|
|
336
|
+
averageDuration: this.measurements.length > 0 ? totalDuration / this.measurements.length : 0,
|
|
337
|
+
memoryUsage: this.options.trackMemory && typeof performance !== "undefined" && performance.memory ? performance.memory.usedJSHeapSize : null
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Generate report
|
|
342
|
+
*/
|
|
343
|
+
generateReport() {
|
|
344
|
+
const stats = this.getStatistics();
|
|
345
|
+
const metrics = this.getMetrics();
|
|
346
|
+
const bottlenecks = this.getBottlenecks();
|
|
347
|
+
const recommendations = this.getRecommendations();
|
|
348
|
+
return {
|
|
349
|
+
summary: {
|
|
350
|
+
totalOperations: metrics.totalOperations,
|
|
351
|
+
averageDuration: metrics.averageDuration,
|
|
352
|
+
slowOperations: bottlenecks.length
|
|
353
|
+
},
|
|
354
|
+
statistics: stats,
|
|
355
|
+
operations: this.measurements.map((m) => ({
|
|
356
|
+
name: m.name,
|
|
357
|
+
duration: m.duration,
|
|
358
|
+
timestamp: m.startTime
|
|
359
|
+
})),
|
|
360
|
+
bottlenecks: bottlenecks.slice(0, 10),
|
|
361
|
+
recommendations,
|
|
362
|
+
timestamp: Date.now()
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Export profiling data
|
|
367
|
+
*/
|
|
368
|
+
export() {
|
|
369
|
+
return {
|
|
370
|
+
sessions: Array.from(this.sessions.values()),
|
|
371
|
+
measurements: this.measurements,
|
|
372
|
+
metrics: this.getMetrics(),
|
|
373
|
+
statistics: this.getStatistics(),
|
|
374
|
+
exportedAt: Date.now()
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Format metrics for display
|
|
379
|
+
*/
|
|
380
|
+
formatMetrics() {
|
|
381
|
+
const metrics = this.getMetrics();
|
|
382
|
+
const stats = this.getStatistics();
|
|
383
|
+
let output = `Performance Metrics
|
|
384
|
+
`;
|
|
385
|
+
output += `==================
|
|
386
|
+
`;
|
|
387
|
+
output += `Total Operations: ${metrics.totalOperations}
|
|
388
|
+
`;
|
|
389
|
+
output += `Average Duration: ${metrics.averageDuration.toFixed(2)}ms
|
|
390
|
+
`;
|
|
391
|
+
output += `Mean: ${stats.mean.toFixed(2)}ms
|
|
392
|
+
`;
|
|
393
|
+
output += `Median: ${stats.median.toFixed(2)}ms
|
|
394
|
+
`;
|
|
395
|
+
output += `Min: ${stats.min.toFixed(2)}ms
|
|
396
|
+
`;
|
|
397
|
+
output += `Max: ${stats.max.toFixed(2)}ms
|
|
398
|
+
`;
|
|
399
|
+
return output;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Compare two profiles
|
|
403
|
+
*/
|
|
404
|
+
compare(profileId1, profileId2) {
|
|
405
|
+
const session1 = this.sessions.get(profileId1);
|
|
406
|
+
const session2 = this.sessions.get(profileId2);
|
|
407
|
+
if (!session1 || !session2) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
difference: session2.duration - session1.duration,
|
|
412
|
+
percentChange: (session2.duration - session1.duration) / session1.duration * 100,
|
|
413
|
+
profile1: { name: session1.name, duration: session1.duration },
|
|
414
|
+
profile2: { name: session2.name, duration: session2.duration }
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Get performance recommendations
|
|
419
|
+
*/
|
|
420
|
+
getRecommendations() {
|
|
421
|
+
const recommendations = [];
|
|
422
|
+
const bottlenecks = this.getBottlenecks();
|
|
423
|
+
const stats = this.getStatistics();
|
|
424
|
+
if (bottlenecks.length > 0) {
|
|
425
|
+
bottlenecks.slice(0, 5).forEach((bottleneck) => {
|
|
426
|
+
recommendations.push({
|
|
427
|
+
type: "bottleneck",
|
|
428
|
+
operation: bottleneck.name,
|
|
429
|
+
suggestion: `Optimize ${bottleneck.name} - duration: ${bottleneck.duration.toFixed(2)}ms exceeds threshold`,
|
|
430
|
+
severity: "high",
|
|
431
|
+
message: `Found slow operation exceeding ${this.options.slowThreshold}ms`
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (stats.max > this.options.slowThreshold * 2) {
|
|
436
|
+
recommendations.push({
|
|
437
|
+
type: "performance",
|
|
438
|
+
operation: "general",
|
|
439
|
+
suggestion: `Review operations with high duration`,
|
|
440
|
+
message: `Maximum duration (${stats.max.toFixed(2)}ms) is significantly high`,
|
|
441
|
+
severity: "medium"
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
return recommendations;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Clear all data
|
|
448
|
+
*/
|
|
449
|
+
clear() {
|
|
450
|
+
this.measurements = [];
|
|
451
|
+
this.sessions.clear();
|
|
452
|
+
this.currentSession = null;
|
|
453
|
+
this.marks.clear();
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Enable profiler
|
|
457
|
+
*/
|
|
458
|
+
enable() {
|
|
459
|
+
this.options.enabled = true;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Disable profiler
|
|
463
|
+
*/
|
|
464
|
+
disable() {
|
|
465
|
+
this.options.enabled = false;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Generate unique ID
|
|
469
|
+
*/
|
|
470
|
+
generateId() {
|
|
471
|
+
return `prof-${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
function createProfiler(options = {}) {
|
|
475
|
+
return new PerformanceProfiler(options);
|
|
476
|
+
}
|
|
477
|
+
async function measure(name, fn, profiler = null) {
|
|
478
|
+
const prof = profiler || new PerformanceProfiler();
|
|
479
|
+
const sessionId = prof.start(name);
|
|
480
|
+
try {
|
|
481
|
+
const value = await fn();
|
|
482
|
+
const result = prof.stop(sessionId);
|
|
483
|
+
return { value, duration: result?.duration || 0 };
|
|
484
|
+
} catch (error) {
|
|
485
|
+
const result = prof.stop(sessionId);
|
|
486
|
+
throw { error, duration: result?.duration || 0 };
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function profile(fn) {
|
|
490
|
+
return function(...args) {
|
|
491
|
+
const result = fn(...args);
|
|
492
|
+
return result;
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
var profiler_default = {
|
|
496
|
+
PerformanceProfiler,
|
|
497
|
+
createProfiler,
|
|
498
|
+
measure,
|
|
499
|
+
profile
|
|
500
|
+
};
|
|
501
|
+
export {
|
|
502
|
+
PerformanceProfiler,
|
|
503
|
+
createProfiler,
|
|
504
|
+
profiler_default as default,
|
|
505
|
+
measure,
|
|
506
|
+
profile
|
|
507
|
+
};
|
|
508
|
+
//# sourceMappingURL=profiler.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/profiler.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Coherent.js Performance Profiler\n * \n * Tracks and analyzes rendering performance\n * \n * @module devtools/profiler\n */\n\n/**\n * Performance Profiler\n * Measures and analyzes component rendering performance\n */\nexport class PerformanceProfiler {\n constructor(options = {}) {\n this.options = {\n enabled: true,\n sampleRate: 1.0, // 1.0 = 100% sampling\n slowThreshold: 16, // 16ms = 60fps\n trackMemory: typeof performance !== 'undefined' && performance.memory,\n maxSamples: options.maxSamples || 1000,\n ...options\n };\n \n this.measurements = [];\n this.sessions = new Map();\n this.currentSession = null;\n this.marks = new Map();\n }\n\n /**\n * Start a profiling session\n */\n start(name = 'default') {\n if (!this.options.enabled) {\n return null;\n }\n\n // Apply sampling\n if (this.options.sampleRate < 1.0 && Math.random() > this.options.sampleRate) {\n return null;\n }\n\n const session = {\n id: this.generateId(),\n name,\n startTime: Date.now(),\n measurements: [],\n marks: [],\n active: true\n };\n\n this.sessions.set(session.id, session);\n this.currentSession = session;\n\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(`coherent-session-start-${session.id}`);\n }\n\n return session.id;\n }\n\n /**\n * Stop a profiling session\n */\n stop(sessionId) {\n if (!sessionId) {\n return null;\n }\n\n const session = this.sessions.get(sessionId);\n\n if (!session) {\n return null; // Gracefully handle non-existent sessions\n }\n\n session.endTime = Date.now();\n session.duration = session.endTime - session.startTime;\n session.active = false;\n\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(`coherent-session-end-${session.id}`);\n }\n\n if (this.currentSession === session) {\n this.currentSession = null;\n }\n\n // Store measurement\n this.measurements.push(session);\n \n // Limit measurements (maxSamples)\n if (this.measurements.length > this.options.maxSamples) {\n this.measurements.shift();\n }\n\n return this.analyzeSession(session);\n }\n\n /**\n * Start measuring a render\n */\n startRender(componentName, props = {}) {\n if (!this.options.enabled) return null;\n \n // Sample rate check\n if (Math.random() > this.options.sampleRate) return null;\n\n const measurementId = this.generateId();\n const measurement = {\n id: measurementId,\n componentName,\n props,\n startTime: Date.now(),\n startMemory: this.getMemoryUsage(),\n phase: 'render'\n };\n\n this.marks.set(measurementId, measurement);\n\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(`coherent-render-start-${measurementId}`);\n }\n\n return measurementId;\n }\n\n /**\n * End measuring a render\n */\n endRender(measurementId, result = {}) {\n if (!measurementId || !this.marks.has(measurementId)) return null;\n\n const measurement = this.marks.get(measurementId);\n measurement.endTime = Date.now();\n measurement.duration = measurement.endTime - measurement.startTime;\n measurement.endMemory = this.getMemoryUsage();\n measurement.memoryDelta = measurement.endMemory - measurement.startMemory;\n measurement.result = result;\n measurement.slow = measurement.duration > this.options.slowThreshold;\n\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(`coherent-render-end-${measurementId}`);\n \n if (performance.measure) {\n try {\n performance.measure(\n `coherent-render-${measurementId}`,\n `coherent-render-start-${measurementId}`,\n `coherent-render-end-${measurementId}`\n );\n } catch {\n // Ignore measure errors\n }\n }\n }\n\n // Add to measurements\n this.measurements.push(measurement);\n \n // Add to current session\n if (this.currentSession) {\n this.currentSession.measurements.push(measurement);\n }\n\n // Clean up\n this.marks.delete(measurementId);\n\n return measurement;\n }\n\n /**\n * Mark a point in time\n */\n mark(name, data = {}) {\n const mark = {\n name,\n timestamp: Date.now(),\n data,\n memory: this.getMemoryUsage()\n };\n\n if (this.currentSession) {\n this.currentSession.marks.push(mark);\n }\n\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(`coherent-mark-${name}`);\n }\n\n return mark;\n }\n\n /**\n * Measure time between two marks\n */\n measure(startMark, endMark) {\n const start = this.findMark(startMark);\n const end = this.findMark(endMark);\n\n if (!start || !end) {\n throw new Error('Mark not found');\n }\n\n return {\n duration: end.timestamp - start.timestamp,\n startMark: start.name,\n endMark: end.name\n };\n }\n\n /**\n * Get memory usage\n */\n getMemoryUsage() {\n if (typeof performance !== 'undefined' && performance.memory) {\n return {\n used: performance.memory.usedJSHeapSize,\n total: performance.memory.totalJSHeapSize,\n limit: performance.memory.jsHeapSizeLimit\n };\n }\n return null;\n }\n\n /**\n * Find a mark by name\n */\n findMark(name) {\n if (!this.currentSession) return null;\n return this.currentSession.marks.find(m => m.name === name);\n }\n\n /**\n * Get all measurements\n */\n getMeasurements(filter = {}) {\n let results = [...this.measurements];\n\n if (filter.componentName) {\n results = results.filter(m => m.componentName === filter.componentName);\n }\n\n if (filter.slow) {\n results = results.filter(m => m.slow);\n }\n\n if (filter.minDuration) {\n results = results.filter(m => m.duration >= filter.minDuration);\n }\n\n if (filter.limit) {\n results = results.slice(0, filter.limit);\n }\n\n return results;\n }\n\n /**\n * Analyze a session\n */\n analyzeSession(session) {\n const measurements = session.measurements;\n\n if (measurements.length === 0) {\n return {\n session: session.id,\n duration: session.duration,\n measurements: 0,\n analysis: null\n };\n }\n\n const durations = measurements.map(m => m.duration);\n const sorted = [...durations].sort((a, b) => a - b);\n\n return {\n session: session.id,\n name: session.name,\n duration: session.duration,\n measurements: measurements.length,\n analysis: {\n total: durations.reduce((a, b) => a + b, 0),\n average: durations.reduce((a, b) => a + b, 0) / durations.length,\n median: sorted[Math.floor(sorted.length / 2)],\n min: Math.min(...durations),\n max: Math.max(...durations),\n p95: sorted[Math.floor(sorted.length * 0.95)],\n p99: sorted[Math.floor(sorted.length * 0.99)],\n slowRenders: measurements.filter(m => m.slow).length,\n slowPercentage: (measurements.filter(m => m.slow).length / measurements.length) * 100\n },\n byComponent: this.groupByComponent(measurements),\n slowest: measurements\n .sort((a, b) => b.duration - a.duration)\n .slice(0, 10)\n .map(m => ({\n component: m.componentName,\n duration: m.duration,\n timestamp: m.startTime\n }))\n };\n }\n\n /**\n * Group measurements by component\n */\n groupByComponent(measurements) {\n const groups = {};\n\n measurements.forEach(m => {\n if (!groups[m.componentName]) {\n groups[m.componentName] = {\n count: 0,\n totalDuration: 0,\n durations: []\n };\n }\n\n groups[m.componentName].count++;\n groups[m.componentName].totalDuration += m.duration;\n groups[m.componentName].durations.push(m.duration);\n });\n\n // Calculate stats for each component\n Object.keys(groups).forEach(name => {\n const group = groups[name];\n group.average = group.totalDuration / group.count;\n group.min = Math.min(...group.durations);\n group.max = Math.max(...group.durations);\n });\n\n return groups;\n }\n\n /**\n * Get performance summary\n */\n getSummary() {\n const allMeasurements = this.measurements;\n\n if (allMeasurements.length === 0) {\n return {\n totalMeasurements: 0,\n totalSessions: this.sessions.size,\n analysis: null\n };\n }\n\n const durations = allMeasurements.map(m => m.duration);\n\n return {\n totalMeasurements: allMeasurements.length,\n totalSessions: this.sessions.size,\n slowRenders: allMeasurements.filter(m => m.slow).length,\n analysis: {\n average: durations.reduce((a, b) => a + b, 0) / durations.length,\n min: Math.min(...durations),\n max: Math.max(...durations),\n slowPercentage: (allMeasurements.filter(m => m.slow).length / allMeasurements.length) * 100\n },\n byComponent: this.groupByComponent(allMeasurements),\n recentSlow: allMeasurements\n .filter(m => m.slow)\n .slice(-10)\n .map(m => ({\n component: m.componentName,\n duration: m.duration,\n timestamp: m.startTime\n }))\n };\n }\n\n /**\n * Get statistics\n */\n getStatistics() {\n if (this.measurements.length === 0) {\n return { mean: 0, median: 0, min: 0, max: 0, stdDev: 0 };\n }\n\n const durations = this.measurements.map(m => m.duration);\n const sum = durations.reduce((a, b) => a + b, 0);\n const mean = sum / durations.length;\n \n const sorted = [...durations].sort((a, b) => a - b);\n const median = sorted[Math.floor(sorted.length / 2)];\n \n const variance = durations.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / durations.length;\n const stdDev = Math.sqrt(variance);\n\n return {\n mean,\n median,\n min: Math.min(...durations),\n max: Math.max(...durations),\n stdDev\n };\n }\n\n /**\n * Get bottlenecks\n */\n getBottlenecks(threshold = null) {\n const slowThreshold = threshold || this.options.slowThreshold;\n return this.measurements\n .filter(m => m.duration > slowThreshold)\n .sort((a, b) => b.duration - a.duration)\n .map(m => ({\n name: m.name,\n duration: m.duration,\n timestamp: m.startTime\n }));\n }\n\n /**\n * Get metrics\n */\n getMetrics() {\n const operationCounts = {};\n this.measurements.forEach(m => {\n operationCounts[m.name] = (operationCounts[m.name] || 0) + 1;\n });\n\n const totalDuration = this.measurements.reduce((sum, m) => sum + m.duration, 0);\n\n return {\n totalOperations: this.measurements.length,\n totalDuration,\n operationCounts,\n averageDuration: this.measurements.length > 0 ? totalDuration / this.measurements.length : 0,\n memoryUsage: this.options.trackMemory && typeof performance !== 'undefined' && performance.memory\n ? performance.memory.usedJSHeapSize\n : null\n };\n }\n\n /**\n * Generate report\n */\n generateReport() {\n const stats = this.getStatistics();\n const metrics = this.getMetrics();\n const bottlenecks = this.getBottlenecks();\n const recommendations = this.getRecommendations();\n\n return {\n summary: {\n totalOperations: metrics.totalOperations,\n averageDuration: metrics.averageDuration,\n slowOperations: bottlenecks.length\n },\n statistics: stats,\n operations: this.measurements.map(m => ({\n name: m.name,\n duration: m.duration,\n timestamp: m.startTime\n })),\n bottlenecks: bottlenecks.slice(0, 10),\n recommendations,\n timestamp: Date.now()\n };\n }\n\n /**\n * Export profiling data\n */\n export() {\n return {\n sessions: Array.from(this.sessions.values()),\n measurements: this.measurements,\n metrics: this.getMetrics(),\n statistics: this.getStatistics(),\n exportedAt: Date.now()\n };\n }\n\n /**\n * Format metrics for display\n */\n formatMetrics() {\n const metrics = this.getMetrics();\n const stats = this.getStatistics();\n \n let output = `Performance Metrics\\n`;\n output += `==================\\n`;\n output += `Total Operations: ${metrics.totalOperations}\\n`;\n output += `Average Duration: ${metrics.averageDuration.toFixed(2)}ms\\n`;\n output += `Mean: ${stats.mean.toFixed(2)}ms\\n`;\n output += `Median: ${stats.median.toFixed(2)}ms\\n`;\n output += `Min: ${stats.min.toFixed(2)}ms\\n`;\n output += `Max: ${stats.max.toFixed(2)}ms\\n`;\n \n return output;\n }\n\n /**\n * Compare two profiles\n */\n compare(profileId1, profileId2) {\n const session1 = this.sessions.get(profileId1);\n const session2 = this.sessions.get(profileId2);\n\n if (!session1 || !session2) {\n return null;\n }\n\n return {\n difference: session2.duration - session1.duration,\n percentChange: ((session2.duration - session1.duration) / session1.duration) * 100,\n profile1: { name: session1.name, duration: session1.duration },\n profile2: { name: session2.name, duration: session2.duration }\n };\n }\n\n /**\n * Get performance recommendations\n */\n getRecommendations() {\n const recommendations = [];\n const bottlenecks = this.getBottlenecks();\n const stats = this.getStatistics();\n\n if (bottlenecks.length > 0) {\n bottlenecks.slice(0, 5).forEach(bottleneck => {\n recommendations.push({\n type: 'bottleneck',\n operation: bottleneck.name,\n suggestion: `Optimize ${bottleneck.name} - duration: ${bottleneck.duration.toFixed(2)}ms exceeds threshold`,\n severity: 'high',\n message: `Found slow operation exceeding ${this.options.slowThreshold}ms`\n });\n });\n }\n\n if (stats.max > this.options.slowThreshold * 2) {\n recommendations.push({\n type: 'performance',\n operation: 'general',\n suggestion: `Review operations with high duration`,\n message: `Maximum duration (${stats.max.toFixed(2)}ms) is significantly high`,\n severity: 'medium'\n });\n }\n\n return recommendations;\n }\n\n /**\n * Clear all data\n */\n clear() {\n this.measurements = [];\n this.sessions.clear();\n this.currentSession = null;\n this.marks.clear();\n }\n\n /**\n * Enable profiler\n */\n enable() {\n this.options.enabled = true;\n }\n\n /**\n * Disable profiler\n */\n disable() {\n this.options.enabled = false;\n }\n\n /**\n * Generate unique ID\n */\n generateId() {\n return `prof-${Date.now()}-${Math.random().toString(36).substring(7)}`;\n }\n}\n\n/**\n * Create a performance profiler\n */\nexport function createProfiler(options = {}) {\n return new PerformanceProfiler(options);\n}\n\n/**\n * Measure a function execution\n */\nexport async function measure(name, fn, profiler = null) {\n const prof = profiler || new PerformanceProfiler();\n const sessionId = prof.start(name);\n \n try {\n const value = await fn();\n const result = prof.stop(sessionId);\n return { value, duration: result?.duration || 0 };\n } catch (error) {\n const result = prof.stop(sessionId);\n throw { error, duration: result?.duration || 0 };\n }\n}\n\n/**\n * Create a profiling decorator\n */\nexport function profile(fn) {\n return function(...args) {\n const result = fn(...args);\n return result;\n };\n}\n\nexport default {\n PerformanceProfiler,\n createProfiler,\n measure,\n profile\n};\n"],
|
|
5
|
+
"mappings": ";AAYO,IAAM,sBAAN,MAA0B;AAAA,EAC/B,YAAY,UAAU,CAAC,GAAG;AACxB,SAAK,UAAU;AAAA,MACb,SAAS;AAAA,MACT,YAAY;AAAA;AAAA,MACZ,eAAe;AAAA;AAAA,MACf,aAAa,OAAO,gBAAgB,eAAe,YAAY;AAAA,MAC/D,YAAY,QAAQ,cAAc;AAAA,MAClC,GAAG;AAAA,IACL;AAEA,SAAK,eAAe,CAAC;AACrB,SAAK,WAAW,oBAAI,IAAI;AACxB,SAAK,iBAAiB;AACtB,SAAK,QAAQ,oBAAI,IAAI;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OAAO,WAAW;AACtB,QAAI,CAAC,KAAK,QAAQ,SAAS;AACzB,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,QAAQ,aAAa,KAAO,KAAK,OAAO,IAAI,KAAK,QAAQ,YAAY;AAC5E,aAAO;AAAA,IACT;AAEA,UAAM,UAAU;AAAA,MACd,I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CAAC,GAAG;AAC3C,SAAO,IAAI,oBAAoB,OAAO;AACxC;AAKA,eAAsB,QAAQ,MAAM,IAAI,WAAW,MAAM;AACvD,QAAM,OAAO,YAAY,IAAI,oBAAoB;AACjD,QAAM,YAAY,KAAK,MAAM,IAAI;AAEjC,MAAI;AACF,UAAM,QAAQ,MAAM,GAAG;AACvB,UAAM,SAAS,KAAK,KAAK,SAAS;AAClC,WAAO,EAAE,OAAO,UAAU,QAAQ,YAAY,EAAE;AAAA,EAClD,SAAS,OAAO;AACd,UAAM,SAAS,KAAK,KAAK,SAAS;AAClC,UAAM,EAAE,OAAO,UAAU,QAAQ,YAAY,EAAE;AAAA,EACjD;AACF;AAKO,SAAS,QAAQ,IAAI;AAC1B,SAAO,YAAY,MAAM;AACvB,UAAM,SAAS,GAAG,GAAG,IAAI;AACzB,WAAO;AAAA,EACT;AACF;AAEA,IAAO,mBAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@coherent.js/devtools",
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"description": "Developer tools for Coherent.js applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./inspector": "./dist/inspector.js",
|
|
11
|
+
"./profiler": "./dist/profiler.js",
|
|
12
|
+
"./logger": "./dist/logger.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/",
|
|
16
|
+
"types/",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"coherent",
|
|
22
|
+
"devtools",
|
|
23
|
+
"debugging",
|
|
24
|
+
"profiling",
|
|
25
|
+
"inspector"
|
|
26
|
+
],
|
|
27
|
+
"author": "Coherent.js Team",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@coherent.js/core": "1.0.0-beta.2"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/Tomdrouv1/coherent.js.git"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "node build.mjs",
|
|
41
|
+
"clean": "rm -rf dist"
|
|
42
|
+
}
|
|
43
|
+
}
|