@marvinh/node-profiler
v1.0.0
Published
Very simple wrapper around node's inspect module.
Downloads
3
Readme
node profiler
This is a very small module around node's built-in inspector
module, because I always forget how to set it up.
Usage
npm install -D @marvinh/node-profiler
# yarn
yarn add -D @marvinh/node-profiler
# pnpm
pnpm add -D @marvinh/node-profiler
Once installed:
import * as fs from "fs";
import { startProfiling } from "@marvinh/node-profiler";
(async () => {
// Start profiling session
const stopProfiling = await startProfiling();
// Do some stuff
// Collect profile data and write it to disk
const profile = await stopProfiling();
// Write to disk
fs.writeFileSync("./profile.cpuprofile", JSON.stringify(profile));
})();
License
MIT
, see the license file