Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@lanterna-profiler/detectors

Default detector pack for Lanterna — agent-first Node.js CPU, memory & experimental async profiler.

This package contains the built-in CPU, memory, and async detectors, thresholds, attribution helpers, and kind factories that pre-wire those detectors. The CPU pack includes both pattern-specific rules (sync-crypto, blocking-io, json-on-hot-path, dependency hotspots, require-on-hot-path) and the generic cpu-hotspot:* fallback for plain user-code CPU that needs a concrete file/line or caller lead. Capture orchestration and KindScopedDetector itself live in @lanterna-profiler/core.

Install

npm install @lanterna-profiler/core @lanterna-profiler/detectors

Usage

import { runProfile } from '@lanterna-profiler/core';
import {
  createCpuProfileKindWithBuiltInDetectors,
  createMemoryProfileKindWithBuiltInDetectors,
} from '@lanterna-profiler/detectors';

const report = await runProfile({
  command: ['node', 'app.js'],
  durationMs: 30_000,
  pretty: false,
  kinds: [
    createCpuProfileKindWithBuiltInDetectors({
      readStderrSoFar: () => '',
      sampleIntervalMicros: 1000,
      deep: false,
    }),
    createMemoryProfileKindWithBuiltInDetectors({}),
  ],
});

Documentation

Related packages