-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
➕ enhancementnew feature or requestnew feature or request🔥 performanceperformance optimizationperformance optimization🤓 UXUX improvement for CLI usersUX improvement for CLI users
Description
Related:
- Utils
- epoch clock util- refactor: implement epoch clock logic #1204
PerformanceObserversink feat(utils): add performance observer #1206- Chrome DevTools Extensibility API utils- refactor: add extensibility API helper #1207
- File sink class
textandjsonl- feat(utils): add file sink classes #1210 - Trace file sink classe -
- Process handler for save and fatal exit -
- Types
- extended
perf_hookstype -
- extended
- Profiler
- Measure configuration
tracks,colours- - Measure utils
marker,mark,measure,measureAsync- - Observe measures and save exit flush -
- Measure configuration
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 systemReferences
Metadata
Metadata
Assignees
Labels
➕ enhancementnew feature or requestnew feature or request🔥 performanceperformance optimizationperformance optimization🤓 UXUX improvement for CLI usersUX improvement for CLI users