hiperf_txt_parser 1.0.3 → 1.0.4

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.js CHANGED
@@ -18,6 +18,7 @@ export function toBackTraceStack(sample) {
18
18
  const urlInfo = m[3].trim();
19
19
  out.push(`#${index} at ${funcName} (${urlInfo})`);
20
20
  }
21
+ console.info(`[hiperf_txt_parser] toBackTraceStack user stacks: ${out.length}/${frames.length}`);
21
22
  return out.join("\n");
22
23
  }
23
24
  /**
@@ -25,5 +26,8 @@ export function toBackTraceStack(sample) {
25
26
  * 返回数组长度与 recordSamples 一致,元素顺序一一对应。
26
27
  */
27
28
  export function toBackTraceStacks(data) {
28
- return data.recordSamples.map((sample) => toBackTraceStack(sample));
29
+ const stacks = data.recordSamples.map((sample) => toBackTraceStack(sample));
30
+ const nonEmpty = stacks.filter((s) => s.length > 0).length;
31
+ console.info(`[hiperf_txt_parser] toBackTraceStacks processed recordSamples: ${data.recordSamples.length}, non-empty user stacks: ${nonEmpty}`);
32
+ return stacks;
29
33
  }
package/dist/parser.js CHANGED
@@ -255,13 +255,16 @@ export function parsePerfData(text) {
255
255
  // 跳过无法解析的块
256
256
  }
257
257
  }
258
+ console.info(`[hiperf_txt_parser] parsePerfData parsed recordSamples: ${recordSamples.length}`);
258
259
  return { recordSamples };
259
260
  }
260
261
  /**
261
262
  * 按 tgid 过滤 RecordSample(当前以 pid 字段作为 tgid)
262
263
  */
263
264
  export function filterByTgid(data, tgid) {
264
- return {
265
- recordSamples: data.recordSamples.filter((sample) => sample.pid === tgid),
266
- };
265
+ const before = data.recordSamples.length;
266
+ const afterSamples = data.recordSamples.filter((sample) => sample.pid === tgid);
267
+ const after = afterSamples.length;
268
+ console.info(`[hiperf_txt_parser] filterByTgid tgid=${tgid}, recordSamples: ${before} -> ${after}`);
269
+ return { recordSamples: afterSamples };
267
270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hiperf_txt_parser",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Parse perf data.txt and output structured TypeScript data",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",