p-profiler is a JavaScript library (v0.2.1, stable) from Microsoft that wraps promise-returning functions to generate Chrome DevTools-compatible profiling JSON. It integrates with concurrency libraries like p-queue and p-graph to trace async task execution, helping developers visualize bottlenecks in promise-heavy workflows. Unlike generic profilers, it targets promise queues and graph-based task scheduling, outputting a trace file that can be loaded into browser DevTools for flamechart analysis. Ships TypeScript definitions. Release cadence is low; primarily a utility for debugging concurrent async operations.
npm install p-profilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Profiler instance, wraps two async tasks with p-queue, and outputs a Chrome DevTools trace file.
Consider calling output() after all tasks complete, or use a custom stream to write asynchronously.
Create a new Profiler instance for each profiling session.
Use p-queue or similar to control actual concurrency. The concurrency option only affects how tasks appear in the profiler timeline.
Always pass an options object with fullPath: 'path/to/profile.json'.
Ensure the callback passed to profiler.run() returns a promise (use async or wrap in Promise.resolve()).
Use default import: import Profiler from 'p-profiler' then const profiler = new Profiler(...).
Switch to ESM ("type": "module" in package.json) or use dynamic import: const Profiler = (await import('p-profiler')).default.Call profiler.output({ fullPath: './profile.json' }).Wrap the function body in an async function or Promise.resolve().