@xctrace-analyzer/core 0.1.0
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 +482 -0
- package/dist/analyzer/comparative-analyzer.d.ts +38 -0
- package/dist/analyzer/comparative-analyzer.d.ts.map +1 -0
- package/dist/analyzer/comparative-analyzer.js +255 -0
- package/dist/analyzer/comparative-analyzer.js.map +1 -0
- package/dist/analyzer/performance-analyzer.d.ts +49 -0
- package/dist/analyzer/performance-analyzer.d.ts.map +1 -0
- package/dist/analyzer/performance-analyzer.js +413 -0
- package/dist/analyzer/performance-analyzer.js.map +1 -0
- package/dist/analyzer/recommendation-engine.d.ts +39 -0
- package/dist/analyzer/recommendation-engine.d.ts.map +1 -0
- package/dist/analyzer/recommendation-engine.js +306 -0
- package/dist/analyzer/recommendation-engine.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/trace-parser.d.ts +154 -0
- package/dist/parser/trace-parser.d.ts.map +1 -0
- package/dist/parser/trace-parser.js +1738 -0
- package/dist/parser/trace-parser.js.map +1 -0
- package/dist/types.d.ts +371 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +33 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/xctrace-runner.d.ts +81 -0
- package/dist/utils/xctrace-runner.d.ts.map +1 -0
- package/dist/utils/xctrace-runner.js +420 -0
- package/dist/utils/xctrace-runner.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PerformanceAnalyzer - Analyzes performance data from traces
|
|
3
|
+
*/
|
|
4
|
+
import { AnalysisError, } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Default analysis options
|
|
7
|
+
*/
|
|
8
|
+
const DEFAULT_OPTIONS = {
|
|
9
|
+
slowThreshold: 100, // 100ms
|
|
10
|
+
topN: 10,
|
|
11
|
+
includeRecommendations: true,
|
|
12
|
+
minCallCount: 1,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Analyzes performance data from parsed traces
|
|
16
|
+
*/
|
|
17
|
+
export class PerformanceAnalyzer {
|
|
18
|
+
/**
|
|
19
|
+
* Analyze a parsed trace
|
|
20
|
+
*/
|
|
21
|
+
analyze(trace, options = {}) {
|
|
22
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
23
|
+
try {
|
|
24
|
+
// Calculate performance statistics
|
|
25
|
+
const stats = this.calculateStats(trace, opts);
|
|
26
|
+
// Identify bottlenecks
|
|
27
|
+
const bottlenecks = this.identifyBottlenecks(trace, opts);
|
|
28
|
+
// Get top functions by time
|
|
29
|
+
const topFunctions = this.getTopFunctions(trace, opts.topN);
|
|
30
|
+
const userFrameProfiles = this.computeUserFrameProfiles(trace, opts);
|
|
31
|
+
// Generate summary
|
|
32
|
+
const summary = this.generateSummary(trace, stats, bottlenecks);
|
|
33
|
+
return {
|
|
34
|
+
metadata: trace.metadata,
|
|
35
|
+
stats,
|
|
36
|
+
bottlenecks,
|
|
37
|
+
recommendations: [], // Will be filled by RecommendationEngine
|
|
38
|
+
topFunctions,
|
|
39
|
+
userFrameProfiles,
|
|
40
|
+
instrumentAnalyses: trace.instrumentAnalyses ?? [],
|
|
41
|
+
hangs: trace.hangs,
|
|
42
|
+
supportStatus: trace.supportStatus,
|
|
43
|
+
exportAttempts: trace.exportAttempts,
|
|
44
|
+
summary,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw new AnalysisError('Failed to analyze trace', error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Calculate performance statistics
|
|
53
|
+
*/
|
|
54
|
+
calculateStats(trace, options) {
|
|
55
|
+
const timeProfile = trace.timeProfile;
|
|
56
|
+
if (!timeProfile || !timeProfile.functionProfiles.length) {
|
|
57
|
+
const timeProfileFailure = trace.exportAttempts?.find((attempt) => attempt.kind === 'time-profile' && attempt.status === 'failed');
|
|
58
|
+
const stats = {
|
|
59
|
+
totalTime: timeProfile?.totalDuration ?? this.analysisWindowDuration(options) ?? trace.metadata.duration,
|
|
60
|
+
slowFunctions: 0,
|
|
61
|
+
avgFunctionTime: 0,
|
|
62
|
+
maxFunctionTime: 0,
|
|
63
|
+
threadCount: 0,
|
|
64
|
+
};
|
|
65
|
+
if (timeProfileFailure) {
|
|
66
|
+
stats.timeProfileError = timeProfileFailure.message ?? 'Time Profiler export or parsing failed.';
|
|
67
|
+
}
|
|
68
|
+
if (options.timeRangeMs) {
|
|
69
|
+
stats.timeRangeMs = options.timeRangeMs;
|
|
70
|
+
}
|
|
71
|
+
return stats;
|
|
72
|
+
}
|
|
73
|
+
const functionTimes = timeProfile.functionProfiles
|
|
74
|
+
.filter(f => f.callCount >= options.minCallCount)
|
|
75
|
+
.map(f => f.selfTime);
|
|
76
|
+
const slowFunctions = functionTimes.filter(t => t > options.slowThreshold).length;
|
|
77
|
+
// Get unique thread count
|
|
78
|
+
const threads = new Set(timeProfile.samples.map(s => s.threadId));
|
|
79
|
+
// Find hot path (most expensive call path)
|
|
80
|
+
const hotPath = this.findHotPath(timeProfile);
|
|
81
|
+
const stats = {
|
|
82
|
+
totalTime: timeProfile.totalDuration,
|
|
83
|
+
slowFunctions,
|
|
84
|
+
avgFunctionTime: functionTimes.length > 0
|
|
85
|
+
? functionTimes.reduce((a, b) => a + b, 0) / functionTimes.length
|
|
86
|
+
: 0,
|
|
87
|
+
maxFunctionTime: functionTimes.length > 0
|
|
88
|
+
? Math.max(...functionTimes)
|
|
89
|
+
: 0,
|
|
90
|
+
threadCount: threads.size,
|
|
91
|
+
hotPath,
|
|
92
|
+
};
|
|
93
|
+
if (options.timeRangeMs) {
|
|
94
|
+
stats.timeRangeMs = options.timeRangeMs;
|
|
95
|
+
}
|
|
96
|
+
return stats;
|
|
97
|
+
}
|
|
98
|
+
analysisWindowDuration(options) {
|
|
99
|
+
const range = options.timeRangeMs;
|
|
100
|
+
if (!range) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return Math.max(0, range.endMs - range.startMs);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Identify performance bottlenecks
|
|
107
|
+
*/
|
|
108
|
+
identifyBottlenecks(trace, options) {
|
|
109
|
+
const timeProfile = trace.timeProfile;
|
|
110
|
+
if (!timeProfile || !timeProfile.functionProfiles.length) {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
const totalTime = timeProfile.totalDuration || 1;
|
|
114
|
+
const bottlenecks = [];
|
|
115
|
+
// Filter and analyze functions
|
|
116
|
+
const significantFunctions = timeProfile.functionProfiles
|
|
117
|
+
.filter(f => f.selfTime > options.slowThreshold && f.callCount >= options.minCallCount)
|
|
118
|
+
.slice(0, 20); // Top 20 candidates
|
|
119
|
+
for (const func of significantFunctions) {
|
|
120
|
+
const percentage = (func.selfTime / totalTime) * 100;
|
|
121
|
+
// Determine impact level
|
|
122
|
+
let impact;
|
|
123
|
+
if (percentage > 30 || func.selfTime > 1000) {
|
|
124
|
+
impact = 'critical';
|
|
125
|
+
}
|
|
126
|
+
else if (percentage > 15 || func.selfTime > 500) {
|
|
127
|
+
impact = 'high';
|
|
128
|
+
}
|
|
129
|
+
else if (percentage > 5 || func.selfTime > 200) {
|
|
130
|
+
impact = 'medium';
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
impact = 'low';
|
|
134
|
+
}
|
|
135
|
+
// Generate suggestion based on function name patterns
|
|
136
|
+
const suggestion = this.generateQuickSuggestion(func);
|
|
137
|
+
bottlenecks.push({
|
|
138
|
+
function: func.name,
|
|
139
|
+
module: func.module,
|
|
140
|
+
impact,
|
|
141
|
+
duration: func.selfTime,
|
|
142
|
+
percentage,
|
|
143
|
+
suggestion,
|
|
144
|
+
callCount: func.callCount,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Sort by severity and duration
|
|
148
|
+
return bottlenecks.sort((a, b) => {
|
|
149
|
+
const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
150
|
+
if (severityOrder[a.impact] !== severityOrder[b.impact]) {
|
|
151
|
+
return severityOrder[a.impact] - severityOrder[b.impact];
|
|
152
|
+
}
|
|
153
|
+
return b.duration - a.duration;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get top N functions by time
|
|
158
|
+
*/
|
|
159
|
+
getTopFunctions(trace, n) {
|
|
160
|
+
const timeProfile = trace.timeProfile;
|
|
161
|
+
if (!timeProfile || !timeProfile.functionProfiles.length) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
const totalTime = timeProfile.totalDuration || 1;
|
|
165
|
+
// Calculate percentages and return top N
|
|
166
|
+
return timeProfile.functionProfiles
|
|
167
|
+
.slice(0, n)
|
|
168
|
+
.map(f => ({
|
|
169
|
+
...f,
|
|
170
|
+
percentage: (f.totalTime / totalTime) * 100,
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
computeUserFrameProfiles(trace, options) {
|
|
174
|
+
const timeProfile = trace.timeProfile;
|
|
175
|
+
if (!timeProfile || !timeProfile.samples.length) {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
const userBinaryNames = this.userBinaryNames(trace, options);
|
|
179
|
+
if (userBinaryNames.length === 0) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
const totalTime = timeProfile.totalDuration || 1;
|
|
183
|
+
const profiles = new Map();
|
|
184
|
+
for (const sample of timeProfile.samples) {
|
|
185
|
+
const frame = this.deepestUserFrame(sample.backtrace, userBinaryNames);
|
|
186
|
+
if (!frame) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const key = `${frame.module ?? 'unknown'}::${frame.name}`;
|
|
190
|
+
let profile = profiles.get(key);
|
|
191
|
+
if (!profile) {
|
|
192
|
+
profile = {
|
|
193
|
+
name: frame.name,
|
|
194
|
+
module: frame.module,
|
|
195
|
+
selfTime: 0,
|
|
196
|
+
sampleCount: 0,
|
|
197
|
+
percentage: 0,
|
|
198
|
+
};
|
|
199
|
+
profiles.set(key, profile);
|
|
200
|
+
}
|
|
201
|
+
profile.selfTime += sample.weight;
|
|
202
|
+
profile.sampleCount += 1;
|
|
203
|
+
}
|
|
204
|
+
return Array.from(profiles.values())
|
|
205
|
+
.map((profile) => ({
|
|
206
|
+
...profile,
|
|
207
|
+
percentage: (profile.selfTime / totalTime) * 100,
|
|
208
|
+
}))
|
|
209
|
+
.sort((a, b) => b.selfTime - a.selfTime)
|
|
210
|
+
.slice(0, options.topN);
|
|
211
|
+
}
|
|
212
|
+
userBinaryNames(trace, options) {
|
|
213
|
+
const names = [
|
|
214
|
+
trace.metadata.processName ?? '',
|
|
215
|
+
...(trace.metadata.userProcessNames ?? []),
|
|
216
|
+
...(options.userBinaryHints ?? []),
|
|
217
|
+
];
|
|
218
|
+
const variants = names.flatMap((name) => this.userBinaryNameVariants(name));
|
|
219
|
+
return Array.from(new Set(variants));
|
|
220
|
+
}
|
|
221
|
+
userBinaryNameVariants(name) {
|
|
222
|
+
const trimmed = name.trim();
|
|
223
|
+
if (!trimmed) {
|
|
224
|
+
return [];
|
|
225
|
+
}
|
|
226
|
+
const withoutParenthetical = trimmed.replace(/\s*\([^)]*\)\s*$/g, '').trim();
|
|
227
|
+
const withoutExtension = withoutParenthetical.replace(/\.(app|xpc|appex|framework)$/i, '');
|
|
228
|
+
return [trimmed, withoutParenthetical, withoutExtension]
|
|
229
|
+
.map((variant) => variant.trim().toLowerCase())
|
|
230
|
+
.filter((variant) => variant.length > 0);
|
|
231
|
+
}
|
|
232
|
+
deepestUserFrame(backtrace, userBinaryNames) {
|
|
233
|
+
for (let i = backtrace.length - 1; i >= 0; i--) {
|
|
234
|
+
const frame = this.parseFrameName(backtrace[i]);
|
|
235
|
+
if (frame.module) {
|
|
236
|
+
const module = frame.module.toLowerCase();
|
|
237
|
+
if (userBinaryNames.some((name) => module.includes(name))) {
|
|
238
|
+
return frame;
|
|
239
|
+
}
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (this.isLikelyUserSwiftFrame(frame.name)) {
|
|
243
|
+
return frame;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
parseFrameName(fullName) {
|
|
249
|
+
const backtickIndex = fullName.indexOf('`');
|
|
250
|
+
if (backtickIndex > 0) {
|
|
251
|
+
return {
|
|
252
|
+
module: fullName.substring(0, backtickIndex),
|
|
253
|
+
name: fullName.substring(backtickIndex + 1),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
return { name: fullName };
|
|
257
|
+
}
|
|
258
|
+
isLikelyUserSwiftFrame(name) {
|
|
259
|
+
const trimmed = name.trim();
|
|
260
|
+
if (!trimmed) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
const lower = trimmed.toLowerCase();
|
|
264
|
+
const systemPatterns = [
|
|
265
|
+
/^_/,
|
|
266
|
+
/^cf_/,
|
|
267
|
+
/^objc_/,
|
|
268
|
+
/^swift::/,
|
|
269
|
+
/^swift_/,
|
|
270
|
+
/^newjson/,
|
|
271
|
+
/^partial apply/,
|
|
272
|
+
/^thunk for/,
|
|
273
|
+
/^completeTaskWithClosure/i,
|
|
274
|
+
/^protocol witness/,
|
|
275
|
+
/^merged/,
|
|
276
|
+
/dispatch/,
|
|
277
|
+
/foundation/,
|
|
278
|
+
/swiftui/,
|
|
279
|
+
/appkit/,
|
|
280
|
+
/uikit/,
|
|
281
|
+
/corefoundation/,
|
|
282
|
+
/nsjson/,
|
|
283
|
+
/jsonvalue/,
|
|
284
|
+
/jsonobject/,
|
|
285
|
+
/jsonstring/,
|
|
286
|
+
/stringguts/,
|
|
287
|
+
/substring\._/,
|
|
288
|
+
];
|
|
289
|
+
if (systemPatterns.some((pattern) => pattern.test(lower))) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
// xctrace sometimes exports Swift application frames without a binary
|
|
293
|
+
// prefix, for example "closure #1 in MyService.load()". Keep these
|
|
294
|
+
// visible so hang-window attribution does not disappear behind system
|
|
295
|
+
// JSON/CF/Swift runtime frames.
|
|
296
|
+
return /[A-Z][A-Za-z0-9_]*(Service|ViewModel|View|Controller|Manager|Store|Provider|Client|Repository|Coordinator|Monitor|Session|Model)\b/.test(trimmed);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Find the hottest execution path (most expensive)
|
|
300
|
+
*/
|
|
301
|
+
findHotPath(timeProfile) {
|
|
302
|
+
// Find the sample with the highest weight
|
|
303
|
+
const hottestSample = timeProfile.samples.reduce((max, sample) => (sample.weight > (max?.weight || 0) ? sample : max), null);
|
|
304
|
+
return hottestSample?.backtrace || [];
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Generate quick suggestion based on function name
|
|
308
|
+
*/
|
|
309
|
+
generateQuickSuggestion(func) {
|
|
310
|
+
const name = func.name.toLowerCase();
|
|
311
|
+
// Pattern-based suggestions
|
|
312
|
+
if (name.includes('image') || name.includes('bitmap') || name.includes('render')) {
|
|
313
|
+
return 'Consider caching rendered images or using lower resolution';
|
|
314
|
+
}
|
|
315
|
+
if (name.includes('json') || name.includes('parse') || name.includes('decode')) {
|
|
316
|
+
return 'Consider streaming parsing or lazy decoding';
|
|
317
|
+
}
|
|
318
|
+
if (name.includes('database') || name.includes('sql') || name.includes('query')) {
|
|
319
|
+
return 'Consider adding database indexes or query optimization';
|
|
320
|
+
}
|
|
321
|
+
if (name.includes('network') || name.includes('http') || name.includes('request')) {
|
|
322
|
+
return 'Consider request batching or caching responses';
|
|
323
|
+
}
|
|
324
|
+
if (name.includes('sort') || name.includes('filter') || name.includes('search')) {
|
|
325
|
+
return 'Consider using more efficient algorithms or pre-computed indexes';
|
|
326
|
+
}
|
|
327
|
+
if (name.includes('crypto') || name.includes('hash') || name.includes('encrypt')) {
|
|
328
|
+
return 'Consider moving cryptographic operations to background thread';
|
|
329
|
+
}
|
|
330
|
+
if (name.includes('layout') || name.includes('constraint')) {
|
|
331
|
+
return 'Consider simplifying view hierarchy or using manual layout';
|
|
332
|
+
}
|
|
333
|
+
if (func.callCount > 1000) {
|
|
334
|
+
return `Function called ${func.callCount} times - consider reducing call frequency`;
|
|
335
|
+
}
|
|
336
|
+
return 'Consider optimizing this function or moving to background thread';
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Generate human-readable summary
|
|
340
|
+
*/
|
|
341
|
+
generateSummary(trace, stats, bottlenecks) {
|
|
342
|
+
const parts = [];
|
|
343
|
+
const instrumentCount = trace.instrumentAnalyses?.length ?? 0;
|
|
344
|
+
const tocFailure = trace.exportAttempts?.find((attempt) => attempt.kind === 'toc' && attempt.status === 'failed');
|
|
345
|
+
if (tocFailure) {
|
|
346
|
+
parts.push(tocFailure.message
|
|
347
|
+
? `Trace analysis is incomplete because xctrace could not export the trace TOC: ${tocFailure.message}`
|
|
348
|
+
: 'Trace analysis is incomplete because xctrace could not export the trace TOC.');
|
|
349
|
+
parts.push('The trace may be malformed or partial; see Export Diagnostics for details.');
|
|
350
|
+
return parts.join(' ');
|
|
351
|
+
}
|
|
352
|
+
// Hangs callout — most important user-visible signal, surface it first.
|
|
353
|
+
const hangs = trace.hangs;
|
|
354
|
+
const hasHangEvents = !!hangs && hangs.events.length > 0;
|
|
355
|
+
if (hasHangEvents) {
|
|
356
|
+
const severe = hangs.severeCount;
|
|
357
|
+
const longestS = (hangs.longestMs / 1000).toFixed(2);
|
|
358
|
+
if (severe > 0) {
|
|
359
|
+
parts.push(`⚠️ ${severe} severe hang${severe > 1 ? 's' : ''} on the main thread (longest ${longestS}s).`);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
parts.push(`⚠️ ${hangs.events.length} hang${hangs.events.length > 1 ? 's' : ''} on the main thread (longest ${longestS}s).`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (stats.timeProfileError) {
|
|
366
|
+
parts.push(`Time Profiler analysis failed: ${stats.timeProfileError}. The trace itself was recorded; see Export Diagnostics for details.`);
|
|
367
|
+
}
|
|
368
|
+
// Overall assessment
|
|
369
|
+
if (bottlenecks.length === 0 && !stats.timeProfileError) {
|
|
370
|
+
if (hasHangEvents) {
|
|
371
|
+
parts.push('No Time Profiler CPU functions crossed the bottleneck threshold.');
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
parts.push('✅ No Time Profiler CPU bottlenecks detected.');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
const critical = bottlenecks.filter(b => b.impact === 'critical').length;
|
|
379
|
+
const high = bottlenecks.filter(b => b.impact === 'high').length;
|
|
380
|
+
if (critical > 0) {
|
|
381
|
+
parts.push(`⚠️ Found ${critical} critical CPU bottleneck${critical > 1 ? 's' : ''}.`);
|
|
382
|
+
}
|
|
383
|
+
if (high > 0) {
|
|
384
|
+
parts.push(`Found ${high} high-impact CPU bottleneck${high > 1 ? 's' : ''}.`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// Time summary
|
|
388
|
+
if (!stats.timeProfileError) {
|
|
389
|
+
const totalSeconds = (stats.totalTime / 1000).toFixed(1);
|
|
390
|
+
parts.push(`Total execution time: ${totalSeconds}s across ${stats.threadCount} thread${stats.threadCount > 1 ? 's' : ''}.`);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
parts.push('Time Profiler totals are unavailable because parsing failed.');
|
|
394
|
+
}
|
|
395
|
+
// Top bottleneck
|
|
396
|
+
if (bottlenecks.length > 0) {
|
|
397
|
+
const top = bottlenecks[0];
|
|
398
|
+
parts.push(`Primary bottleneck: ${top.function} (${top.duration.toFixed(0)}ms, ${top.percentage.toFixed(1)}% of time).`);
|
|
399
|
+
}
|
|
400
|
+
if (instrumentCount > 0) {
|
|
401
|
+
parts.push(`Found ${instrumentCount} additional instrument analyses.`);
|
|
402
|
+
}
|
|
403
|
+
return parts.join(' ');
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Convenience function to analyze a trace
|
|
408
|
+
*/
|
|
409
|
+
export function analyzeTrace(trace, options) {
|
|
410
|
+
const analyzer = new PerformanceAnalyzer();
|
|
411
|
+
return analyzer.analyze(trace, options);
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=performance-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-analyzer.js","sourceRoot":"","sources":["../../src/analyzer/performance-analyzer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAQL,aAAa,GACd,MAAM,aAAa,CAAC;AAKrB;;GAEG;AACH,MAAM,eAAe,GAA4B;IAC/C,aAAa,EAAE,GAAG,EAAE,QAAQ;IAC5B,IAAI,EAAE,EAAE;IACR,sBAAsB,EAAE,IAAI;IAC5B,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACH,OAAO,CAAC,KAAkB,EAAE,UAA2B,EAAE;QACvD,MAAM,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC;QAEhD,IAAI,CAAC;YACH,mCAAmC;YACnC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAE/C,uBAAuB;YACvB,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAE1D,4BAA4B;YAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5D,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAErE,mBAAmB;YACn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CAAC;QAC9H,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC7E,CAAC;QAED,iBAAiB;QACjB,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,uBAAuB,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAC3H,CAAC;QAED,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,SAAS,eAAe,kCAAkC,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB,EAAE,OAAyB;IACxE,MAAM,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAC3C,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RecommendationEngine - Generates actionable optimization recommendations
|
|
3
|
+
*/
|
|
4
|
+
import { Analysis, Recommendation } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Generates optimization recommendations from analysis
|
|
7
|
+
*/
|
|
8
|
+
export declare class RecommendationEngine {
|
|
9
|
+
/**
|
|
10
|
+
* Generate recommendations for an analysis
|
|
11
|
+
*/
|
|
12
|
+
generateRecommendations(analysis: Analysis): Recommendation[];
|
|
13
|
+
/**
|
|
14
|
+
* Generate recommendation for a specific bottleneck
|
|
15
|
+
*/
|
|
16
|
+
private generateRecommendationForBottleneck;
|
|
17
|
+
/**
|
|
18
|
+
* Generate general recommendations based on overall stats
|
|
19
|
+
*/
|
|
20
|
+
private generateGeneralRecommendations;
|
|
21
|
+
/**
|
|
22
|
+
* Generate recommendations from non-Time-Profiler instrument findings.
|
|
23
|
+
*/
|
|
24
|
+
private generateInstrumentRecommendations;
|
|
25
|
+
private priorityFromFinding;
|
|
26
|
+
/**
|
|
27
|
+
* Adjust priority based on bottleneck impact
|
|
28
|
+
*/
|
|
29
|
+
private adjustPriority;
|
|
30
|
+
/**
|
|
31
|
+
* Remove duplicate recommendations and prioritize
|
|
32
|
+
*/
|
|
33
|
+
private deduplicateAndPrioritize;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Convenience function to generate recommendations
|
|
37
|
+
*/
|
|
38
|
+
export declare function generateRecommendations(analysis: Analysis): Recommendation[];
|
|
39
|
+
//# sourceMappingURL=recommendation-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommendation-engine.d.ts","sourceRoot":"","sources":["../../src/analyzer/recommendation-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AA2HnE;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,EAAE;IAmB7D;;OAEG;IACH,OAAO,CAAC,mCAAmC;IAiC3C;;OAEG;IACH,OAAO,CAAC,8BAA8B;IA8BtC;;OAEG;IACH,OAAO,CAAC,iCAAiC;IA+DzC,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAwBjC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,EAAE,CAG5E"}
|