hubcap trace - Capture a Chrome performance trace

When to use

Capture a Chrome performance trace for CPU profiling and runtime analysis. Open the output file in Chrome DevTools Performance panel to visualize flame charts, paint events, and layout shifts. Use metrics for a quick performance check without generating a full trace.

Usage

hubcap trace --output <file> [--duration <duration>]

Arguments

None.

Flags

FlagTypeDefaultDescription
--outputstring""Output file path (required)
--durationduration1sTrace duration

Output

FieldTypeDescription
filestringPath to the written trace file
sizeintFile size in bytes
{"file":"trace.json","size":54321}

Errors

ConditionExit codeStderr
Missing —output flag1usage: hubcap trace --duration <d> --output <file>
Chrome not connected2error: connecting to Chrome: ...
Cannot write to file1error: writing file: ...
Timeout3error: timeout

Examples

Capture a 1-second trace (default duration):

hubcap trace --output trace.json

Capture a 5-second trace:

hubcap trace --output trace.json --duration 5s

Navigate to a page and trace its load performance:

hubcap goto "https://example.com" && hubcap trace --output load-trace.json --duration 3s

Capture a trace with a timestamped filename and report the size:

hubcap trace --output "trace-$(date +%s).json" --duration 2s | jq '"Trace size: \(.size) bytes"'

See also