Implementation Plan
Utils
Profiler
- Docs -
- "CodePushup Profiler" -
- Debug Mode and state handling -
- Browser
- NodeJS
Usage
- setup -
- cli (primary-dark) -
- core (primary) -
- utils,models (primary-light) -
- plugins -
The goal is to enable Browser functionality in the NodeJS environment, specifically the Extensibility API used for Performance profiling.
Example - NodeJS code:
// Mark used to represent the start of the image processing task
// The start time is defaulted to now
const imageProcessinTimeStart = performance.now();
// ... later in your code
// Track entry representing the completion of image processing
// with additional details and a tooltip
// The start time is a marker from earlier
// The end time is defaulted to now
performance.measure('Image Processing Complete', {
start: imageProcessinTimeStart,
detail: {
devtools: {
dataType: 'track-entry',
track: 'Image Processing Tasks',
trackGroup: 'My Tracks', // Group related tracks together
color: 'tertiary-dark',
properties: [
['Filter Type', 'Gaussian Blur'],
['Resize Dimensions', '500x300'],
],
tooltipText: 'Image processed successfully',
},
},
});
Example Traces
Usage
const profiler = new Profiler({
outputPath: 'trace-output.json',
spans: {
analysis: { track: 'Analysis', group: 'Tools', color: 'primary' },
io: { track: 'I/O', group: 'Tools', color: 'secondary' },
},
});
const taskLoadConfig = profiler.mark('start-loadConfig', {
detail: profiler.spans.io({
properties: [['Config File', 'code-pushup.config.json']],
}),
});
profiler.measure('run-loadConfig', taskLoadConfig);
# Profile Code PushUp CLI
CP_PROFILING=true npm @code-pushup/cli
# Or Profile with Code PushUp NxPlugin
nx run @code-pushup/nx-plugin:cli --profiling --profiling-output=trace.json
# Both write the trace to the file system
References
Implementation Plan
Utils
PerformanceObserverSinkfeat(utils): add performance observer #1206WriteAheadLogfiles and trace event WAL utils - feat(utils): add WriteAheadLog classes #1210extendedperf_hookstype - feat(utils): performance TS ext #1213Profiler
ShardedWriteAheadLog- refactor: use sharded WAL #1231installExitHandler- fix: add exit handler to profiler #1221PerformanceObserverSink- feat(utils): add NodeJS profiler #1219Usage
The goal is to enable Browser functionality in the NodeJS environment, specifically the Extensibility API used for Performance profiling.
Example - NodeJS code:
Example Traces
Usage
References