cpu-profile-analysis

Analyze V8 CPU profiles and Chrome DevTools trace files to find performance bottlenecks.

10|1|Updated Jul 13, 2026
One-click install
npx skills add https://github.com/KevinHuangIsLearning/shortestpath-ide --skill cpu-profile-analysis-kevinhuangislearning
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpu-profile-analysis
Source: https://github.com/KevinHuangIsLearning/shortestpath-ide/tree/main/.github/skills/cpu-profile-analysis
Command: npx skills add https://github.com/KevinHuangIsLearning/shortestpath-ide --skill cpu-profile-analysis-kevinhuangislearning

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Raw .cpuprofile and DevTools Trace-*.json files are massive, single-line JSON blobs that are nearly impossible to inspect manually, making it hard to find slow functions, long tasks, or rendering bottlenecks in VS Code and Electron apps. ## Core Features & Use Cases - CPU Profile Analysis: Parse V8 sampling profiler data to compute self-time per function, identify activity regions, and measure timing between milestones. - DevTools Trace Analysis: Extract user timing marks, long tasks, layout/paint events, GC pressure, and input latency from Chrome Trace Event Format files across Renderer, Browser, and GPU processes. - Huge File Handling: Buffer-based parsing for files exceeding V8's ~512MB string limit, with embedded ProfileChunk reconstruction. - Use Case: Given a 200MB Trace-*.json from a slow VS Code session, identify which functions blocked the main thread, when code/didResolveTextFileEditorModel fired, and how much time GC consumed. ## Quick Start Analyze the attached Trace-2024.json file and tell me which functions consumed the most CPU time on the renderer main thread.

Frequently Asked Questions about cpu-profile-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze a .cpuprofile file from VS Code?▼

Parse the JSON to build a node map from the nodes array, then walk the samples array to reconstruct call stacks. Compute self-time per function using timeDeltas, sort descending, and identify activity regions with marker functions.

What is the difference between .cpuprofile and Trace-*.json files?▼

A .cpuprofile contains only V8 sampling profiler data (nodes, samples, timeDeltas). A Trace-*.json uses the Chrome Trace Event Format with traceEvents covering CPU samples, layout, paint, GC, user timing marks, and multi-process data.

Why does JSON.parse fail on large trace files?▼

V8 cannot create strings larger than roughly 512MB, so readFileSync with utf8 encoding fails on files over ~400MB. Read the file as a Buffer and extract sections by scanning for JSON keys, parsing small sub-buffers individually.

How do I find long tasks in a Chrome DevTools trace?▼

Filter traceEvents for RunTask events with phase X and dur greater than 50000 microseconds on the CrRendererMain thread. Sort by duration descending to find the tasks blocking the main thread longest.

Can I extract CPU profile data from a DevTools trace file?▼

Yes. Trace files embed the full CPU profile as Profile and ProfileChunk events. Merge the nodes, samples, and timeDeltas from all chunks sharing the same profile id, then analyze them like a standard .cpuprofile.