@datadog/pprof 5.0.0-pre-56cf286 → 5.0.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.
Files changed (73) hide show
  1. package/out/src/heap-profiler.d.ts +3 -3
  2. package/out/src/heap-profiler.js.map +1 -1
  3. package/out/src/index.d.ts +2 -0
  4. package/out/src/index.js +1 -0
  5. package/out/src/index.js.map +1 -1
  6. package/out/src/profile-serializer.d.ts +4 -3
  7. package/out/src/profile-serializer.js +58 -7
  8. package/out/src/profile-serializer.js.map +1 -1
  9. package/out/src/time-profiler.d.ts +7 -5
  10. package/out/src/time-profiler.js +31 -16
  11. package/out/src/time-profiler.js.map +1 -1
  12. package/out/src/v8-types.d.ts +16 -0
  13. package/package.json +1 -1
  14. package/prebuilds/darwin-arm64/node-102.node +0 -0
  15. package/prebuilds/darwin-arm64/node-108.node +0 -0
  16. package/prebuilds/darwin-arm64/node-111.node +0 -0
  17. package/prebuilds/darwin-arm64/node-115.node +0 -0
  18. package/prebuilds/darwin-arm64/node-120.node +0 -0
  19. package/prebuilds/darwin-arm64/node-83.node +0 -0
  20. package/prebuilds/darwin-arm64/node-88.node +0 -0
  21. package/prebuilds/darwin-arm64/node-93.node +0 -0
  22. package/prebuilds/darwin-x64/node-102.node +0 -0
  23. package/prebuilds/darwin-x64/node-108.node +0 -0
  24. package/prebuilds/darwin-x64/node-111.node +0 -0
  25. package/prebuilds/darwin-x64/node-115.node +0 -0
  26. package/prebuilds/darwin-x64/node-120.node +0 -0
  27. package/prebuilds/darwin-x64/node-83.node +0 -0
  28. package/prebuilds/darwin-x64/node-88.node +0 -0
  29. package/prebuilds/darwin-x64/node-93.node +0 -0
  30. package/prebuilds/linux-arm/node-102.node +0 -0
  31. package/prebuilds/linux-arm/node-108.node +0 -0
  32. package/prebuilds/linux-arm/node-111.node +0 -0
  33. package/prebuilds/linux-arm/node-115.node +0 -0
  34. package/prebuilds/linux-arm/node-120.node +0 -0
  35. package/prebuilds/linux-arm/node-83.node +0 -0
  36. package/prebuilds/linux-arm/node-88.node +0 -0
  37. package/prebuilds/linux-arm/node-93.node +0 -0
  38. package/prebuilds/linux-arm64/node-102.node +0 -0
  39. package/prebuilds/linux-arm64/node-108.node +0 -0
  40. package/prebuilds/linux-arm64/node-111.node +0 -0
  41. package/prebuilds/linux-arm64/node-115.node +0 -0
  42. package/prebuilds/linux-arm64/node-120.node +0 -0
  43. package/prebuilds/linux-arm64/node-83.node +0 -0
  44. package/prebuilds/linux-arm64/node-88.node +0 -0
  45. package/prebuilds/linux-arm64/node-93.node +0 -0
  46. package/prebuilds/linux-x64/node-102.node +0 -0
  47. package/prebuilds/linux-x64/node-108.node +0 -0
  48. package/prebuilds/linux-x64/node-111.node +0 -0
  49. package/prebuilds/linux-x64/node-115.node +0 -0
  50. package/prebuilds/linux-x64/node-120.node +0 -0
  51. package/prebuilds/linux-x64/node-83.node +0 -0
  52. package/prebuilds/linux-x64/node-88.node +0 -0
  53. package/prebuilds/linux-x64/node-93.node +0 -0
  54. package/prebuilds/linuxmusl-x64/node-102.node +0 -0
  55. package/prebuilds/linuxmusl-x64/node-108.node +0 -0
  56. package/prebuilds/linuxmusl-x64/node-111.node +0 -0
  57. package/prebuilds/linuxmusl-x64/node-115.node +0 -0
  58. package/prebuilds/linuxmusl-x64/node-120.node +0 -0
  59. package/prebuilds/linuxmusl-x64/node-83.node +0 -0
  60. package/prebuilds/linuxmusl-x64/node-88.node +0 -0
  61. package/prebuilds/linuxmusl-x64/node-93.node +0 -0
  62. package/prebuilds/win32-ia32/node-102.node +0 -0
  63. package/prebuilds/win32-ia32/node-83.node +0 -0
  64. package/prebuilds/win32-ia32/node-88.node +0 -0
  65. package/prebuilds/win32-ia32/node-93.node +0 -0
  66. package/prebuilds/win32-x64/node-102.node +0 -0
  67. package/prebuilds/win32-x64/node-108.node +0 -0
  68. package/prebuilds/win32-x64/node-111.node +0 -0
  69. package/prebuilds/win32-x64/node-115.node +0 -0
  70. package/prebuilds/win32-x64/node-120.node +0 -0
  71. package/prebuilds/win32-x64/node-83.node +0 -0
  72. package/prebuilds/win32-x64/node-88.node +0 -0
  73. package/prebuilds/win32-x64/node-93.node +0 -0
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Profile } from 'pprof-format';
17
17
  import { SourceMapper } from './sourcemapper/sourcemapper';
