hiperf_txt_parser 1.0.4 → 1.0.5
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/dist/backtrace.d.ts +1 -1
- package/dist/backtrace.js +16 -3
- package/package.json +1 -1
package/dist/backtrace.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare function toBackTraceStack(sample: RecordSample): string;
|
|
|
10
10
|
* 批量将 PerfData 中所有 RecordSample 转为 hstack 可解析栈。
|
|
11
11
|
* 返回数组长度与 recordSamples 一致,元素顺序一一对应。
|
|
12
12
|
*/
|
|
13
|
-
export declare function toBackTraceStacks(data: PerfData):
|
|
13
|
+
export declare function toBackTraceStacks(data: PerfData): PerfData;
|
package/dist/backtrace.js
CHANGED
|
@@ -26,8 +26,21 @@ export function toBackTraceStack(sample) {
|
|
|
26
26
|
* 返回数组长度与 recordSamples 一致,元素顺序一一对应。
|
|
27
27
|
*/
|
|
28
28
|
export function toBackTraceStacks(data) {
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const recordSamples = data.recordSamples.map((sample) => {
|
|
30
|
+
const backtrace = toBackTraceStack(sample);
|
|
31
|
+
if (!sample.callchainFrames) {
|
|
32
|
+
return sample;
|
|
33
|
+
}
|
|
34
|
+
const frameLines = backtrace ? backtrace.split("\n") : [];
|
|
35
|
+
return {
|
|
36
|
+
...sample,
|
|
37
|
+
callchainFrames: {
|
|
38
|
+
...sample.callchainFrames,
|
|
39
|
+
frames: frameLines,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const nonEmpty = recordSamples.filter((sample) => (sample.callchainFrames?.frames.length ?? 0) > 0).length;
|
|
31
44
|
console.info(`[hiperf_txt_parser] toBackTraceStacks processed recordSamples: ${data.recordSamples.length}, non-empty user stacks: ${nonEmpty}`);
|
|
32
|
-
return
|
|
45
|
+
return { recordSamples };
|
|
33
46
|
}
|