@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.
- package/LICENSE +202 -0
- package/README.md +112 -0
- package/out/src/heap-profiler-bindings.d.ts +22 -0
- package/out/src/heap-profiler-bindings.js +75 -0
- package/out/src/heap-profiler-bindings.js.map +1 -0
- package/out/src/heap-profiler.d.ts +98 -0
- package/out/src/heap-profiler.js +219 -0
- package/out/src/heap-profiler.js.map +1 -0
- package/out/src/index.d.ts +46 -0
- package/out/src/index.js +111 -0
- package/out/src/index.js.map +1 -0
- package/out/src/logger.d.ts +18 -0
- package/out/src/logger.js +36 -0
- package/out/src/logger.js.map +1 -0
- package/out/src/otel-thread-ctx.d.ts +85 -0
- package/out/src/otel-thread-ctx.js +176 -0
- package/out/src/otel-thread-ctx.js.map +1 -0
- package/out/src/profile-encoder.d.ts +18 -0
- package/out/src/profile-encoder.js +29 -0
- package/out/src/profile-encoder.js.map +1 -0
- package/out/src/profile-serializer.d.ts +56 -0
- package/out/src/profile-serializer.js +509 -0
- package/out/src/profile-serializer.js.map +1 -0
- package/out/src/sourcemapper/sourcemapper.d.ts +123 -0
- package/out/src/sourcemapper/sourcemapper.js +528 -0
- package/out/src/sourcemapper/sourcemapper.js.map +1 -0
- package/out/src/time-profiler-bindings.d.ts +3 -0
- package/out/src/time-profiler-bindings.js +25 -0
- package/out/src/time-profiler-bindings.js.map +1 -0
- package/out/src/time-profiler.d.ts +72 -0
- package/out/src/time-profiler.js +202 -0
- package/out/src/time-profiler.js.map +1 -0
- package/out/src/v8-types.d.ts +82 -0
- package/out/src/v8-types.js +18 -0
- package/out/src/v8-types.js.map +1 -0
- package/package.json +112 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi108.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi111.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi115.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi120.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi127.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi131.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi137.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi141.node +0 -0
- package/prebuilds/darwin-arm64/dd_pprof.node.abi147.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi108.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi111.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi115.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi120.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi127.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi131.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi137.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi141.node +0 -0
- package/prebuilds/darwin-x64/dd_pprof.node.abi147.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi108.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi111.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi115.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi120.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi127.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi131.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi137.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi141.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.musl.node.abi147.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi108.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi111.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi115.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi120.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi127.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi131.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi137.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi141.node +0 -0
- package/prebuilds/linux-arm64/dd_pprof.node.abi147.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi108.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi111.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi115.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi120.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi127.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi131.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi137.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi141.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.musl.node.abi147.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi108.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi111.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi115.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi120.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi127.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi131.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi137.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi141.node +0 -0
- package/prebuilds/linux-x64/dd_pprof.node.abi147.node +0 -0
- package/prebuilds/openharmony-arm64/dd_pprof.node.abi147.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi108.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi111.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi115.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi120.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi127.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi131.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi137.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi141.node +0 -0
- package/prebuilds/win32-x64/dd_pprof.node.abi147.node +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2026 Datadog, Inc
|
|
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._currentRecordBytes = exports.clearContext = exports.getContext = exports.ThreadContext = void 0;
|
|
19
|
+
exports.getProcessContextAttributes = getProcessContextAttributes;
|
|
20
|
+
// Vendored from https://github.com/polarsignals/custom-labels/tree/otel-thread-ctx-wip/js/
|
|
21
|
+
// (originally js/index.js + js/index.d.ts, merged into TypeScript). Kept
|
|
22
|
+
// as a near-verbatim copy: edits should ideally land upstream first and
|
|
23
|
+
// be ported here, so the two stay in sync. We plan to drop this vendored
|
|
24
|
+
// copy once the upstream package is suitable to depend on directly.
|
|
25
|
+
// Node.js writer for the OpenTelemetry Thread Local Context Record
|
|
26
|
+
// (OTEP-4947), discoverable from an out-of-process reader via the
|
|
27
|
+
// `otel_thread_ctx_nodejs_v1` thread-local symbol exported by
|
|
28
|
+
// `dd_pprof.node`.
|
|
29
|
+
//
|
|
30
|
+
// Linux only; on other platforms the exported functions degrade to no-ops.
|
|
31
|
+
const path_1 = require("path");
|
|
32
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
33
|
+
const SCHEMA_VERSION = 'nodejs_v1_dev';
|
|
34
|
+
// V8 layout constants the addon captured from the V8 headers Node bundles.
|
|
35
|
+
// On non-Linux these fall back to values matching Node's standard build
|
|
36
|
+
// (no V8 pointer compression, no sandbox); the reader is Linux-only per
|
|
37
|
+
// the OTEP anyway, so the fallbacks just keep processContextAttributes
|
|
38
|
+
// consistent in shape.
|
|
39
|
+
let WRAPPED_OBJECT_OFFSET = 24;
|
|
40
|
+
let TAGGED_SIZE = 8;
|
|
41
|
+
let NATIVE_WRAP_FIELDS_OFFSET = 24;
|
|
42
|
+
let JS_MAP_TABLE_OFFSET = 0x18;
|
|
43
|
+
let ORDERED_HASH_MAP_HEADER_SIZE = 0x10;
|
|
44
|
+
// Debug accessor (not part of the stable API; for tests / reader dev).
|
|
45
|
+
let _currentRecordBytes = () => undefined;
|
|
46
|
+
exports._currentRecordBytes = _currentRecordBytes;
|
|
47
|
+
if (process.platform === 'linux') {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
49
|
+
const findBinding = require('node-gyp-build');
|
|
50
|
+
const addon = findBinding((0, path_1.join)(__dirname, '..', '..'));
|
|
51
|
+
WRAPPED_OBJECT_OFFSET = addon.otelThreadCtxWrappedObjectOffset;
|
|
52
|
+
TAGGED_SIZE = addon.otelThreadCtxTaggedSize;
|
|
53
|
+
NATIVE_WRAP_FIELDS_OFFSET = addon.otelThreadCtxNativeWrapFieldsOffset;
|
|
54
|
+
JS_MAP_TABLE_OFFSET = addon.otelThreadCtxJsMapTableOffset;
|
|
55
|
+
ORDERED_HASH_MAP_HEADER_SIZE = addon.otelThreadCtxOrderedHashMapHeaderSize;
|
|
56
|
+
exports.ThreadContext = addon.threadContext;
|
|
57
|
+
let als;
|
|
58
|
+
function asyncContextFrameError() {
|
|
59
|
+
const [major] = process.versions.node.split('.').map(Number);
|
|
60
|
+
if (process.execArgv.includes('--no-async-context-frame')) {
|
|
61
|
+
return 'Node explicitly launched with --no-async-context-frame';
|
|
62
|
+
}
|
|
63
|
+
if (major >= 24)
|
|
64
|
+
return undefined;
|
|
65
|
+
if (process.execArgv.includes('--experimental-async-context-frame')) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
if (major >= 22) {
|
|
69
|
+
return 'Node versions prior to v24 must be launched with --experimental-async-context-frame';
|
|
70
|
+
}
|
|
71
|
+
return 'Node major versions prior to v22 do not support the feature at all';
|
|
72
|
+
}
|
|
73
|
+
function ensureHook() {
|
|
74
|
+
if (als)
|
|
75
|
+
return als;
|
|
76
|
+
const err = asyncContextFrameError();
|
|
77
|
+
if (err) {
|
|
78
|
+
throw new Error(`otel thread-ctx writer requires async_context_frame support, which is unavailable: ${err}.`);
|
|
79
|
+
}
|
|
80
|
+
als = new node_async_hooks_1.AsyncLocalStorage();
|
|
81
|
+
addon.otelThreadCtxStoreAls(als);
|
|
82
|
+
return als;
|
|
83
|
+
}
|
|
84
|
+
exports.getContext = function () {
|
|
85
|
+
return als ? als.getStore() : undefined;
|
|
86
|
+
};
|
|
87
|
+
// Idempotent: clearing when the hook hasn't been installed (no prior
|
|
88
|
+
// enter / run on a ThreadContext) is a no-op.
|
|
89
|
+
exports.clearContext = function () {
|
|
90
|
+
if (!als)
|
|
91
|
+
return;
|
|
92
|
+
als.enterWith(undefined);
|
|
93
|
+
};
|
|
94
|
+
// Install the active-context channel on the ThreadContext prototype so
|
|
95
|
+
// the only way to push a ThreadContext into our AsyncLocalStorage is
|
|
96
|
+
// via the context itself — callers can't poison the ALS with an
|
|
97
|
+
// arbitrary object.
|
|
98
|
+
exports.ThreadContext.prototype.enter = function () {
|
|
99
|
+
ensureHook().enterWith(this);
|
|
100
|
+
};
|
|
101
|
+
exports.ThreadContext.prototype.run = function (fn) {
|
|
102
|
+
return ensureHook().run(this, fn);
|
|
103
|
+
};
|
|
104
|
+
exports._currentRecordBytes = function () {
|
|
105
|
+
if (!als)
|
|
106
|
+
return undefined;
|
|
107
|
+
const context = als.getStore();
|
|
108
|
+
return context ? context.debugBytes() : undefined;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// Non-Linux degradation. The writer's reader contract is ELF-TLSDESC,
|
|
113
|
+
// meaningful only on Linux; on other platforms we still want the API
|
|
114
|
+
// to be callable so consumers don't have to gate every call site —
|
|
115
|
+
// construction succeeds but produces an inert context, and the
|
|
116
|
+
// enter/run/clearContext entry points don't wire anything into
|
|
117
|
+
// AsyncLocalStorage.
|
|
118
|
+
class NoopThreadContext {
|
|
119
|
+
appendAttributes() { }
|
|
120
|
+
isTruncated() {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
debugBytes() {
|
|
124
|
+
return new Uint8Array(0);
|
|
125
|
+
}
|
|
126
|
+
enter() { }
|
|
127
|
+
run(fn) {
|
|
128
|
+
return fn();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.ThreadContext = NoopThreadContext;
|
|
132
|
+
exports.getContext = function () {
|
|
133
|
+
return undefined;
|
|
134
|
+
};
|
|
135
|
+
exports.clearContext = function () { };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the OTEP-4719 process-context attributes the caller should
|
|
139
|
+
* publish so an out-of-process reader can decode the on-the-wire uint8
|
|
140
|
+
* key indexes back to attribute names. The supplied `keys` array is the
|
|
141
|
+
* same string list the caller writes into the positional `attributes`
|
|
142
|
+
* argument of {@link ThreadContext}: index N here is the uint8 key index
|
|
143
|
+
* N in each record.
|
|
144
|
+
*
|
|
145
|
+
* `keys` is validated: must be a string array of length ≤ 256 with no
|
|
146
|
+
* duplicates.
|
|
147
|
+
*/
|
|
148
|
+
function getProcessContextAttributes(keys) {
|
|
149
|
+
if (!Array.isArray(keys)) {
|
|
150
|
+
throw new TypeError('keys must be an array of attribute names');
|
|
151
|
+
}
|
|
152
|
+
if (keys.length > 256) {
|
|
153
|
+
throw new RangeError('keys array exceeds 256 entries');
|
|
154
|
+
}
|
|
155
|
+
const seen = new Set();
|
|
156
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
157
|
+
const name = keys[i];
|
|
158
|
+
if (typeof name !== 'string') {
|
|
159
|
+
throw new TypeError('every key must be a string');
|
|
160
|
+
}
|
|
161
|
+
if (seen.has(name)) {
|
|
162
|
+
throw new Error(`duplicate key name at index ${i}: ${name}`);
|
|
163
|
+
}
|
|
164
|
+
seen.add(name);
|
|
165
|
+
}
|
|
166
|
+
return Object.freeze({
|
|
167
|
+
'threadlocal.schema_version': SCHEMA_VERSION,
|
|
168
|
+
'threadlocal.attribute_key_map': Object.freeze(keys.slice()),
|
|
169
|
+
'threadlocal.wrapped_object_offset': WRAPPED_OBJECT_OFFSET,
|
|
170
|
+
'threadlocal.tagged_size': TAGGED_SIZE,
|
|
171
|
+
'threadlocal.native_wrap_fields_offset': NATIVE_WRAP_FIELDS_OFFSET,
|
|
172
|
+
'threadlocal.js_map_table_offset': JS_MAP_TABLE_OFFSET,
|
|
173
|
+
'threadlocal.ordered_hash_map_header_size': ORDERED_HASH_MAP_HEADER_SIZE,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=otel-thread-ctx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel-thread-ctx.js","sourceRoot":"","sources":["../../ts/src/otel-thread-ctx.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAiPH,kEA6BC;AA5QD,2FAA2F;AAC3F,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AAEpE,mEAAmE;AACnE,kEAAkE;AAClE,8DAA8D;AAC9D,mBAAmB;AACnB,EAAE;AACF,2EAA2E;AAE3E,+BAA0B;AAC1B,uDAAmD;AAmFnD,MAAM,cAAc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AI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,4BAA4B,EAAE,cAAc;QAC5C,+BAA+B,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5D,mCAAmC,EAAE,qBAAqB;QAC1D,yBAAyB,EAAE,WAAW;QACtC,uCAAuC,EAAE,yBAAyB;QAClE,iCAAiC,EAAE,mBAAmB;QACtD,0CAA0C,EAAE,4BAA4B;KACzE,CAA6B,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2019 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
|
+
import { Profile } from 'pprof-format';
|
|
17
|
+
export declare function encode(profile: Profile): Promise<Buffer>;
|
|
18
|
+
export declare function encodeSync(profile: Profile): Buffer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2019 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.encode = encode;
|
|
19
|
+
exports.encodeSync = encodeSync;
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const zlib_1 = require("zlib");
|
|
22
|
+
const gzipPromise = (0, util_1.promisify)(zlib_1.gzip);
|
|
23
|
+
function encode(profile) {
|
|
24
|
+
return profile.encodeAsync().then(gzipPromise);
|
|
25
|
+
}
|
|
26
|
+
function encodeSync(profile) {
|
|
27
|
+
return (0, zlib_1.gzipSync)(profile.encode());
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=profile-encoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-encoder.js","sourceRoot":"","sources":["../../ts/src/profile-encoder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AASH,wBAEC;AAED,gCAEC;AAbD,+BAA+B;AAC/B,+BAAoC;AAIpC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAC,WAAI,CAAC,CAAC;AAEpC,SAAgB,MAAM,CAAC,OAAgB;IACrC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACjD,CAAC;AAED,SAAgB,UAAU,CAAC,OAAgB;IACzC,OAAO,IAAA,eAAQ,EAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
import { Profile } from 'pprof-format';
|
|
17
|
+
import { SourceMapper } from './sourcemapper/sourcemapper';
|
|
18
|
+
import { AllocationProfileNode, AllocationProfileNodeWithStats, GenerateAllocationLabelsFunction, GenerateTimeLabelsFunction, TimeProfile, TimeProfileNode } from './v8-types';
|
|
19
|
+
export declare const NON_JS_THREADS_FUNCTION_NAME = "Non JS threads activity";
|
|
20
|
+
export declare const GARBAGE_COLLECTION_FUNCTION_NAME = "Garbage Collection";
|
|
21
|
+
/**
|
|
22
|
+
* Controls how a frame's column number is represented in the emitted profile.
|
|
23
|
+
* - `'drop'`: omit the column; only the line number is emitted. This is the
|
|
24
|
+
* default and matches the historical behavior and standard pprof line
|
|
25
|
+
* semantics, so existing consumers see unchanged line numbers.
|
|
26
|
+
* - `'pack'`: pack the column into the high 32 bits of the line field
|
|
27
|
+
* (`column << 32 | line`) — the encoding the Datadog deobfuscation backend
|
|
28
|
+
* decodes (the same one the Chrome profile intake uses). Required to
|
|
29
|
+
* deobfuscate single-line (bundled/minified) frames, where the column is the
|
|
30
|
+
* only discriminator between functions.
|
|
31
|
+
*
|
|
32
|
+
* The enum leaves room for a future `'emit'` mode that would populate a real
|
|
33
|
+
* pprof `Line.column` field once the backend consumes it.
|
|
34
|
+
*/
|
|
35
|
+
export type ColumnNumbers = 'drop' | 'pack';
|
|
36
|
+
export declare const DEFAULT_COLUMN_NUMBERS: ColumnNumbers;
|
|
37
|
+
export declare function computeTotalHitCount(root: TimeProfileNode): number;
|
|
38
|
+
/**
|
|
39
|
+
* Converts v8 time profile into into a profile proto.
|
|
40
|
+
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
41
|
+
*
|
|
42
|
+
* @param prof - profile to be converted.
|
|
43
|
+
* @param intervalMicros - average time (microseconds) between samples.
|
|
44
|
+
*/
|
|
45
|
+
export declare function serializeTimeProfile(prof: TimeProfile, intervalMicros: number, sourceMapper?: SourceMapper, recomputeSamplingInterval?: boolean, generateLabels?: GenerateTimeLabelsFunction, lowCardinalityLabels?: string[], columnNumbers?: ColumnNumbers): Profile;
|
|
46
|
+
/**
|
|
47
|
+
* Converts v8 heap profile into into a profile proto.
|
|
48
|
+
* (https://github.com/google/pprof/blob/master/proto/profile.proto)
|
|
49
|
+
*
|
|
50
|
+
* @param prof - profile to be converted.
|
|
51
|
+
* @param startTimeNanos - start time of profile, in nanoseconds (POSIX time).
|
|
52
|
+
* @param durationsNanos - duration of the profile (wall clock time) in
|
|
53
|
+
* nanoseconds.
|
|
54
|
+
* @param intervalBytes - bytes allocated between samples.
|
|
55
|
+
*/
|
|
56
|
+
export declare function serializeHeapProfile(prof: AllocationProfileNode | AllocationProfileNodeWithStats, startTimeNanos: number, intervalBytes: number, ignoreSamplesPath?: string, sourceMapper?: SourceMapper, generateLabels?: GenerateAllocationLabelsFunction, allocations?: boolean, columnNumbers?: ColumnNumbers): Profile;
|