18
- import { AllocationProfileNode, LabelSet } from './v8-types';
18
+ import { AllocationProfileNode, GenerateAllocationLabelsFunction } from './v8-types';
19
19
  export declare function v8Profile(): AllocationProfileNode;
20
20
  /**
21
21
  * Collects a profile and returns it serialized in pprof format.
@@ -24,8 +24,8 @@ export declare function v8Profile(): AllocationProfileNode;
24
24
  * @param ignoreSamplePath
25
25
  * @param sourceMapper
26
26
  */
27
- export declare function profile(ignoreSamplePath?: string, sourceMapper?: SourceMapper, generateLabels?: (node: AllocationProfileNode) => LabelSet): Profile;
28
- export declare function convertProfile(rootNode: AllocationProfileNode, ignoreSamplePath?: string, sourceMapper?: SourceMapper, generateLabels?: (node: AllocationProfileNode) => LabelSet): Profile;
27
+ export declare function profile(ignoreSamplePath?: string, sourceMapper?: SourceMapper, generateLabels?: GenerateAllocationLabelsFunction): Profile;
28
+ export declare function convertProfile(rootNode: AllocationProfileNode, ignoreSamplePath?: string, sourceMapper?: SourceMapper, generateLabels?: GenerateAllocationLabelsFunction): Profile;
29
29
  /**
30
30
  * Starts heap profiling. If heap profiling has already been started with
31
31
  * the same parameters, this is a noop. If heap profiler has already been
@@ -1 +1 @@
1
- {"version":3,"file":"heap-profiler.js","sourceRoot":"","sources":["../../ts/src/heap-profiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,qEAKkC;AAClC,6DAA0D;AAG1D,6DAAiD;AAEjD,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAC1B,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB;;;;;GAKG;AACH,SAAgB,SAAS;IAC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C;AACJ,CAAC;AA5BD,gDA4BC"}
@@ -9,12 +9,14 @@ export declare const time: {
9
9
  profile: typeof timeProfiler.profile;
10
10
  start: typeof timeProfiler.start;
11
11
  stop: typeof timeProfiler.stop;
12
+ getContext: typeof timeProfiler.getContext;
12
13
  setContext: typeof timeProfiler.setContext;
13
14
  isStarted: typeof timeProfiler.isStarted;
14
15
  v8ProfilerStuckEventLoopDetected: typeof timeProfiler.v8ProfilerStuckEventLoopDetected;
15
16
  getState: typeof timeProfiler.getState;
16
17
  constants: {
17
18
  kSampleCount: any;
19
+ NON_JS_THREADS_FUNCTION_NAME: string;
18
20
  };
19
21
  };
20
22
  export declare const heap: {
package/out/src/index.js CHANGED
@@ -56,6 +56,7 @@ exports.time = {
56
56
  profile: timeProfiler.profile,
57
57
  start: timeProfiler.start,
58
58
  stop: timeProfiler.stop,
59
+ getContext: timeProfiler.getContext,
59
60
  setContext: timeProfiler.setContext,
60
61
  isStarted: timeProfiler.isStarted,
61
62
  v8ProfilerStuckEventLoopDetected: timeProfiler.v8ProfilerStuckEventLoopDetected,
@@ -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;AAQhD,qDAAqD;AAA7C,yGAAA,MAAM,OAAA;AAAE,6GAAA,UAAU,OAAA;AAC1B,4DAAyD;AAAjD,4GAAA,YAAY,OAAA;AACpB,mCAAmC;AAA3B,mGAAA,SAAS,OAAA;AACjB,iDAAkD;AAA1C,kHAAA,iBAAiB,OAAA;AAEZ,QAAA,IAAI,GAAG;IAClB,OAAO,EAAE,YAAY,CAAC,OAAO;IAC7B,KAAK,EAAE,YAAY,CAAC,KAAK;IACzB,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,UAAU,EAAE,YAAY,CAAC,UAAU;IACnC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*/
16
16
  import { Profile } from 'pprof-format';
