🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@datadog/pprof

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/pprof - npm Package Compare versions

Comparing version

to
2.0.0

2

out/src/profile-serializer.d.ts

@@ -26,3 +26,3 @@ /**

*/
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper): Profile;
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean): Profile;
/**

@@ -29,0 +29,0 @@ * Converts cpu profile into into a profile proto.

@@ -168,2 +168,6 @@ "use strict";

}
function computeTotalHitCount(root) {
return (root.hitCount +
root.children.reduce((sum, node) => sum + computeTotalHitCount(node), 0));
}
/**

@@ -176,3 +180,13 @@ * Converts v8 time profile into into a profile proto.

*/
function serializeTimeProfile(prof, intervalMicros, sourceMapper) {
function serializeTimeProfile(prof, intervalMicros, sourceMapper, recomputeSamplingInterval = false) {
// If requested, recompute sampling interval it from profile duration and total number of hits,
// since profile duration should be #hits x interval
// Recomputing an average interval is more accurate, since in practice intervals between
// samples are larger than the requested sampling interval (eg. 12.5ms vs 10ms requested).
if (recomputeSamplingInterval) {
const totalHitCount = computeTotalHitCount(prof.topDownRoot);
if (totalHitCount > 0) {
intervalMicros = Math.floor((prof.endTime - prof.startTime) / computeTotalHitCount(prof.topDownRoot));
}
}
const intervalNanos = intervalMicros * 1000;

@@ -179,0 +193,0 @@ const appendTimeEntryToSamples = (entry, samples) => {

@@ -52,3 +52,3 @@ "use strict";

}
return (0, profile_serializer_1.serializeTimeProfile)(result, intervalMicros, sourceMapper);
return (0, profile_serializer_1.serializeTimeProfile)(result, intervalMicros, sourceMapper, true);
}

@@ -69,3 +69,3 @@ // For Node.js v16+, we want to start the next profile before we stop the

profiler.dispose();
return (0, profile_serializer_1.serializeTimeProfile)(result, intervalMicros, sourceMapper);
return (0, profile_serializer_1.serializeTimeProfile)(result, intervalMicros, sourceMapper, true);
}

@@ -72,0 +72,0 @@ }

{
"name": "@datadog/pprof",
"version": "2.0.0-pre-eb60cf3",
"version": "2.0.0",
"description": "pprof support for Node.js",

@@ -32,3 +32,3 @@ "repository": "datadog/pprof-nodejs",

"pify": "^5.0.0",
"pprof-format": "^2.0.5",
"pprof-format": "^2.0.6",
"source-map": "^0.7.3",

@@ -35,0 +35,0 @@ "split": "^1.0.1"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet