@datadog/pprof 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/out/src/index.d.ts +7 -2
- package/out/src/index.js +4 -1
- package/out/src/index.js.map +1 -1
- package/out/src/profile-serializer.d.ts +2 -10
- package/out/src/profile-serializer.js +7 -58
- package/out/src/profile-serializer.js.map +1 -1
- package/out/src/time-profiler-bindings.d.ts +1 -0
- package/out/src/time-profiler-bindings.js +2 -1
- package/out/src/time-profiler-bindings.js.map +1 -1
- package/out/src/time-profiler.d.ts +12 -6
- package/out/src/time-profiler.js +42 -11
- package/out/src/time-profiler.js.map +1 -1
- package/out/src/v8-types.d.ts +1 -40
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node-102.node +0 -0
- package/prebuilds/darwin-arm64/node-108.node +0 -0
- package/prebuilds/darwin-arm64/node-111.node +0 -0
- package/prebuilds/darwin-arm64/node-115.node +0 -0
- package/prebuilds/darwin-arm64/node-72.node +0 -0
- package/prebuilds/darwin-arm64/node-79.node +0 -0
- package/prebuilds/darwin-arm64/node-83.node +0 -0
- package/prebuilds/darwin-arm64/node-88.node +0 -0
- package/prebuilds/darwin-arm64/node-93.node +0 -0
- package/prebuilds/darwin-x64/node-102.node +0 -0
- package/prebuilds/darwin-x64/node-108.node +0 -0
- package/prebuilds/darwin-x64/node-111.node +0 -0
- package/prebuilds/darwin-x64/node-115.node +0 -0
- package/prebuilds/darwin-x64/node-72.node +0 -0
- package/prebuilds/darwin-x64/node-79.node +0 -0
- package/prebuilds/darwin-x64/node-83.node +0 -0
- package/prebuilds/darwin-x64/node-88.node +0 -0
- package/prebuilds/darwin-x64/node-93.node +0 -0
- package/prebuilds/linux-arm/node-102.node +0 -0
- package/prebuilds/linux-arm/node-108.node +0 -0
- package/prebuilds/linux-arm/node-111.node +0 -0
- package/prebuilds/linux-arm/node-115.node +0 -0
- package/prebuilds/linux-arm/node-72.node +0 -0
- package/prebuilds/linux-arm/node-79.node +0 -0
- package/prebuilds/linux-arm/node-83.node +0 -0
- package/prebuilds/linux-arm/node-88.node +0 -0
- package/prebuilds/linux-arm/node-93.node +0 -0
- package/prebuilds/linux-arm64/node-102.node +0 -0
- package/prebuilds/linux-arm64/node-108.node +0 -0
- package/prebuilds/linux-arm64/node-111.node +0 -0
- package/prebuilds/linux-arm64/node-115.node +0 -0
- package/prebuilds/linux-arm64/node-72.node +0 -0
- package/prebuilds/linux-arm64/node-79.node +0 -0
- package/prebuilds/linux-arm64/node-83.node +0 -0
- package/prebuilds/linux-arm64/node-88.node +0 -0
- package/prebuilds/linux-arm64/node-93.node +0 -0
- package/prebuilds/linux-ia32/node-72.node +0 -0
- package/prebuilds/linux-ia32/node-79.node +0 -0
- package/prebuilds/linux-x64/node-102.node +0 -0
- package/prebuilds/linux-x64/node-108.node +0 -0
- package/prebuilds/linux-x64/node-111.node +0 -0
- package/prebuilds/linux-x64/node-115.node +0 -0
- package/prebuilds/linux-x64/node-72.node +0 -0
- package/prebuilds/linux-x64/node-79.node +0 -0
- package/prebuilds/linux-x64/node-83.node +0 -0
- package/prebuilds/linux-x64/node-88.node +0 -0
- package/prebuilds/linux-x64/node-93.node +0 -0
- package/prebuilds/linuxmusl-x64/node-102.node +0 -0
- package/prebuilds/linuxmusl-x64/node-108.node +0 -0
- package/prebuilds/linuxmusl-x64/node-111.node +0 -0
- package/prebuilds/linuxmusl-x64/node-115.node +0 -0
- package/prebuilds/linuxmusl-x64/node-72.node +0 -0
- package/prebuilds/linuxmusl-x64/node-79.node +0 -0
- package/prebuilds/linuxmusl-x64/node-83.node +0 -0
- package/prebuilds/linuxmusl-x64/node-88.node +0 -0
- package/prebuilds/linuxmusl-x64/node-93.node +0 -0
- package/prebuilds/win32-ia32/node-102.node +0 -0
- package/prebuilds/win32-ia32/node-72.node +0 -0
- package/prebuilds/win32-ia32/node-79.node +0 -0
- package/prebuilds/win32-ia32/node-83.node +0 -0
- package/prebuilds/win32-ia32/node-88.node +0 -0
- package/prebuilds/win32-ia32/node-93.node +0 -0
- package/prebuilds/win32-x64/node-102.node +0 -0
- package/prebuilds/win32-x64/node-108.node +0 -0
- package/prebuilds/win32-x64/node-111.node +0 -0
- package/prebuilds/win32-x64/node-115.node +0 -0
- package/prebuilds/win32-x64/node-72.node +0 -0
- package/prebuilds/win32-x64/node-79.node +0 -0
- package/prebuilds/win32-x64/node-83.node +0 -0
- package/prebuilds/win32-x64/node-88.node +0 -0
- package/prebuilds/win32-x64/node-93.node +0 -0
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ this module. Instructions for installing the `pprof` CLI can be found
|
|
|
37
37
|
Install [`pprof`][npm-url] with `npm` or add to your `package.json`.
|
|
38
38
|
```sh
|
|
39
39
|
# Install through npm while saving to the local 'package.json'
|
|
40
|
-
npm install --save pprof
|
|
40
|
+
npm install --save @datadog/pprof
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Using the Profiler
|
|
@@ -66,7 +66,7 @@ Install [`pprof`][npm-url] with `npm` or add to your `package.json`.
|
|
|
66
66
|
|
|
67
67
|
1. Start program from the command line:
|
|
68
68
|
```sh
|
|
69
|
-
node --require pprof app.js
|
|
69
|
+
node --require @datadog/pprof app.js
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
2. A wall time profile for the job will be saved in
|
package/out/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as heapProfiler from './heap-profiler';
|
|
2
2
|
import * as timeProfiler from './time-profiler';
|
|
3
|
-
export { AllocationProfileNode, TimeProfileNode, ProfileNode } from './v8-types';
|
|
3
|
+
export { AllocationProfileNode, TimeProfileNode, ProfileNode, LabelSet, } from './v8-types';
|
|
4
4
|
export { encode, encodeSync } from './profile-encoder';
|
|
5
5
|
export { SourceMapper } from './sourcemapper/sourcemapper';
|
|
6
6
|
export { setLogger } from './logger';
|
|
@@ -8,8 +8,13 @@ export declare const time: {
|
|
|
8
8
|
profile: typeof timeProfiler.profile;
|
|
9
9
|
start: typeof timeProfiler.start;
|
|
10
10
|
stop: typeof timeProfiler.stop;
|
|
11
|
-
|
|
11
|
+
setContext: typeof timeProfiler.setContext;
|
|
12
12
|
isStarted: typeof timeProfiler.isStarted;
|
|
13
|
+
v8ProfilerStuckEventLoopDetected: typeof timeProfiler.v8ProfilerStuckEventLoopDetected;
|
|
14
|
+
getState: typeof timeProfiler.getState;
|
|
15
|
+
constants: {
|
|
16
|
+
kSampleCount: any;
|
|
17
|
+
};
|
|
13
18
|
};
|
|
14
19
|
export declare const heap: {
|
|
15
20
|
start: typeof heapProfiler.start;
|
package/out/src/index.js
CHANGED
|
@@ -54,8 +54,11 @@ exports.time = {
|
|
|
54
54
|
profile: timeProfiler.profile,
|
|
55
55
|
start: timeProfiler.start,
|
|
56
56
|
stop: timeProfiler.stop,
|
|
57
|
-
|
|
57
|
+
setContext: timeProfiler.setContext,
|
|
58
58
|
isStarted: timeProfiler.isStarted,
|
|
59
|
+
v8ProfilerStuckEventLoopDetected: timeProfiler.v8ProfilerStuckEventLoopDetected,
|
|
60
|
+
getState: timeProfiler.getState,
|
|
61
|
+
constants: timeProfiler.constants,
|
|
59
62
|
};
|
|
60
63
|
exports.heap = {
|
|
61
64
|
start: heapProfiler.start,
|
package/out/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,2BAAiC;AAEjC,8DAAgD;AAChD,uDAA6C;AAC7C,8DAAgD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,2BAAiC;AAEjC,8DAAgD;AAChD,uDAA6C;AAC7C,8DAAgD;AAQhD,qDAAqD;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"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Profile } from 'pprof-format';
|
|
17
17
|
import { SourceMapper } from './sourcemapper/sourcemapper';
|
|
18
|
-
import { AllocationProfileNode,
|
|
18
|
+
import { AllocationProfileNode, LabelSet, TimeProfile } from './v8-types';
|
|
19
19
|
/**
|
|
20
20
|
* Converts v8 time profile into into a profile proto.
|
|
21
21
|
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
@@ -23,15 +23,7 @@ import { AllocationProfileNode, CpuProfile, TimeProfile } from './v8-types';
|
|
|
23
23
|
* @param prof - profile to be converted.
|
|
24
24
|
* @param intervalMicros - average time (microseconds) between samples.
|
|
25
25
|
*/
|
|
26
|
-
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean): Profile;
|
|
27
|
-
/**
|
|
28
|
-
* Converts cpu profile into into a profile proto.
|
|
29
|
-
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
30
|
-
*
|
|
31
|
-
* @param prof - profile to be converted.
|
|
32
|
-
* @param intervalMicros - average time (microseconds) between samples.
|
|
33
|
-
*/
|
|
34
|
-
export declare function serializeCpuProfile(prof: CpuProfile, intervalMicros: number, sourceMapper?: SourceMapper): Profile;
|
|
26
|
+
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean, generateLabels?: (context: object) => LabelSet): Profile;
|
|
35
27
|
/**
|
|
36
28
|
* Converts v8 heap profile into into a profile proto.
|
|
37
29
|
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.serializeHeapProfile = exports.
|
|
18
|
+
exports.serializeHeapProfile = exports.serializeTimeProfile = void 0;
|
|
19
19
|
const pprof_format_1 = require("pprof-format");
|
|
20
20
|
function isGeneratedLocation(location) {
|
|
21
21
|
return (location.column !== undefined &&
|
|
@@ -135,16 +135,6 @@ function createTimeValueType(table) {
|
|
|
135
135
|
unit: table.dedup('nanoseconds'),
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
/**
|
|
139
|
-
* @return value type for cpu samples (type:cpu, units:nanoseconds), and
|
|
140
|
-
* adds strings used in this value type to the table.
|
|
141
|
-
*/
|
|
142
|
-
function createCpuValueType(table) {
|
|
143
|
-
return new pprof_format_1.ValueType({
|
|
144
|
-
type: table.dedup('cpu'),
|
|
145
|
-
unit: table.dedup('nanoseconds'),
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
138
|
/**
|
|
149
139
|
* @return value type for object counts (type:objects, units:count), and
|
|
150
140
|
* adds strings used in this value type to the table.
|
|
@@ -176,7 +166,7 @@ function computeTotalHitCount(root) {
|
|
|
176
166
|
* @param prof - profile to be converted.
|
|
177
167
|
* @param intervalMicros - average time (microseconds) between samples.
|
|
178
168
|
*/
|
|
179
|
-
function serializeTimeProfile(prof, intervalMicros, sourceMapper, recomputeSamplingInterval = false) {
|
|
169
|
+
function serializeTimeProfile(prof, intervalMicros, sourceMapper, recomputeSamplingInterval = false, generateLabels) {
|
|
180
170
|
// If requested, recompute sampling interval from profile duration and total number of hits,
|
|
181
171
|
// since profile duration should be #hits x interval.
|
|
182
172
|
// Recomputing an average interval is more accurate, since in practice intervals between
|
|
@@ -186,19 +176,19 @@ function serializeTimeProfile(prof, intervalMicros, sourceMapper, recomputeSampl
|
|
|
186
176
|
if (recomputeSamplingInterval) {
|
|
187
177
|
const totalHitCount = computeTotalHitCount(prof.topDownRoot);
|
|
188
178
|
if (totalHitCount > 0) {
|
|
189
|
-
intervalMicros = Math.min(Math.max(Math.floor((prof.endTime - prof.startTime) /
|
|
190
|
-
computeTotalHitCount(prof.topDownRoot)), intervalMicros), 2 * intervalMicros);
|
|
179
|
+
intervalMicros = Math.min(Math.max(Math.floor((prof.endTime - prof.startTime) / totalHitCount), intervalMicros), 2 * intervalMicros);
|
|
191
180
|
}
|
|
192
181
|
}
|
|
193
182
|
const intervalNanos = intervalMicros * 1000;
|
|
194
183
|
const appendTimeEntryToSamples = (entry, samples) => {
|
|
195
184
|
let unlabelledHits = entry.node.hitCount;
|
|
196
|
-
for (const
|
|
197
|
-
|
|
185
|
+
for (const context of entry.node.contexts || []) {
|
|
186
|
+
const labels = generateLabels ? generateLabels(context) : context;
|
|
187
|
+
if (Object.keys(labels).length > 0) {
|
|
198
188
|
const sample = new pprof_format_1.Sample({
|
|
199
189
|
locationId: entry.stack,
|
|
200
190
|
value: [1, intervalNanos],
|
|
201
|
-
label: buildLabels(
|
|
191
|
+
label: buildLabels(labels, stringTable),
|
|
202
192
|
});
|
|
203
193
|
samples.push(sample);
|
|
204
194
|
unlabelledHits--;
|
|
@@ -242,47 +232,6 @@ function buildLabels(labelSet, stringTable) {
|
|
|
242
232
|
}
|
|
243
233
|
return labels;
|
|
244
234
|
}
|
|
245
|
-
/**
|
|
246
|
-
* Converts cpu profile into into a profile proto.
|
|
247
|
-
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
248
|
-
*
|
|
249
|
-
* @param prof - profile to be converted.
|
|
250
|
-
* @param intervalMicros - average time (microseconds) between samples.
|
|
251
|
-
*/
|
|
252
|
-
function serializeCpuProfile(prof, intervalMicros, sourceMapper) {
|
|
253
|
-
const intervalNanos = intervalMicros * 1000;
|
|
254
|
-
const appendCpuEntryToSamples = (entry, samples) => {
|
|
255
|
-
for (const labelCpu of entry.node.labelSets) {
|
|
256
|
-
const sample = new pprof_format_1.Sample({
|
|
257
|
-
locationId: entry.stack,
|
|
258
|
-
value: [1, labelCpu.cpuTime],
|
|
259
|
-
label: buildLabels(labelCpu.labels, stringTable),
|
|
260
|
-
});
|
|
261
|
-
samples.push(sample);
|
|
262
|
-
}
|
|
263
|
-
if (entry.node.hitCount > 0) {
|
|
264
|
-
const sample = new pprof_format_1.Sample({
|
|
265
|
-
locationId: entry.stack,
|
|
266
|
-
value: [entry.node.hitCount, entry.node.cpuTime],
|
|
267
|
-
});
|
|
268
|
-
samples.push(sample);
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
const stringTable = new pprof_format_1.StringTable();
|
|
272
|
-
const sampleValueType = createSampleCountValueType(stringTable);
|
|
273
|
-
// const wallValueType = createTimeValueType(stringTable);
|
|
274
|
-
const cpuValueType = createCpuValueType(stringTable);
|
|
275
|
-
const profile = {
|
|
276
|
-
sampleType: [sampleValueType, cpuValueType /*, wallValueType*/],
|
|
277
|
-
timeNanos: Date.now() * 1000 * 1000,
|
|
278
|
-
durationNanos: prof.endTime - prof.startTime,
|
|
279
|
-
periodType: cpuValueType,
|
|
280
|
-
period: intervalNanos,
|
|
281
|
-
};
|
|
282
|
-
serialize(profile, prof.topDownRoot, appendCpuEntryToSamples, stringTable, undefined, sourceMapper);
|
|
283
|
-
return new pprof_format_1.Profile(profile);
|
|
284
|
-
}
|
|
285
|
-
exports.serializeCpuProfile = serializeCpuProfile;
|
|
286
235
|
/**
|
|
287
236
|
* Converts v8 heap profile into into a profile proto.
|
|
288
237
|
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-serializer.js","sourceRoot":"","sources":["../../ts/src/profile-serializer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+CAUsB;
|
|
1
|
+
{"version":3,"file":"profile-serializer.js","sourceRoot":"","sources":["../../ts/src/profile-serializer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+CAUsB;AAoCtB,SAAS,mBAAmB,CAC1B,QAAwB;IAExB,OAAO,CACL,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC7B,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,QAAQ,CAAC,IAAI,GAAG,CAAC,CAClB,CAAC;AACJ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O,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AA3CD,oDA2CC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimeProfiler = void 0;
|
|
3
|
+
exports.constants = exports.TimeProfiler = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright 2018 Google Inc. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -20,4 +20,5 @@ const path_1 = require("path");
|
|
|
20
20
|
const findBinding = require('node-gyp-build');
|
|
21
21
|
const profiler = findBinding((0, path_1.join)(__dirname, '..', '..'));
|
|
22
22
|
exports.TimeProfiler = profiler.TimeProfiler;
|
|
23
|
+
exports.constants = profiler.constants;
|
|
23
24
|
//# sourceMappingURL=time-profiler-bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-profiler-bindings.js","sourceRoot":"","sources":["../../ts/src/time-profiler-bindings.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,+BAA0B;AAE1B,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE7C,QAAA,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"time-profiler-bindings.js","sourceRoot":"","sources":["../../ts/src/time-profiler-bindings.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,+BAA0B;AAE1B,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE7C,QAAA,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;AACrC,QAAA,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC"}
|
|
@@ -30,11 +30,17 @@ export interface TimeProfilerOptions {
|
|
|
30
30
|
* This defaults to false.
|
|
31
31
|
*/
|
|
32
32
|
lineNumbers?: boolean;
|
|
33
|
-
|
|
33
|
+
withContexts?: boolean;
|
|
34
|
+
workaroundV8Bug?: boolean;
|
|
34
35
|
}
|
|
35
|
-
export declare function profile({ intervalMicros, durationMillis, sourceMapper, lineNumbers,
|
|
36
|
-
export declare function start({ intervalMicros, durationMillis, sourceMapper, lineNumbers,
|
|
37
|
-
export declare function stop(restart?: boolean): import("pprof-format").Profile;
|
|
38
|
-
export declare function
|
|
36
|
+
export declare function profile({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, workaroundV8Bug, }: TimeProfilerOptions): Promise<import("pprof-format").Profile>;
|
|
37
|
+
export declare function start({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, workaroundV8Bug, }: TimeProfilerOptions): void;
|
|
38
|
+
export declare function stop(restart?: boolean, generateLabels?: (context: object) => LabelSet): import("pprof-format").Profile;
|
|
39
|
+
export declare function getState(): any;
|
|
40
|
+
export declare function setContext(context?: object): void;
|
|
39
41
|
export declare function isStarted(): boolean;
|
|
40
|
-
export
|
|
42
|
+
export declare function v8ProfilerStuckEventLoopDetected(): number;
|
|
43
|
+
export declare const constants: {
|
|
44
|
+
kSampleCount: any;
|
|
45
|
+
};
|
|
46
|
+
export { LabelSet };
|
package/out/src/time-profiler.js
CHANGED
|
@@ -18,50 +18,68 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.isStarted = exports.
|
|
21
|
+
exports.constants = exports.v8ProfilerStuckEventLoopDetected = exports.isStarted = exports.setContext = exports.getState = exports.stop = exports.start = exports.profile = void 0;
|
|
22
22
|
const delay_1 = __importDefault(require("delay"));
|
|
23
23
|
const profile_serializer_1 = require("./profile-serializer");
|
|
24
24
|
const time_profiler_bindings_1 = require("./time-profiler-bindings");
|
|
25
|
+
const { kSampleCount } = time_profiler_bindings_1.constants;
|
|
25
26
|
const DEFAULT_INTERVAL_MICROS = 1000;
|
|
26
27
|
const DEFAULT_DURATION_MILLIS = 60000;
|
|
27
28
|
let gProfiler;
|
|
28
29
|
let gSourceMapper;
|
|
29
30
|
let gIntervalMicros;
|
|
31
|
+
let gV8ProfilerStuckEventLoopDetected = 0;
|
|
30
32
|
/** Make sure to stop profiler before node shuts down, otherwise profiling
|
|
31
33
|
* signal might cause a crash if it occurs during shutdown */
|
|
32
34
|
process.once('exit', () => {
|
|
33
35
|
if (isStarted())
|
|
34
36
|
stop();
|
|
35
37
|
});
|
|
36
|
-
async function profile({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false,
|
|
38
|
+
async function profile({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, workaroundV8Bug = true, }) {
|
|
37
39
|
start({
|
|
38
40
|
intervalMicros,
|
|
39
41
|
durationMillis,
|
|
40
42
|
sourceMapper,
|
|
41
43
|
lineNumbers,
|
|
42
|
-
|
|
44
|
+
withContexts,
|
|
45
|
+
workaroundV8Bug,
|
|
43
46
|
});
|
|
44
47
|
await (0, delay_1.default)(durationMillis);
|
|
45
48
|
return stop();
|
|
46
49
|
}
|
|
47
50
|
exports.profile = profile;
|
|
48
51
|
// Temporarily retained for backwards compatibility with older tracer
|
|
49
|
-
function start({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false,
|
|
52
|
+
function start({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, workaroundV8Bug = true, }) {
|
|
50
53
|
if (gProfiler) {
|
|
51
54
|
throw new Error('Wall profiler is already started');
|
|
52
55
|
}
|
|
53
|
-
gProfiler = new time_profiler_bindings_1.TimeProfiler(intervalMicros, durationMillis * 1000, lineNumbers,
|
|
54
|
-
gProfiler.start();
|
|
56
|
+
gProfiler = new time_profiler_bindings_1.TimeProfiler(intervalMicros, durationMillis * 1000, lineNumbers, withContexts, workaroundV8Bug);
|
|
55
57
|
gSourceMapper = sourceMapper;
|
|
56
58
|
gIntervalMicros = intervalMicros;
|
|
59
|
+
gV8ProfilerStuckEventLoopDetected = 0;
|
|
60
|
+
gProfiler.start();
|
|
57
61
|
}
|
|
58
62
|
exports.start = start;
|
|
59
|
-
function stop(restart = false) {
|
|
63
|
+
function stop(restart = false, generateLabels) {
|
|
60
64
|
if (!gProfiler) {
|
|
61
65
|
throw new Error('Wall profiler is not started');
|
|
62
66
|
}
|
|
63
67
|
const profile = gProfiler.stop(restart);
|
|
64
|
-
|
|
68
|
+
if (restart) {
|
|
69
|
+
gV8ProfilerStuckEventLoopDetected =
|
|
70
|
+
gProfiler.v8ProfilerStuckEventLoopDetected();
|
|
71
|
+
// Workaround for v8 bug, where profiler event processor thread is stuck in
|
|
72
|
+
// a loop eating 100% CPU, leading to empty profiles.
|
|
73
|
+
// Fully stop and restart the profiler to reset the profile to a valid state.
|
|
74
|
+
if (gV8ProfilerStuckEventLoopDetected > 0) {
|
|
75
|
+
gProfiler.stop(false);
|
|
76
|
+
gProfiler.start();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
gV8ProfilerStuckEventLoopDetected = 0;
|
|
81
|
+
}
|
|
82
|
+
const serialized_profile = (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels);
|
|
65
83
|
if (!restart) {
|
|
66
84
|
gProfiler = undefined;
|
|
67
85
|
gSourceMapper = undefined;
|
|
@@ -69,15 +87,28 @@ function stop(restart = false) {
|
|
|
69
87
|
return serialized_profile;
|
|
70
88
|
}
|
|
71
89
|
exports.stop = stop;
|
|
72
|
-
function
|
|
90
|
+
function getState() {
|
|
73
91
|
if (!gProfiler) {
|
|
74
92
|
throw new Error('Wall profiler is not started');
|
|
75
93
|
}
|
|
76
|
-
gProfiler.
|
|
94
|
+
return gProfiler.state;
|
|
77
95
|
}
|
|
78
|
-
exports.
|
|
96
|
+
exports.getState = getState;
|
|
97
|
+
function setContext(context) {
|
|
98
|
+
if (!gProfiler) {
|
|
99
|
+
throw new Error('Wall profiler is not started');
|
|
100
|
+
}
|
|
101
|
+
gProfiler.context = context;
|
|
102
|
+
}
|
|
103
|
+
exports.setContext = setContext;
|
|
79
104
|
function isStarted() {
|
|
80
105
|
return !!gProfiler;
|
|
81
106
|
}
|
|
82
107
|
exports.isStarted = isStarted;
|
|
108
|
+
// Return 0 if no issue detected, 1 if possible issue, 2 if issue detected for certain
|
|
109
|
+
function v8ProfilerStuckEventLoopDetected() {
|
|
110
|
+
return gV8ProfilerStuckEventLoopDetected;
|
|
111
|
+
}
|
|
112
|
+
exports.v8ProfilerStuckEventLoopDetected = v8ProfilerStuckEventLoopDetected;
|
|
113
|
+
exports.constants = { kSampleCount };
|
|
83
114
|
//# sourceMappingURL=time-profiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-profiler.js","sourceRoot":"","sources":["../../ts/src/time-profiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;AAEH,kDAA0B;AAE1B,6DAA0D;AAE1D,
|
|
1
|
+
{"version":3,"file":"time-profiler.js","sourceRoot":"","sources":["../../ts/src/time-profiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;AAEH,kDAA0B;AAE1B,6DAA0D;AAE1D,qEAGkC;AAGlC,MAAM,EAAC,YAAY,EAAC,GAAG,kCAAiB,CAAC;AAEzC,MAAM,uBAAuB,GA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C,OAAO,iCAAiC,CAAC;AAC3C,CAAC;AAFD,4EAEC;AAEY,QAAA,SAAS,GAAG,EAAC,YAAY,EAAC,CAAC"}
|
package/out/src/v8-types.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface ProfileNode {
|
|
|
30
30
|
}
|
|
31
31
|
export interface TimeProfileNode extends ProfileNode {
|
|
32
32
|
hitCount: number;
|
|
33
|
-
|
|
33
|
+
contexts?: object[];
|
|
34
34
|
}
|
|
35
35
|
export interface AllocationProfileNode extends ProfileNode {
|
|
36
36
|
allocations: Allocation[];
|
|
@@ -39,45 +39,6 @@ export interface Allocation {
|
|
|
39
39
|
sizeBytes: number;
|
|
40
40
|
count: number;
|
|
41
41
|
}
|
|
42
|
-
export interface InitialCpuProfile {
|
|
43
|
-
/** Time in nanoseconds at which profile was stopped. */
|
|
44
|
-
endTime: number;
|
|
45
|
-
samples: CpuProfileSample[];
|
|
46
|
-
/** Time in nanoseconds at which profile was started. */
|
|
47
|
-
startTime: number;
|
|
48
|
-
}
|
|
49
|
-
export interface CpuProfile {
|
|
50
|
-
/** Time in nanoseconds at which profile was stopped. */
|
|
51
|
-
endTime: number;
|
|
52
|
-
topDownRoot: CpuProfileNode;
|
|
53
|
-
/** Time in nanoseconds at which profile was started. */
|
|
54
|
-
startTime: number;
|
|
55
|
-
}
|
|
56
42
|
export interface LabelSet {
|
|
57
43
|
[key: string]: string | number;
|
|
58
44
|
}
|
|
59
|
-
export interface LabelsCpu {
|
|
60
|
-
labels: LabelSet;
|
|
61
|
-
cpuTime: number;
|
|
62
|
-
}
|
|
63
|
-
export interface CpuProfileNode extends ProfileNode {
|
|
64
|
-
hitCount: number;
|
|
65
|
-
cpuTime: number;
|
|
66
|
-
labelSets: LabelsCpu[];
|
|
67
|
-
}
|
|
68
|
-
export interface CpuProfileSample {
|
|
69
|
-
labels: LabelSet;
|
|
70
|
-
locations: CodeEvent[];
|
|
71
|
-
cpuTime: number;
|
|
72
|
-
}
|
|
73
|
-
export interface CodeEvent {
|
|
74
|
-
address: number;
|
|
75
|
-
previousAddress?: number;
|
|
76
|
-
size: number;
|
|
77
|
-
comment?: string;
|
|
78
|
-
functionName?: string;
|
|
79
|
-
scriptName?: string;
|
|
80
|
-
scriptId: number;
|
|
81
|
-
line: number;
|
|
82
|
-
column: number;
|
|
83
|
-
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|