17
17
  import { SourceMapper } from './sourcemapper/sourcemapper';
18
- import { AllocationProfileNode, LabelSet, TimeProfile, TimeProfileNodeContext } from './v8-types';
18
+ import { AllocationProfileNode, GenerateAllocationLabelsFunction, GenerateTimeLabelsFunction, TimeProfile } from './v8-types';
19
+ export declare const NON_JS_THREADS_FUNCTION_NAME = "(non-JS threads)";
19
20
  /**
20
21
  * Converts v8 time profile into into a profile proto.
21
22
  * (https://github.com/google/pprof/blob/master/proto/profile.proto)
@@ -23,7 +24,7 @@ import { AllocationProfileNode, LabelSet, TimeProfile, TimeProfileNodeContext }
23
24
  * @param prof - profile to be converted.
24
25
  * @param intervalMicros - average time (microseconds) between samples.
25
26
  */
26
- export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean, generateLabels?: (context: TimeProfileNodeContext) => LabelSet): Profile;
27
+ export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean, generateLabels?: GenerateTimeLabelsFunction): Profile;
27
28
  /**
28
29
  * Converts v8 heap profile into into a profile proto.
29
30
  * (https://github.com/google/pprof/blob/master/proto/profile.proto)
@@ -34,4 +35,4 @@ export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros:
34
35
  * nanoseconds.
35
36
  * @param intervalBytes - bytes allocated between samples.
36
37
  */
37
- export declare function serializeHeapProfile(prof: AllocationProfileNode, startTimeNanos: number, intervalBytes: number, ignoreSamplesPath?: string, sourceMapper?: SourceMapper, generateLabels?: (node: AllocationProfileNode) => LabelSet): Profile;
38
+ export declare function serializeHeapProfile(prof: AllocationProfileNode, startTimeNanos: number, intervalBytes: number, ignoreSamplesPath?: string, sourceMapper?: SourceMapper, generateLabels?: GenerateAllocationLabelsFunction): Profile;
@@ -15,8 +15,9 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.serializeHeapProfile = exports.serializeTimeProfile = void 0;
18
+ exports.serializeHeapProfile = exports.serializeTimeProfile = exports.NON_JS_THREADS_FUNCTION_NAME = void 0;
19
19
  const pprof_format_1 = require("pprof-format");
20
+ exports.NON_JS_THREADS_FUNCTION_NAME = '(non-JS threads)';
20
21
  function isGeneratedLocation(location) {
21
22
  return (location.column !== undefined &&
22
23
  location.line !== undefined &&
@@ -151,6 +152,16 @@ function createTimeValueType(table) {
151
152
  unit: table.dedup('nanoseconds'),
152
153
  });
153
154
  }
