Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}