traceperf 0.1.1 → 0.1.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/README.md +79 -1
- package/dist/browser.d.ts +58 -2
- package/dist/browser.js +179 -28
- package/dist/browser.js.map +1 -1
- package/dist/esm/browser.d.ts +58 -2
- package/dist/esm/browser.js +179 -28
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/trackers/execution.d.ts +23 -7
- package/dist/esm/trackers/execution.js +100 -29
- package/dist/esm/trackers/execution.js.map +1 -1
- package/dist/esm/types/index.d.ts +32 -0
- package/dist/trackers/execution.d.ts +23 -7
- package/dist/trackers/execution.js +100 -29
- package/dist/trackers/execution.js.map +1 -1
- package/dist/types/index.d.ts +32 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Advanced console logging & performance tracking for Node.js applications.
|
|
|
9
9
|
|
|
10
10
|
- **Structured and Visually Appealing Logs**: A better alternative to `console.log()` with colors, icons, and formatting.
|
|
11
11
|
- **Execution Flow Tracing**: Track function calls and visualize the execution flow with ASCII art.
|
|
12
|
+
- **Nested Function Tracking**: Multiple approaches to track nested function calls with detailed visualization.
|
|
12
13
|
- **Performance Bottleneck Detection**: Identify slow functions and get suggestions for optimization.
|
|
13
14
|
- **Conditional Logging Modes**: Different logging levels for development, staging, and production.
|
|
14
15
|
- **Nested Logging**: Group related logs with indentation for better readability.
|
|
@@ -230,4 +231,81 @@ logger.info('Custom logger');
|
|
|
230
231
|
|
|
231
232
|
## License
|
|
232
233
|
|
|
233
|
-
MIT
|
|
234
|
+
MIT
|
|
235
|
+
|
|
236
|
+
## Advanced Usage
|
|
237
|
+
|
|
238
|
+
### Tracking Nested Function Calls
|
|
239
|
+
|
|
240
|
+
TracePerf provides several approaches to track nested function calls:
|
|
241
|
+
|
|
242
|
+
#### Approach 1: Manual Tracking (Recommended)
|
|
243
|
+
|
|
244
|
+
The most reliable way to track nested function calls is to manually track each function:
|
|
245
|
+
|
|
246
|
+
```javascript
|
|
247
|
+
function fetchData() {
|
|
248
|
+
// Simulate API call
|
|
249
|
+
const data = { items: [1, 2, 3, 4, 5] };
|
|
250
|
+
|
|
251
|
+
// Process the data with manual tracking
|
|
252
|
+
const processedData = tracePerf.track(() => {
|
|
253
|
+
// Data processing logic
|
|
254
|
+
return data.items.map(item => item * 2);
|
|
255
|
+
}, { label: "processData" });
|
|
256
|
+
|
|
257
|
+
// Calculate results with manual tracking
|
|
258
|
+
const results = tracePerf.track(() => {
|
|
259
|
+
// Calculation logic
|
|
260
|
+
return processedData.reduce((sum, item) => sum + item, 0);
|
|
261
|
+
}, { label: "calculateResults" });
|
|
262
|
+
|
|
263
|
+
return results;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Track the main function
|
|
267
|
+
tracePerf.track(fetchData, { label: "fetchData" });
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This approach gives you the most control and provides accurate timing for each function.
|
|
271
|
+
|
|
272
|
+
#### Approach 2: Wrapper Functions
|
|
273
|
+
|
|
274
|
+
You can create tracked versions of your functions:
|
|
275
|
+
|
|
276
|
+
```javascript
|
|
277
|
+
// Original functions
|
|
278
|
+
function processData(data) {
|
|
279
|
+
return data.items.map(item => item * 2);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function calculateResults(processedData) {
|
|
283
|
+
return processedData.reduce((sum, item) => sum + item, 0);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Create tracked versions
|
|
287
|
+
const trackedProcessData = (data) => {
|
|
288
|
+
return tracePerf.track(() => processData(data), { label: "processData" });
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const trackedCalculateResults = (data) => {
|
|
292
|
+
return tracePerf.track(() => calculateResults(data), { label: "calculateResults" });
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Use tracked versions in your main function
|
|
296
|
+
function fetchData() {
|
|
297
|
+
const data = { items: [1, 2, 3, 4, 5] };
|
|
298
|
+
const processedData = trackedProcessData(data);
|
|
299
|
+
const results = trackedCalculateResults(processedData);
|
|
300
|
+
return results;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Track the main function
|
|
304
|
+
tracePerf.track(fetchData, { label: "fetchData" });
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
This approach allows you to keep your original functions clean while still tracking their performance.
|
|
308
|
+
|
|
309
|
+
### Customizing Performance Thresholds
|
|
310
|
+
|
|
311
|
+
// ... existing code ...
|
package/dist/browser.d.ts
CHANGED
|
@@ -26,19 +26,75 @@ declare class BrowserPerformanceMonitor {
|
|
|
26
26
|
generateSuggestion(functionName: string, duration: number, memoryUsage?: number): string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Browser-compatible execution tracker
|
|
29
|
+
* Browser-compatible execution tracker for tracking function calls and generating flow charts
|
|
30
30
|
*/
|
|
31
31
|
declare class BrowserExecutionTracker {
|
|
32
32
|
private _callStack;
|
|
33
33
|
private _executions;
|
|
34
34
|
private _currentExecution;
|
|
35
35
|
private _defaultThreshold;
|
|
36
|
+
private _instrumentedFunctions;
|
|
37
|
+
private _isInstrumented;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new BrowserExecutionTracker instance
|
|
40
|
+
*
|
|
41
|
+
* @param options - Tracker options
|
|
42
|
+
*/
|
|
36
43
|
constructor(options?: {
|
|
37
44
|
defaultThreshold?: number;
|
|
38
45
|
});
|
|
39
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Generate a performance optimization suggestion based on execution duration
|
|
48
|
+
*
|
|
49
|
+
* @param name - Function name
|
|
50
|
+
* @param duration - Execution duration in ms
|
|
51
|
+
* @returns Optimization suggestion
|
|
52
|
+
*/
|
|
53
|
+
private generateSuggestion;
|
|
54
|
+
/**
|
|
55
|
+
* Track the execution of a function
|
|
56
|
+
*
|
|
57
|
+
* @param fn - The function to track
|
|
58
|
+
* @param options - Options for tracking
|
|
59
|
+
* @returns The return value of the tracked function
|
|
60
|
+
*/
|
|
61
|
+
track<T>(fn: () => T, options?: any): T;
|
|
62
|
+
/**
|
|
63
|
+
* Instrument a function to track nested function calls
|
|
64
|
+
*
|
|
65
|
+
* @param fn - The function to instrument
|
|
66
|
+
* @returns The instrumented function
|
|
67
|
+
*/
|
|
68
|
+
private instrumentFunction;
|
|
69
|
+
/**
|
|
70
|
+
* Get the current call stack
|
|
71
|
+
*
|
|
72
|
+
* @returns The current call stack
|
|
73
|
+
*/
|
|
40
74
|
getCallStack(): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Generate a visual representation of the execution flow
|
|
77
|
+
*
|
|
78
|
+
* @returns ASCII flow chart of the execution
|
|
79
|
+
*/
|
|
41
80
|
generateFlowChart(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Prepare execution data for the flow chart
|
|
83
|
+
*
|
|
84
|
+
* @param executions - The execution records to prepare
|
|
85
|
+
* @returns A list of execution data
|
|
86
|
+
*/
|
|
87
|
+
private prepareExecutionData;
|
|
88
|
+
/**
|
|
89
|
+
* Add children to the result list
|
|
90
|
+
*
|
|
91
|
+
* @param children - The children to add
|
|
92
|
+
* @param result - The result list
|
|
93
|
+
*/
|
|
94
|
+
private addChildrenToResult;
|
|
95
|
+
/**
|
|
96
|
+
* Clear all execution records
|
|
97
|
+
*/
|
|
42
98
|
clear(): void;
|
|
43
99
|
}
|
|
44
100
|
/**
|
package/dist/browser.js
CHANGED
|
@@ -66,22 +66,54 @@ class BrowserPerformanceMonitor {
|
|
|
66
66
|
}
|
|
67
67
|
exports.BrowserPerformanceMonitor = BrowserPerformanceMonitor;
|
|
68
68
|
/**
|
|
69
|
-
* Browser-compatible execution tracker
|
|
69
|
+
* Browser-compatible execution tracker for tracking function calls and generating flow charts
|
|
70
70
|
*/
|
|
71
71
|
class BrowserExecutionTracker {
|
|
72
|
+
/**
|
|
73
|
+
* Create a new BrowserExecutionTracker instance
|
|
74
|
+
*
|
|
75
|
+
* @param options - Tracker options
|
|
76
|
+
*/
|
|
72
77
|
constructor(options = {}) {
|
|
73
78
|
var _a;
|
|
74
79
|
this._callStack = [];
|
|
75
80
|
this._executions = [];
|
|
76
81
|
this._currentExecution = null;
|
|
82
|
+
this._instrumentedFunctions = new Map();
|
|
83
|
+
this._isInstrumented = false;
|
|
77
84
|
this._defaultThreshold = (_a = options.defaultThreshold) !== null && _a !== void 0 ? _a : 100; // ms
|
|
78
85
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Generate a performance optimization suggestion based on execution duration
|
|
88
|
+
*
|
|
89
|
+
* @param name - Function name
|
|
90
|
+
* @param duration - Execution duration in ms
|
|
91
|
+
* @returns Optimization suggestion
|
|
92
|
+
*/
|
|
93
|
+
generateSuggestion(name, duration) {
|
|
94
|
+
if (duration > 500) {
|
|
95
|
+
return `Function "${name}" took ${duration.toFixed(2)}ms to execute. Consider optimizing or breaking it down into smaller functions.`;
|
|
96
|
+
}
|
|
97
|
+
else if (duration > 200) {
|
|
98
|
+
return `Function "${name}" took ${duration.toFixed(2)}ms to execute. Consider optimizing if called frequently.`;
|
|
99
|
+
}
|
|
100
|
+
else if (duration > 100) {
|
|
101
|
+
return `Function "${name}" took ${duration.toFixed(2)}ms to execute. Monitor if called in critical paths.`;
|
|
102
|
+
}
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Track the execution of a function
|
|
107
|
+
*
|
|
108
|
+
* @param fn - The function to track
|
|
109
|
+
* @param options - Options for tracking
|
|
110
|
+
* @returns The return value of the tracked function
|
|
111
|
+
*/
|
|
112
|
+
track(fn, options = {}) {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
const fnName = options.label || fn.name || 'anonymous';
|
|
115
|
+
const threshold = (_a = options.threshold) !== null && _a !== void 0 ? _a : this._defaultThreshold;
|
|
116
|
+
const enableNestedTracking = (_b = options.enableNestedTracking) !== null && _b !== void 0 ? _b : true;
|
|
85
117
|
// Add to call stack
|
|
86
118
|
this._callStack.push(fnName);
|
|
87
119
|
// Create execution record
|
|
@@ -90,7 +122,7 @@ class BrowserExecutionTracker {
|
|
|
90
122
|
duration: 0,
|
|
91
123
|
isSlow: false,
|
|
92
124
|
level: this._callStack.length - 1,
|
|
93
|
-
startTime,
|
|
125
|
+
startTime: performance.now(),
|
|
94
126
|
children: [],
|
|
95
127
|
};
|
|
96
128
|
// Set parent-child relationship
|
|
@@ -99,53 +131,172 @@ class BrowserExecutionTracker {
|
|
|
99
131
|
this._currentExecution.children.push(execution);
|
|
100
132
|
}
|
|
101
133
|
else {
|
|
134
|
+
// This is a root execution
|
|
102
135
|
this._executions.push(execution);
|
|
103
136
|
}
|
|
104
137
|
// Save the previous current execution
|
|
105
138
|
const previousExecution = this._currentExecution;
|
|
106
139
|
// Set this as the current execution
|
|
107
140
|
this._currentExecution = execution;
|
|
141
|
+
// Flag to track if we're already instrumenting to avoid recursion
|
|
142
|
+
const wasInstrumented = this._isInstrumented;
|
|
143
|
+
let result;
|
|
108
144
|
try {
|
|
109
|
-
//
|
|
110
|
-
|
|
145
|
+
// If this is the top-level call and nested tracking is enabled, instrument the function
|
|
146
|
+
if (enableNestedTracking && !wasInstrumented) {
|
|
147
|
+
this._isInstrumented = true;
|
|
148
|
+
// Instrument the function to track nested calls
|
|
149
|
+
const instrumentedFn = this.instrumentFunction(fn);
|
|
150
|
+
result = instrumentedFn();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// Execute the function normally
|
|
154
|
+
result = fn();
|
|
155
|
+
}
|
|
111
156
|
}
|
|
112
|
-
|
|
157
|
+
catch (error) {
|
|
113
158
|
// End timing
|
|
114
159
|
const endTime = performance.now();
|
|
115
|
-
|
|
116
|
-
execution.duration = endTime - startTime;
|
|
117
|
-
// Check if it's a bottleneck
|
|
160
|
+
execution.endTime = endTime;
|
|
161
|
+
execution.duration = endTime - execution.startTime;
|
|
118
162
|
execution.isSlow = execution.duration > threshold;
|
|
119
163
|
// Restore the previous current execution
|
|
120
164
|
this._currentExecution = previousExecution;
|
|
121
165
|
// Remove from call stack
|
|
122
166
|
this._callStack.pop();
|
|
167
|
+
// Reset instrumentation flag if this was the top-level call
|
|
168
|
+
if (!wasInstrumented) {
|
|
169
|
+
this._isInstrumented = false;
|
|
170
|
+
}
|
|
171
|
+
// Re-throw the error
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
// End timing
|
|
175
|
+
const endTime = performance.now();
|
|
176
|
+
execution.endTime = endTime;
|
|
177
|
+
execution.duration = endTime - execution.startTime;
|
|
178
|
+
execution.isSlow = execution.duration > threshold;
|
|
179
|
+
// Generate suggestion if slow
|
|
180
|
+
if (execution.isSlow) {
|
|
181
|
+
execution.suggestion = this.generateSuggestion(fnName, execution.duration);
|
|
182
|
+
}
|
|
183
|
+
// Restore the previous current execution
|
|
184
|
+
this._currentExecution = previousExecution;
|
|
185
|
+
// Remove from call stack
|
|
186
|
+
this._callStack.pop();
|
|
187
|
+
// Reset instrumentation flag if this was the top-level call
|
|
188
|
+
if (!wasInstrumented) {
|
|
189
|
+
this._isInstrumented = false;
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Instrument a function to track nested function calls
|
|
195
|
+
*
|
|
196
|
+
* @param fn - The function to instrument
|
|
197
|
+
* @returns The instrumented function
|
|
198
|
+
*/
|
|
199
|
+
instrumentFunction(fn) {
|
|
200
|
+
// If we've already instrumented this function, return the instrumented version
|
|
201
|
+
if (this._instrumentedFunctions.has(fn)) {
|
|
202
|
+
return this._instrumentedFunctions.get(fn);
|
|
123
203
|
}
|
|
204
|
+
// Create a new instrumented function
|
|
205
|
+
const instrumentedFn = () => {
|
|
206
|
+
// Execute the function and track nested calls
|
|
207
|
+
try {
|
|
208
|
+
// We can't actually modify the function at runtime to track nested calls,
|
|
209
|
+
// so we'll just execute it and rely on the call stack for visualization
|
|
210
|
+
return fn();
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
// Re-throw any errors
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
// Cache the instrumented function
|
|
218
|
+
this._instrumentedFunctions.set(fn, instrumentedFn);
|
|
219
|
+
return instrumentedFn;
|
|
124
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Get the current call stack
|
|
223
|
+
*
|
|
224
|
+
* @returns The current call stack
|
|
225
|
+
*/
|
|
125
226
|
getCallStack() {
|
|
126
227
|
return [...this._callStack];
|
|
127
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Generate a visual representation of the execution flow
|
|
231
|
+
*
|
|
232
|
+
* @returns ASCII flow chart of the execution
|
|
233
|
+
*/
|
|
128
234
|
generateFlowChart() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
235
|
+
let result = 'Execution Flow:\n';
|
|
236
|
+
// Process each execution
|
|
237
|
+
this.prepareExecutionData(this._executions).forEach(execution => {
|
|
238
|
+
const indent = ' '.repeat(execution.level);
|
|
239
|
+
const durationStr = execution.duration.toFixed(2);
|
|
240
|
+
const slowMarker = execution.isSlow ? ' [SLOW]' : '';
|
|
241
|
+
result += `${indent}→ ${execution.name} (${durationStr}ms)${slowMarker}\n`;
|
|
242
|
+
// Add suggestion if available
|
|
243
|
+
if (execution.suggestion) {
|
|
244
|
+
result += `${indent} ⚠️ ${execution.suggestion}\n`;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Prepare execution data for the flow chart
|
|
251
|
+
*
|
|
252
|
+
* @param executions - The execution records to prepare
|
|
253
|
+
* @returns A list of execution data
|
|
254
|
+
*/
|
|
255
|
+
prepareExecutionData(executions) {
|
|
256
|
+
const result = [];
|
|
257
|
+
// Process each root execution
|
|
258
|
+
executions.forEach(execution => {
|
|
259
|
+
// Add the root execution
|
|
260
|
+
result.push({
|
|
261
|
+
name: execution.name,
|
|
262
|
+
duration: execution.duration,
|
|
263
|
+
isSlow: execution.isSlow,
|
|
264
|
+
suggestion: execution.suggestion,
|
|
265
|
+
level: execution.level,
|
|
140
266
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
267
|
+
// Add children recursively
|
|
268
|
+
this.addChildrenToResult(execution.children, result);
|
|
269
|
+
});
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Add children to the result list
|
|
274
|
+
*
|
|
275
|
+
* @param children - The children to add
|
|
276
|
+
* @param result - The result list
|
|
277
|
+
*/
|
|
278
|
+
addChildrenToResult(children, result) {
|
|
279
|
+
children.forEach(child => {
|
|
280
|
+
// Add the child
|
|
281
|
+
result.push({
|
|
282
|
+
name: child.name,
|
|
283
|
+
duration: child.duration,
|
|
284
|
+
isSlow: child.isSlow,
|
|
285
|
+
suggestion: child.suggestion,
|
|
286
|
+
level: child.level,
|
|
287
|
+
});
|
|
288
|
+
// Add grandchildren recursively
|
|
289
|
+
this.addChildrenToResult(child.children, result);
|
|
290
|
+
});
|
|
144
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Clear all execution records
|
|
294
|
+
*/
|
|
145
295
|
clear() {
|
|
146
296
|
this._executions = [];
|
|
147
297
|
this._currentExecution = null;
|
|
148
298
|
this._callStack = [];
|
|
299
|
+
this._instrumentedFunctions.clear();
|
|
149
300
|
}
|
|
150
301
|
}
|
|
151
302
|
exports.BrowserExecutionTracker = BrowserExecutionTracker;
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAsTH,kDAEC;AApTD;;GAEG;AACH,MAAM,yBAAyB;IAI7B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 @@ declare class BrowserPerformanceMonitor {
|
|
|
26
26
|
generateSuggestion(functionName: string, duration: number, memoryUsage?: number): string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Browser-compatible execution tracker
|
|
29
|
+
* Browser-compatible execution tracker for tracking function calls and generating flow charts
|
|
30
30
|
*/
|
|
31
31
|
declare class BrowserExecutionTracker {
|
|
32
32
|
private _callStack;
|
|
33
33
|
private _executions;
|
|
34
34
|
private _currentExecution;
|
|
35
35
|
private _defaultThreshold;
|
|
36
|
+
private _instrumentedFunctions;
|
|
37
|
+
private _isInstrumented;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new BrowserExecutionTracker instance
|
|
40
|
+
*
|
|
41
|
+
* @param options - Tracker options
|
|
42
|
+
*/
|
|
36
43
|
constructor(options?: {
|
|
37
44
|
defaultThreshold?: number;
|
|
38
45
|
});
|
|
39
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Generate a performance optimization suggestion based on execution duration
|
|
48
|
+
*
|
|
49
|
+
* @param name - Function name
|
|
50
|
+
* @param duration - Execution duration in ms
|
|
51
|
+
* @returns Optimization suggestion
|
|
52
|
+
*/
|
|
53
|
+
private generateSuggestion;
|
|
54
|
+
/**
|
|
55
|
+
* Track the execution of a function
|
|
56
|
+
*
|
|
57
|
+
* @param fn - The function to track
|
|
58
|
+
* @param options - Options for tracking
|
|
59
|
+
* @returns The return value of the tracked function
|
|
60
|
+
*/
|
|
61
|
+
track<T>(fn: () => T, options?: any): T;
|
|
62
|
+
/**
|
|
63
|
+
* Instrument a function to track nested function calls
|
|
64
|
+
*
|
|
65
|
+
* @param fn - The function to instrument
|
|
66
|
+
* @returns The instrumented function
|
|
67
|
+
*/
|
|
68
|
+
private instrumentFunction;
|
|
69
|
+
/**
|
|
70
|
+
* Get the current call stack
|
|
71
|
+
*
|
|
72
|
+
* @returns The current call stack
|
|
73
|
+
*/
|
|
40
74
|
getCallStack(): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Generate a visual representation of the execution flow
|
|
77
|
+
*
|
|
78
|
+
* @returns ASCII flow chart of the execution
|
|
79
|
+
*/
|
|
41
80
|
generateFlowChart(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Prepare execution data for the flow chart
|
|
83
|
+
*
|
|
84
|
+
* @param executions - The execution records to prepare
|
|
85
|
+
* @returns A list of execution data
|
|
86
|
+
*/
|
|
87
|
+
private prepareExecutionData;
|
|
88
|
+
/**
|
|
89
|
+
* Add children to the result list
|
|
90
|
+
*
|
|
91
|
+
* @param children - The children to add
|
|
92
|
+
* @param result - The result list
|
|
93
|
+
*/
|
|
94
|
+
private addChildrenToResult;
|
|
95
|
+
/**
|
|
96
|
+
* Clear all execution records
|
|
97
|
+
*/
|
|
42
98
|
clear(): void;
|
|
43
99
|
}
|
|
44
100
|
/**
|