155
+ /**
156
+ * @return value type for cpu samples (type:cpu, units:nanoseconds), and
157
+ * adds strings used in this value type to the table.
158
+ */
159
+ function createCpuValueType(table) {
160
+ return new pprof_format_1.ValueType({
161
+ type: table.dedup('cpu'),
162
+ unit: table.dedup('nanoseconds'),
163
+ });
164
+ }
154
165
  /**
155
166
  * @return value type for object counts (type:objects, units:count), and
156
167
  * adds strings used in this value type to the table.
@@ -198,22 +209,38 @@ function serializeTimeProfile(prof, intervalMicros, sourceMapper, recomputeSampl
198
209
  const intervalNanos = intervalMicros * 1000;
199
210
  const appendTimeEntryToSamples = (entry, samples) => {
200
211
  let unlabelledHits = entry.node.hitCount;
212
+ let unlabelledCpuTime = 0;
201
213
  for (const context of entry.node.contexts || []) {
202
- const labels = generateLabels ? generateLabels(context) : context.context;
214
+ const labels = generateLabels
215
+ ? generateLabels({ node: entry.node, context })
216
+ : context.context;
203
217
  if (Object.keys(labels).length > 0) {
218
+ const values = [1, intervalNanos];
219
+ if (prof.hasCpuTime) {
220
+ values.push(context.cpuTime);
221
+ }
204
222
  const sample = new pprof_format_1.Sample({
205
223
  locationId: entry.stack,
206
- value: [1, intervalNanos],
224
+ value: values,
207
225
  label: buildLabels(labels, stringTable),
208
226
  });
209
227
  samples.push(sample);
210
228
  unlabelledHits--;
211
229
  }
230
+ else if (prof.hasCpuTime) {
231
+ unlabelledCpuTime += context.cpuTime;
232
+ }
212
233
  }
213
- if (unlabelledHits > 0) {
234
+ if (unlabelledHits > 0 || unlabelledCpuTime > 0) {
235
+ const labels = generateLabels ? generateLabels({ node: entry.node }) : {};
236
+ const values = [unlabelledHits, unlabelledHits * intervalNanos];
237
+ if (prof.hasCpuTime) {
238
+ values.push(unlabelledCpuTime);
239
+ }
214
240
  const sample = new pprof_format_1.Sample({
215
241
  locationId: entry.stack,
216
- value: [unlabelledHits, unlabelledHits * intervalNanos],
242
+ value: values,
243
+ label: buildLabels(labels, stringTable),
217
244
  });
218
245
  samples.push(sample);
219
246
  }
@@ -221,13 +248,37 @@ function serializeTimeProfile(prof, intervalMicros, sourceMapper, recomputeSampl
221
248
  const stringTable = new pprof_format_1.StringTable();
222
249
  const sampleValueType = createSampleCountValueType(stringTable);
223
250
  const timeValueType = createTimeValueType(stringTable);
251
+ const sampleTypes = [sampleValueType, timeValueType];
252
+ if (prof.hasCpuTime) {
253
+ const cpuValueType = createCpuValueType(stringTable);
254
+ sampleTypes.push(cpuValueType);
255
+ }
224
256
  const profile = {
225
- sampleType: [sampleValueType, timeValueType],
257
+ sampleType: sampleTypes,
226
258
  timeNanos: Date.now() * 1000 * 1000,
227
259
  durationNanos: (prof.endTime - prof.startTime) * 1000,
228
260
  periodType: timeValueType,
229
261
  period: intervalNanos,
230
262
  };
263
+ if (prof.nonJSThreadsCpuTime) {
264
+ const node = {
265
+ name: exports.NON_JS_THREADS_FUNCTION_NAME,
266
+ scriptName: '',
267
+ scriptId: 0,
268
+ lineNumber: 0,
269
+ columnNumber: 0,
270
+ children: [],
271
+ hitCount: 0,
272
+ contexts: [
273
+ {
274
+ context: {},
275
+ timestamp: BigInt(0),
276
+ cpuTime: prof.nonJSThreadsCpuTime,
277
+ },
278
+ ],
279
+ };
280
+ prof.topDownRoot.children.push(node);
281
+ }
231
282
  serialize(profile, prof.topDownRoot, appendTimeEntryToSamples, stringTable, undefined, sourceMapper);
232
283
  return new pprof_format_1.Profile(profile);
233
284
  }
@@ -267,7 +318,7 @@ function serializeHeapProfile(prof, startTimeNanos, intervalBytes, ignoreSamples
267
318
  const appendHeapEntryToSamples = (entry, samples) => {
268
319
  if (entry.node.allocations.length > 0) {
269
320
  const labels = generateLabels
270
- ? buildLabels(generateLabels(entry.node), stringTable)
321
+ ? buildLabels(generateLabels({ node: entry.node }), stringTable)
271
322
  : [];
272
323
  for (const alloc of entry.node.allocations) {
273
324
  const sample = new pprof_format_1.Sample({
@@ -1 +1 @@
1
- {"version":3,"file":"profile-serializer.js","sourceRoot":"","sources":["../../ts/src/profile-serializer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+CAWsB;AAqCtB,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,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,SAAS,CAChB,OAAqB,EACrB,IAAO,EACP,eAAwC,EACxC,WAAwB,EACxB,iBAA0B,EAC1B,YAA2B;IAE3B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAChD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,MAAM,OAAO,GAAqB,IAAI,CAAC,QAAgB,CAAC,GAAG,CAAC,CAAC,CAAI,EAAE,EAAE,CAAC,CAAC;QACrE,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,EAAE;KACV,CAAC,CAAC,CAAC;IACJ,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACzB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAG,CAAC;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,iBAAiB,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  */
16
16
  import { SourceMapper } from './sourcemapper/sourcemapper';
17
17
  import { getNativeThreadId } from './time-profiler-bindings';
18
- import { LabelSet, TimeProfileNodeContext } from './v8-types';
18
+ import { GenerateTimeLabelsFunction } from './v8-types';
19
19
  type Microseconds = number;
