How to use pprof - 4 common examples

To help you get started, we’ve selected a few pprof examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / cloud-profiler-nodejs / ts / src / index.ts View on Github external
if (!nodeVersionOkay(process.version)) {
    throw new Error(
      `Could not start profiler: node version ${process.version}` +
        ` does not satisfies "${pjson.engines.node}"` +
        '\nSee https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs#prerequisites' +
        ' for details.'
    );
  }

  let profilerConfig: ProfilerConfig = initConfigLocal(config);

  // Start the heap profiler if profiler config does not indicate heap profiling
  // is disabled. This must be done before any asynchronous calls are made so
  // all memory allocations made after start() is called can be captured.
  if (!profilerConfig.disableHeap) {
    heapProfiler.start(
      profilerConfig.heapIntervalBytes,
      profilerConfig.heapMaxStackDepth
    );
  }
  profilerConfig = await initConfigMetadata(profilerConfig);
  return new Profiler(profilerConfig);
}
github googleapis / cloud-profiler-nodejs / ts / src / profiler.ts View on Github external
async writeHeapProfile(prof: RequestProfile): Promise {
    if (this.config.disableHeap) {
      throw Error('Cannot collect heap profile, heap profiler not enabled.');
    }
    const p = heapProfiler.profile(
      this.config.ignoreHeapSamplesPath,
      this.sourceMapper
    );
    prof.profileBytes = await profileBytes(p);
    return prof;
  }
}
github googleapis / cloud-profiler-nodejs / ts / src / profiler.ts View on Github external
throw Error('Cannot collect time profile, duration is undefined.');
    }
    const durationMillis = parseDuration(prof.duration);
    if (!durationMillis) {
      throw Error(
        `Cannot collect time profile, duration "${prof.duration}" cannot` +
          ` be parsed.`
      );
    }
    const options = {
      durationMillis,
      intervalMicros: this.config.timeIntervalMicros,
      sourceMapper: this.sourceMapper,
    };

    const p = await timeProfiler.profile(options);
    prof.profileBytes = await profileBytes(p);
    return prof;
  }
github googleapis / cloud-profiler-nodejs / ts / src / profiler.ts View on Github external
async start(): Promise {
    if (!this.config.disableSourceMaps) {
      try {
        this.sourceMapper = await SourceMapper.create(
          this.config.sourceMapSearchPath
        );
      } catch (err) {
        this.logger.error(
          `Failed to initialize SourceMapper. Source map support has been disabled: ${err}`
        );
        this.config.disableSourceMaps = true;
      }
    }
    this.runLoop();
  }

pprof

pprof support for Node.js

Apache-2.0
Latest version published 10 months ago

Package Health Score

68 / 100
Full package analysis