@ohos-ports/datadog-pprof 5.17.0-1

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 (100) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +112 -0
  3. package/out/src/heap-profiler-bindings.d.ts +22 -0
  4. package/out/src/heap-profiler-bindings.js +75 -0
  5. package/out/src/heap-profiler-bindings.js.map +1 -0
  6. package/out/src/heap-profiler.d.ts +98 -0
  7. package/out/src/heap-profiler.js +219 -0
  8. package/out/src/heap-profiler.js.map +1 -0
  9. package/out/src/index.d.ts +46 -0
  10. package/out/src/index.js +111 -0
  11. package/out/src/index.js.map +1 -0
  12. package/out/src/logger.d.ts +18 -0
  13. package/out/src/logger.js +36 -0
  14. package/out/src/logger.js.map +1 -0
  15. package/out/src/otel-thread-ctx.d.ts +85 -0
  16. package/out/src/otel-thread-ctx.js +176 -0
  17. package/out/src/otel-thread-ctx.js.map +1 -0
  18. package/out/src/profile-encoder.d.ts +18 -0
  19. package/out/src/profile-encoder.js +29 -0
  20. package/out/src/profile-encoder.js.map +1 -0
  21. package/out/src/profile-serializer.d.ts +56 -0
  22. package/out/src/profile-serializer.js +509 -0
  23. package/out/src/profile-serializer.js.map +1 -0
  24. package/out/src/sourcemapper/sourcemapper.d.ts +123 -0
  25. package/out/src/sourcemapper/sourcemapper.js +528 -0
  26. package/out/src/sourcemapper/sourcemapper.js.map +1 -0
  27. package/out/src/time-profiler-bindings.d.ts +3 -0
  28. package/out/src/time-profiler-bindings.js +25 -0
  29. package/out/src/time-profiler-bindings.js.map +1 -0
  30. package/out/src/time-profiler.d.ts +72 -0
  31. package/out/src/time-profiler.js +202 -0
  32. package/out/src/time-profiler.js.map +1 -0
  33. package/out/src/v8-types.d.ts +82 -0
  34. package/out/src/v8-types.js +18 -0
  35. package/out/src/v8-types.js.map +1 -0
  36. package/package.json +112 -0
  37. package/prebuilds/darwin-arm64/dd_pprof.node.abi108.node +0 -0
  38. package/prebuilds/darwin-arm64/dd_pprof.node.abi111.node +0 -0
  39. package/prebuilds/darwin-arm64/dd_pprof.node.abi115.node +0 -0
  40. package/prebuilds/darwin-arm64/dd_pprof.node.abi120.node +0 -0
  41. package/prebuilds/darwin-arm64/dd_pprof.node.abi127.node +0 -0
  42. package/prebuilds/darwin-arm64/dd_pprof.node.abi131.node +0 -0
  43. package/prebuilds/darwin-arm64/dd_pprof.node.abi137.node +0 -0
  44. package/prebuilds/darwin-arm64/dd_pprof.node.abi141.node +0 -0
  45. package/prebuilds/darwin-arm64/dd_pprof.node.abi147.node +0 -0
  46. package/prebuilds/darwin-x64/dd_pprof.node.abi108.node +0 -0
  47. package/prebuilds/darwin-x64/dd_pprof.node.abi111.node +0 -0
  48. package/prebuilds/darwin-x64/dd_pprof.node.abi115.node +0 -0
  49. package/prebuilds/darwin-x64/dd_pprof.node.abi120.node +0 -0
  50. package/prebuilds/darwin-x64/dd_pprof.node.abi127.node +0 -0
  51. package/prebuilds/darwin-x64/dd_pprof.node.abi131.node +0 -0
  52. package/prebuilds/darwin-x64/dd_pprof.node.abi137.node +0 -0
  53. package/prebuilds/darwin-x64/dd_pprof.node.abi141.node +0 -0
  54. package/prebuilds/darwin-x64/dd_pprof.node.abi147.node +0 -0
  55. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi108.node +0 -0
  56. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi111.node +0 -0
  57. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi115.node +0 -0
  58. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi120.node +0 -0
  59. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi127.node +0 -0
  60. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi131.node +0 -0
  61. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi137.node +0 -0
  62. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi141.node +0 -0
  63. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi147.node +0 -0
  64. package/prebuilds/linux-arm64/dd_pprof.node.abi108.node +0 -0
  65. package/prebuilds/linux-arm64/dd_pprof.node.abi111.node +0 -0
  66. package/prebuilds/linux-arm64/dd_pprof.node.abi115.node +0 -0
  67. package/prebuilds/linux-arm64/dd_pprof.node.abi120.node +0 -0
  68. package/prebuilds/linux-arm64/dd_pprof.node.abi127.node +0 -0
  69. package/prebuilds/linux-arm64/dd_pprof.node.abi131.node +0 -0
  70. package/prebuilds/linux-arm64/dd_pprof.node.abi137.node +0 -0
  71. package/prebuilds/linux-arm64/dd_pprof.node.abi141.node +0 -0
  72. package/prebuilds/linux-arm64/dd_pprof.node.abi147.node +0 -0
  73. package/prebuilds/linux-x64/dd_pprof.musl.node.abi108.node +0 -0
  74. package/prebuilds/linux-x64/dd_pprof.musl.node.abi111.node +0 -0
  75. package/prebuilds/linux-x64/dd_pprof.musl.node.abi115.node +0 -0
  76. package/prebuilds/linux-x64/dd_pprof.musl.node.abi120.node +0 -0
  77. package/prebuilds/linux-x64/dd_pprof.musl.node.abi127.node +0 -0
  78. package/prebuilds/linux-x64/dd_pprof.musl.node.abi131.node +0 -0
  79. package/prebuilds/linux-x64/dd_pprof.musl.node.abi137.node +0 -0
  80. package/prebuilds/linux-x64/dd_pprof.musl.node.abi141.node +0 -0
  81. package/prebuilds/linux-x64/dd_pprof.musl.node.abi147.node +0 -0
  82. package/prebuilds/linux-x64/dd_pprof.node.abi108.node +0 -0
  83. package/prebuilds/linux-x64/dd_pprof.node.abi111.node +0 -0
  84. package/prebuilds/linux-x64/dd_pprof.node.abi115.node +0 -0
  85. package/prebuilds/linux-x64/dd_pprof.node.abi120.node +0 -0
  86. package/prebuilds/linux-x64/dd_pprof.node.abi127.node +0 -0
  87. package/prebuilds/linux-x64/dd_pprof.node.abi131.node +0 -0
  88. package/prebuilds/linux-x64/dd_pprof.node.abi137.node +0 -0
  89. package/prebuilds/linux-x64/dd_pprof.node.abi141.node +0 -0
  90. package/prebuilds/linux-x64/dd_pprof.node.abi147.node +0 -0
  91. package/prebuilds/openharmony-arm64/dd_pprof.node.abi147.node +0 -0
  92. package/prebuilds/win32-x64/dd_pprof.node.abi108.node +0 -0
  93. package/prebuilds/win32-x64/dd_pprof.node.abi111.node +0 -0
  94. package/prebuilds/win32-x64/dd_pprof.node.abi115.node +0 -0
  95. package/prebuilds/win32-x64/dd_pprof.node.abi120.node +0 -0
  96. package/prebuilds/win32-x64/dd_pprof.node.abi127.node +0 -0
  97. package/prebuilds/win32-x64/dd_pprof.node.abi131.node +0 -0
  98. package/prebuilds/win32-x64/dd_pprof.node.abi137.node +0 -0
  99. package/prebuilds/win32-x64/dd_pprof.node.abi141.node +0 -0
  100. package/prebuilds/win32-x64/dd_pprof.node.abi147.node +0 -0
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2017 Google Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getNativeThreadId = exports.constants = void 0;
19
+ exports.profile = profile;
20
+ exports.profileV2 = profileV2;
21
+ exports.start = start;
22
+ exports.stop = stop;
23
+ exports.stopV2 = stopV2;
24
+ exports.getState = getState;
25
+ exports.setContext = setContext;
26
+ exports.runWithContext = runWithContext;
27
+ exports.getContext = getContext;
28
+ exports.getMetrics = getMetrics;
29
+ exports.isStarted = isStarted;
30
+ exports.v8ProfilerStuckEventLoopDetected = v8ProfilerStuckEventLoopDetected;
31
+ const promises_1 = require("timers/promises");
32
+ const profile_serializer_1 = require("./profile-serializer");
33
+ const time_profiler_bindings_1 = require("./time-profiler-bindings");
34
+ Object.defineProperty(exports, "getNativeThreadId", { enumerable: true, get: function () { return time_profiler_bindings_1.getNativeThreadId; } });
35
+ const worker_threads_1 = require("worker_threads");
36
+ const async_hooks_1 = require("async_hooks");
37
+ const { kSampleCount } = time_profiler_bindings_1.constants;
38
+ const DEFAULT_INTERVAL_MICROS = 1000;
39
+ const DEFAULT_DURATION_MILLIS = 60000;
40
+ let gProfiler;
41
+ let gStore;
42
+ let gSourceMapper;
43
+ let gIntervalMicros;
44
+ let gColumnNumbers = profile_serializer_1.DEFAULT_COLUMN_NUMBERS;
45
+ let gV8ProfilerStuckEventLoopDetected = 0;
46
+ function handleStopRestart() {
47
+ if (!gProfiler) {
48
+ return;
49
+ }
50
+ gV8ProfilerStuckEventLoopDetected =
51
+ gProfiler.v8ProfilerStuckEventLoopDetected();
52
+ // Workaround for v8 bug, where profiler event processor thread is stuck in
53
+ // a loop eating 100% CPU, leading to empty profiles.
54
+ // Fully stop and restart the profiler to reset the profile to a valid state.
55
+ if (gV8ProfilerStuckEventLoopDetected > 0) {
56
+ gProfiler.stop(false);
57
+ gProfiler.start();
58
+ }
59
+ }
60
+ function handleStopNoRestart() {
61
+ gV8ProfilerStuckEventLoopDetected = 0;
62
+ gProfiler?.dispose();
63
+ gProfiler = undefined;
64
+ gSourceMapper = undefined;
65
+ if (gStore !== undefined) {
66
+ gStore.disable();
67
+ gStore = undefined;
68
+ }
69
+ }
70
+ /** Make sure to stop profiler before node shuts down, otherwise profiling
71
+ * signal might cause a crash if it occurs during shutdown */
72
+ process.once('exit', () => {
73
+ if (isStarted())
74
+ stop();
75
+ });
76
+ const DEFAULT_OPTIONS = {
77
+ durationMillis: DEFAULT_DURATION_MILLIS,
78
+ intervalMicros: DEFAULT_INTERVAL_MICROS,
79
+ lineNumbers: false,
80
+ withContexts: false,
81
+ workaroundV8Bug: true,
82
+ collectCpuTime: false,
83
+ collectAsyncId: false,
84
+ useCPED: false,
85
+ columnNumbers: profile_serializer_1.DEFAULT_COLUMN_NUMBERS,
86
+ };
87
+ async function profile(options = {}) {
88
+ options = { ...DEFAULT_OPTIONS, ...options };
89
+ start(options);
90
+ await (0, promises_1.setTimeout)(options.durationMillis);
91
+ return stop();
92
+ }
93
+ async function profileV2(options = {}) {
94
+ options = { ...DEFAULT_OPTIONS, ...options };
95
+ start(options);
96
+ await (0, promises_1.setTimeout)(options.durationMillis);
97
+ return stopV2();
98
+ }
99
+ // Temporarily retained for backwards compatibility with older tracer
100
+ function start(options = {}) {
101
+ options = { ...DEFAULT_OPTIONS, ...options };
102
+ if (gProfiler) {
103
+ throw new Error('Wall profiler is already started');
104
+ }
105
+ const store = options.useCPED === true ? new async_hooks_1.AsyncLocalStorage() : undefined;
106
+ gProfiler = new time_profiler_bindings_1.TimeProfiler({ ...options, CPEDKey: store, isMainThread: worker_threads_1.isMainThread });
107
+ gSourceMapper = options.sourceMapper;
108
+ gIntervalMicros = options.intervalMicros;
109
+ gColumnNumbers = options.columnNumbers ?? profile_serializer_1.DEFAULT_COLUMN_NUMBERS;
110
+ gV8ProfilerStuckEventLoopDetected = 0;
111
+ gProfiler.start();
112
+ gStore = store;
113
+ // If contexts are enabled without using CPED, set an initial empty context
114
+ if (options.withContexts && !options.useCPED) {
115
+ setContext({});
116
+ }
117
+ }
118
+ function stop(restart = false, generateLabels, lowCardinalityLabels) {
119
+ if (!gProfiler) {
120
+ throw new Error('Wall profiler is not started');
121
+ }
122
+ const profile = gProfiler.stop(restart);
123
+ if (restart) {
124
+ // Restart the profiler *before* serializing so the cost of serialization is
125
+ // captured in the next profile. handleStopRestart() does not dispose of the
126
+ // source mapper, so the source-map resolution below is unaffected.
127
+ handleStopRestart();
128
+ }
129
+ const serializedProfile = (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels, lowCardinalityLabels, gColumnNumbers);
130
+ if (!restart) {
131
+ // Tear down *after* serializing: handleStopNoRestart() clears gSourceMapper
132
+ // (and disposes gProfiler), so serializing afterwards would drop source-map
133
+ // resolution and leave transpiled frames pointing at the generated files
134
+ // instead of the original sources.
135
+ handleStopNoRestart();
136
+ }
137
+ return serializedProfile;
138
+ }
139
+ /**
140
+ * Same as stop() but uses the lazy callback path: serialization happens inside
141
+ * a native callback while the V8 profile is still alive.
142
+ * This reduces memory overhead.
143
+ */
144
+ function stopV2(restart = false, generateLabels, lowCardinalityLabels) {
145
+ if (!gProfiler) {
146
+ throw new Error('Wall profiler is not started');
147
+ }
148
+ const serializedProfile = gProfiler.stopAndCollect(restart, (profile) => (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels, lowCardinalityLabels, gColumnNumbers));
149
+ if (restart) {
150
+ handleStopRestart();
151
+ }
152
+ else {
153
+ handleStopNoRestart();
154
+ }
155
+ return serializedProfile;
156
+ }
157
+ function getState() {
158
+ if (!gProfiler) {
159
+ throw new Error('Wall profiler is not started');
160
+ }
161
+ return gProfiler.state;
162
+ }
163
+ function setContext(context) {
164
+ if (!gProfiler) {
165
+ throw new Error('Wall profiler is not started');
166
+ }
167
+ gProfiler.context = context;
168
+ }
169
+ function runWithContext(context, f, ...args) {
170
+ if (!gProfiler) {
171
+ throw new Error('Wall profiler is not started');
172
+ }
173
+ else if (!gStore) {
174
+ throw new Error('Can only use runWithContext with AsyncContextFrame');
175
+ }
176
+ return gStore.run(gProfiler.createContextHolder(context), f, ...args);
177
+ }
178
+ function getContext() {
179
+ if (!gProfiler) {
180
+ throw new Error('Wall profiler is not started');
181
+ }
182
+ return gProfiler.context;
183
+ }
184
+ function getMetrics() {
185
+ if (!gProfiler) {
186
+ throw new Error('Wall profiler is not started');
187
+ }
188
+ return gProfiler.metrics;
189
+ }
190
+ function isStarted() {
191
+ return !!gProfiler;
192
+ }
193
+ // Return 0 if no issue detected, 1 if possible issue, 2 if issue detected for certain
194
+ function v8ProfilerStuckEventLoopDetected() {
195
+ return gV8ProfilerStuckEventLoopDetected;
196
+ }
197
+ exports.constants = {
198
+ kSampleCount,
199
+ GARBAGE_COLLECTION_FUNCTION_NAME: profile_serializer_1.GARBAGE_COLLECTION_FUNCTION_NAME,
200
+ NON_JS_THREADS_FUNCTION_NAME: profile_serializer_1.NON_JS_THREADS_FUNCTION_NAME,
201
+ };
202
+ //# sourceMappingURL=time-profiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-profiler.js","sourceRoot":"","sources":["../../ts/src/time-profiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAyHH,0BAOC;AAED,8BAKC;AAGD,sBAoBC;AAED,oBAqCC;AAOD,wBA4BC;AAED,4BAKC;AAED,gCAKC;AAED,wCAWC;AAED,gCAKC;AAED,gCAKC;AAED,8BAEC;AAGD,4EAEC;AAxRD,8CAA2C;AAG3C,6DAM8B;AAE9B,qEAIkC;AAgR1B,kGAlRN,0CAAiB,OAkRM;AA1QzB,mDAA4C;AAC5C,6CAA8C;AAC9C,MAAM,EAAC,YAAY,EAAC,GAAG,kCAAiB,CAAC;AAEzC,MAAM,uBAAuB,GAAiB,IAAI,CAAC;AACnD,MAAM,uBAAuB,GAAiB,KAAK,CAAC;AAYpD,IAAI,SAAyC,CAAC;AAC9C,IAAI,MAA8C,CAAC;AACnD,IAAI,aAAuC,CAAC;AAC5C,IAAI,eAA6B,CAAC;AAClC,IAAI,cAAc,GAAkB,2CAAsB,CAAC;AAC3D,IAAI,iCAAiC,GAAG,CAAC,CAAC;AAE1C,SAAS,iBAAiB;IACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IACD,iCAAiC;QAC/B,SAAS,CAAC,gCAAgC,EAAE,CAAC;IAC/C,2EAA2E;IAC3E,qDAAqD;IACrD,6EAA6E;IAC7E,IAAI,iCAAiC,GAAG,CAAC,EAAE,CAAC;QAC1C,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,SAAS,CAAC,KAAK,EAAE,CAAC;IACpB,CA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MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;SAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,SAAgB,UAAU;IACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC3B,CAAC;AAED,SAAgB,UAAU;IACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,SAAS,CAAC,OAA8B,CAAC;AAClD,CAAC;AAED,SAAgB,SAAS;IACvB,OAAO,CAAC,CAAC,SAAS,CAAC;AACrB,CAAC;AAED,sFAAsF;AACtF,SAAgB,gCAAgC;IAC9C,OAAO,iCAAiC,CAAC;AAC3C,CAAC;AAEY,QAAA,SAAS,GAAG;IACvB,YAAY;IACZ,gCAAgC,EAAhC,qDAAgC;IAChC,4BAA4B,EAA5B,iDAA4B;CAC7B,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright 2017 Google Inc. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface TimeProfile {
17
+ /** Time in nanoseconds at which profile was stopped. */
18
+ endTime: number;
19
+ topDownRoot: TimeProfileNode;
20
+ /** Time in nanoseconds at which profile was started. */
21
+ startTime: number;
22
+ hasCpuTime?: boolean;
23
+ /** CPU time of non-JS threads, only reported for the main worker thread */
24
+ nonJSThreadsCpuTime?: number;
25
+ /** Computed in C++ to avoid a full JS tree traversal. */
26
+ totalHitCount?: number;
27
+ }
28
+ export interface ProfileNode {
29
+ name?: string;
30
+ scriptName: string;
31
+ scriptId?: number;
32
+ lineNumber?: number;
33
+ columnNumber?: number;
34
+ children: ProfileNode[];
35
+ }
36
+ export interface TimeProfileNodeContext {
37
+ context?: object;
38
+ timestamp: bigint;
39
+ cpuTime?: number;
40
+ asyncId?: number;
41
+ }
42
+ export interface TimeProfileNode extends ProfileNode {
43
+ hitCount: number;
44
+ contexts?: TimeProfileNodeContext[];
45
+ }
46
+ export interface AllocationProfileNode extends ProfileNode {
47
+ allocations: Allocation[];
48
+ children: AllocationProfileNode[];
49
+ }
50
+ export interface Allocation {
51
+ sizeBytes: number;
52
+ count: number;
53
+ }
54
+ export interface AllocationWithStats {
55
+ inuseObjects: number;
56
+ inuseSpaceBytes: number;
57
+ allocObjects: number;
58
+ allocSpaceBytes: number;
59
+ }
60
+ export interface AllocationProfileNodeWithStats extends ProfileNode {
61
+ allocations: AllocationWithStats[];
62
+ children: AllocationProfileNodeWithStats[];
63
+ }
64
+ export interface LabelSet {
65
+ [key: string]: string | number;
66
+ }
67
+ export interface GenerateAllocationLabelsFunction {
68
+ ({ node }: {
69
+ node: AllocationProfileNode;
70
+ }): LabelSet;
71
+ }
72
+ export interface GenerateTimeLabelsArgs {
73
+ node: TimeProfileNode;
74
+ context?: TimeProfileNodeContext;
75
+ }
76
+ export interface GenerateTimeLabelsFunction {
77
+ (args: GenerateTimeLabelsArgs): LabelSet;
78
+ }
79
+ export interface TimeProfilerMetrics {
80
+ usedAsyncContextCount: number;
81
+ totalAsyncContextCount: number;
82
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2017 Google Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ //# sourceMappingURL=v8-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v8-types.js","sourceRoot":"","sources":["../../ts/src/v8-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
package/package.json ADDED
@@ -0,0 +1,112 @@
1
+ {
2
+ "name": "@ohos-ports/datadog-pprof",
3
+ "version": "5.17.0-1",
4
+ "description": "pprof support for Node.js — OpenHarmony (OHOS) port, adding an openharmony-arm64 node-gyp-build prebuild alongside upstream's existing platforms.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
8
+ "directory": "ports/pprof/5.17.0"
9
+ },
10
+ "main": "out/src/index.js",
11
+ "types": "out/src/index.d.ts",
12
+ "gypfile": false,
13
+ "scripts": {
14
+ "build:asan": "node-gyp configure build --jobs=max --address_sanitizer",
15
+ "build:tsan": "node-gyp configure build --jobs=max --thread_sanitizer",
16
+ "build": "node-gyp configure build --jobs=max",
17
+ "codecov": "nyc report --reporter=json && codecov -f coverage/*.json",
18
+ "compile": "tsc -p .",
19
+ "fix": "gts fix",
20
+ "format": "clang-format --style file -i --glob='bindings/**/*.{h,hh,cpp,cc}'",
21
+ "lint": "jsgl --local . && gts check && clang-format --style file -n -Werror --glob='bindings/**/*.{h,hh,cpp,cc}'",
22
+ "prepare": "npm run compile && npm run rebuild",
23
+ "pretest:js-asan": "npm run compile && npm run build:asan",
24
+ "pretest:js-tsan": "npm run compile && npm run build:tsan",
25
+ "pretest:js-valgrind": "npm run pretest",
26
+ "pretest": "npm run compile",
27
+ "rebuild": "node-gyp rebuild --jobs=max",
28
+ "test:cpp": "node scripts/cctest.js",
29
+ "test:js-asan": "LSAN_OPTIONS='suppressions=./suppressions/lsan_suppr.txt' LD_PRELOAD=`gcc -print-file-name=libasan.so` mocha out/test/test-*.js",
30
+ "test:js-tsan": "LD_PRELOAD=`gcc -print-file-name=libtsan.so` mocha out/test/test-*.js",
31
+ "test:js-valgrind": "valgrind --leak-check=full mocha out/test/test-*.js",
32
+ "test:js": "nyc mocha -r source-map-support/register out/test/test-*.js",
33
+ "test": "npm run test:js",
34
+ "test:docker": "./scripts/docker/run-in-docker.sh"
35
+ },
36
+ "author": {
37
+ "name": "Google Inc."
38
+ },
39
+ "license": "Apache-2.0",
40
+ "dependencies": {
41
+ "node-gyp-build": "^4.8.4",
42
+ "pprof-format": "^2.2.1",
43
+ "source-map": "^0.8.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/mocha": "^10.0.1",
47
+ "@types/node": "26.1.1",
48
+ "@types/semver": "^7.5.8",
49
+ "@types/sinon": "^22.0.0",
50
+ "@types/tmp": "^0.2.3",
51
+ "clang-format": "^1.8.0",
52
+ "codecov": "^3.8.3",
53
+ "deep-copy": "^1.4.2",
54
+ "eslint-plugin-n": "^18.2.2",
55
+ "gts": "^7.0.0",
56
+ "js-green-licenses": "^4.0.0",
57
+ "mocha": "^11.7.6",
58
+ "nan": "^2.28.0",
59
+ "nyc": "^18.0.0",
60
+ "semver": "^7.8.5",
61
+ "sinon": "^22.1.0",
62
+ "source-map-support": "^0.5.21",
63
+ "tmp": "0.2.7",
64
+ "typescript": "^6.0.3"
65
+ },
66
+ "files": [
67
+ "out/src",
68
+ "out/third_party/cloud-debug-nodejs",
69
+ "proto",
70
+ "package-lock.json",
71
+ "package.json",
72
+ "README.md",
73
+ "scripts/preinstall.js",
74
+ "scripts/require-package-json.js",
75
+ "scripts/should_rebuild.js",
76
+ "prebuilds"
77
+ ],
78
+ "nyc": {
79
+ "exclude": [
80
+ "proto",
81
+ "out/test",
82
+ "out/system-test"
83
+ ]
84
+ },
85
+ "engines": {
86
+ "node": ">=16"
87
+ },
88
+ "overrides": {
89
+ "nyc": {
90
+ "brace-expansion": "^5.0.6",
91
+ "js-yaml": "^3.14.2"
92
+ },
93
+ "@typescript-eslint/typescript-estree": {
94
+ "brace-expansion": "^5.0.6"
95
+ },
96
+ "istanbul-lib-processinfo": {
97
+ "brace-expansion": "^5.0.6"
98
+ },
99
+ "spawn-wrap": {
100
+ "brace-expansion": "^5.0.6"
101
+ },
102
+ "test-exclude": {
103
+ "brace-expansion": "^5.0.6"
104
+ },
105
+ "codecov": {
106
+ "js-yaml": "^3.14.2"
107
+ },
108
+ "mocha": {
109
+ "minimatch": "^9.0.9"
110
+ }
111
+ }
112
+ }