20
20
  type Milliseconds = number;
21
21
  export interface TimeProfilerOptions {
@@ -33,16 +33,18 @@ export interface TimeProfilerOptions {
33
33
  lineNumbers?: boolean;
34
34
  withContexts?: boolean;
35
35
  workaroundV8Bug?: boolean;
36
+ collectCpuTime?: boolean;
36
37
  }
37
- export declare function profile({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, workaroundV8Bug, }: TimeProfilerOptions): Promise<import("pprof-format").Profile>;
38
- export declare function start({ intervalMicros, durationMillis, sourceMapper, lineNumbers, withContexts, workaroundV8Bug, }: TimeProfilerOptions): void;
39
- export declare function stop(restart?: boolean, generateLabels?: (context: TimeProfileNodeContext) => LabelSet): import("pprof-format").Profile;
38
+ export declare function profile(options?: TimeProfilerOptions): Promise<import("pprof-format").Profile>;
39
+ export declare function start(options?: TimeProfilerOptions): void;
40
+ export declare function stop(restart?: boolean, generateLabels?: GenerateTimeLabelsFunction): import("pprof-format").Profile;
40
41
  export declare function getState(): any;
41
42
  export declare function setContext(context?: object): void;
43
+ export declare function getContext(): any;
42
44
  export declare function isStarted(): boolean;
43
45
  export declare function v8ProfilerStuckEventLoopDetected(): number;
44
46
  export declare const constants: {
45
47
  kSampleCount: any;
48
+ NON_JS_THREADS_FUNCTION_NAME: string;
46
49
  };
47
- export { LabelSet };
48
50
  export { getNativeThreadId };
@@ -18,11 +18,12 @@ 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.getNativeThreadId = exports.constants = exports.v8ProfilerStuckEventLoopDetected = exports.isStarted = exports.setContext = exports.getState = exports.stop = exports.start = exports.profile = void 0;
21
+ exports.getNativeThreadId = exports.constants = exports.v8ProfilerStuckEventLoopDetected = exports.isStarted = exports.getContext = 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
25
  Object.defineProperty(exports, "getNativeThreadId", { enumerable: true, get: function () { return time_profiler_bindings_1.getNativeThreadId; } });
26
+ const node_worker_threads_1 = require("node:worker_threads");
26
27
  const { kSampleCount } = time_profiler_bindings_1.constants;
27
28
  const DEFAULT_INTERVAL_MICROS = 1000;
28
29
  const DEFAULT_DURATION_MILLIS = 60000;
@@ -36,29 +37,36 @@ process.once('exit', () => {
36
37
  if (isStarted())
37
38
  stop();
38
39
  });
39
- async function profile({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, workaroundV8Bug = true, }) {
40
- start({
41
- intervalMicros,
42
- durationMillis,
43
- sourceMapper,
44
- lineNumbers,
45
- withContexts,
46
- workaroundV8Bug,
47
- });
48
- await (0, delay_1.default)(durationMillis);
40
+ const DEFAULT_OPTIONS = {
41
+ durationMillis: DEFAULT_DURATION_MILLIS,
42
+ intervalMicros: DEFAULT_INTERVAL_MICROS,
43
+ lineNumbers: false,
44
+ withContexts: false,
45
+ workaroundV8Bug: true,
46
+ collectCpuTime: false,
47
+ };
48
+ async function profile(options = {}) {
49
+ options = { ...DEFAULT_OPTIONS, ...options };
50
+ start(options);
51
+ await (0, delay_1.default)(options.durationMillis);
49
52
  return stop();
50
53
  }
51
54
  exports.profile = profile;
52
55
  // Temporarily retained for backwards compatibility with older tracer
53
- function start({ intervalMicros = DEFAULT_INTERVAL_MICROS, durationMillis = DEFAULT_DURATION_MILLIS, sourceMapper, lineNumbers = false, withContexts = false, workaroundV8Bug = true, }) {
56
+ function start(options = {}) {
57
+ options = { ...DEFAULT_OPTIONS, ...options };
54
58
  if (gProfiler) {
55
59
  throw new Error('Wall profiler is already started');
56
60
  }
57
- gProfiler = new time_profiler_bindings_1.TimeProfiler(intervalMicros, durationMillis * 1000, lineNumbers, withContexts, workaroundV8Bug);
58
- gSourceMapper = sourceMapper;
59
- gIntervalMicros = intervalMicros;
61
+ gProfiler = new time_profiler_bindings_1.TimeProfiler({ ...options, isMainThread: node_worker_threads_1.isMainThread });
62
+ gSourceMapper = options.sourceMapper;
63
+ gIntervalMicros = options.intervalMicros;
60
64
  gV8ProfilerStuckEventLoopDetected = 0;
61
65
  gProfiler.start();
66
+ // If contexts are enabled, set an initial empty context
67
+ if (options.withContexts) {
68
+ setContext({});
69
+ }
62
70
  }
63
71
  exports.start = start;
64
72
  function stop(restart = false, generateLabels) {
@@ -102,6 +110,13 @@ function setContext(context) {
102
110
  gProfiler.context = context;
103
111
  }
104
112
  exports.setContext = setContext;
113
+ function getContext() {
114
+ if (!gProfiler) {
115
+ throw new Error('Wall profiler is not started');
116
+ }
117
+ return gProfiler.context;
118
+ }
119
+ exports.getContext = getContext;
105
120
  function isStarted() {
106
121
  return !!gProfiler;
107
122
  }
@@ -111,5 +126,5 @@ function v8ProfilerStuckEventLoopDetected() {
111
126
  return gV8ProfilerStuckEventLoopDetected;
112
127
  }
113
128
  exports.v8ProfilerStuckEventLoopDetected = v8ProfilerStuckEventLoopDetected;
114
- exports.constants = { kSampleCount };
129
+ exports.constants = { kSampleCount, NON_JS_THREADS_FUNCTION_NAME: profile_serializer_1.NON_JS_THREADS_FUNCTION_NAME };
115
130
  //# 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,qEAIkC;AAoJ1B,kGAtJN,0CAAiB,OAsJM;AAjJzB,MAAM,EAAC,YAAY,EAAC,GAAG,kCAA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;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAnCD,oBAmCC;AAED,SAAgB,QAAQ;IACtB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACjD;IACD,OAAO,SAAS,CAAC,KAAK,CAAC;AACzB,CAAC;AALD,4BAKC;AAED,SAAgB,UAAU,CAAC,OAAgB;IACzC,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACjD;IACD,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;AAC9B,CAAC;AALD,gCAKC;AAED,SAAgB,UAAU;IACxB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACjD;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC3B,CAAC;AALD,gCAKC;AAED,SAAgB,SAAS;IACvB,OAAO,CAAC,CAAC,SAAS,CAAC;AACrB,CAAC;AAFD,8BAEC;AAED,sFAAsF;AACtF,SAAgB,gCAAgC;IAC9C,OAAO,iCAAiC,CAAC;AAC3C,CAAC;AAFD,4EAEC;AAEY,QAAA,SAAS,GAAG,EAAC,YAAY,EAAE,4BAA4B,EAA5B,iDAA4B,EAAC,CAAC"}
@@ -19,6 +19,9 @@ export interface TimeProfile {
19
19
  topDownRoot: TimeProfileNode;
20
20
  /** Time in nanoseconds at which profile was started. */
21
21
  startTime: number;
22
+ hasCpuTime?: boolean;
23
+ /** CPU time of non-JS threads, only reported for the main worker thread */
24
+ nonJSThreadsCpuTime?: number;
22
25
  }
23
26
  export interface ProfileNode {
24
27
  name?: string;
@@ -31,6 +34,7 @@ export interface ProfileNode {
31
34
  export interface TimeProfileNodeContext {
32
35
  context: object;
33
36
  timestamp: bigint;
37
+ cpuTime: number;
34
38
  }
35
39
  export interface TimeProfileNode extends ProfileNode {
36
40
  hitCount: number;
@@ -46,3 +50,15 @@ export interface Allocation {
46
50
  export interface LabelSet {
47
51
  [key: string]: string | number;
48
52
  }
53
+ export interface GenerateAllocationLabelsFunction {
54
+ ({ node }: {
55
+ node: AllocationProfileNode;
56
+ }): LabelSet;
57
+ }
58
+ export interface GenerateTimeLabelsArgs {
59
+ node: TimeProfileNode;
60
+ context?: TimeProfileNodeContext;
61
+ }
62
+ export interface GenerateTimeLabelsFunction {
63
+ (args: GenerateTimeLabelsArgs): LabelSet;
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/pprof",
3
- "version": "5.0.0-pre-56cf286",
3
+ "version": "5.0.0",
4
4
  "description": "pprof support for Node.js",
5
5
  "repository": "datadog/pprof-nodejs",
6
6
  "main": "out/src/index.js",
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