@ohos-perf/core 0.13.0 → 0.13.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ohos-perf/core
2
2
 
3
- HarmonyOS performance analysis as a typed library: capability probing, eight
3
+ HarmonyOS performance analysis as a typed library: capability probing, nine
4
4
  collectors, `trace_streamer` ingest, typed queries over the resulting SQLite
5
5
  databases, and analyzers that emit metrics with provenance and fidelity.
6
6
 
package/dist/index.d.ts CHANGED
@@ -1196,6 +1196,16 @@ interface SceneMetadata {
1196
1196
  hilog?: {
1197
1197
  lines: number;
1198
1198
  };
1199
+ /**
1200
+ * Present only when a JS heap snapshot was captured. `bytes` is the size
1201
+ * of `jsheap.heapsnapshot`; a zero-byte file is a failed capture, so the
1202
+ * value is always positive. The snapshot's own format is one only DevEco
1203
+ * Studio reads, so this package records that it took one and never claims
1204
+ * metrics from it.
1205
+ */
1206
+ jsheap?: {
1207
+ bytes: number;
1208
+ };
1199
1209
  };
1200
1210
  }
1201
1211
  /**
package/dist/index.js CHANGED
@@ -2680,6 +2680,9 @@ function isApp(value) {
2680
2680
  function isCountRecord(value, key) {
2681
2681
  return isRecord4(value) && Number.isSafeInteger(value[key]) && value[key] >= 0;
2682
2682
  }
2683
+ function isJsheapRecord(value) {
2684
+ return isRecord4(value) && Number.isSafeInteger(value.bytes) && value.bytes > 0;
2685
+ }
2683
2686
  function isHiperfRecord(value) {
2684
2687
  return isCountRecord(value, "samples") && (value.symbolized === void 0 || typeof value.symbolized === "boolean");
2685
2688
  }
@@ -2687,7 +2690,7 @@ function isScreenshotRecord(value) {
2687
2690
  return isRecord4(value) && Number.isSafeInteger(value.width) && value.width > 0 && Number.isSafeInteger(value.height) && value.height > 0 && Number.isSafeInteger(value.bytes) && value.bytes > 0;
2688
2691
  }
2689
2692
  function isCapture2(value) {
2690
- return isRecord4(value) && isFiniteNumber(value.startedAtMs) && isFiniteNumber(value.durationMs) && isStringArray(value.collectors) && (value.hiperf === void 0 || isHiperfRecord(value.hiperf)) && (value.hidumper === void 0 || isCountRecord(value.hidumper, "frames")) && (value.uitest === void 0 || isCountRecord(value.uitest, "nodes")) && (value.screenshot === void 0 || isScreenshotRecord(value.screenshot)) && (value.hilog === void 0 || isCountRecord(value.hilog, "lines"));
2693
+ return isRecord4(value) && isFiniteNumber(value.startedAtMs) && isFiniteNumber(value.durationMs) && isStringArray(value.collectors) && (value.hiperf === void 0 || isHiperfRecord(value.hiperf)) && (value.hidumper === void 0 || isCountRecord(value.hidumper, "frames")) && (value.uitest === void 0 || isCountRecord(value.uitest, "nodes")) && (value.screenshot === void 0 || isScreenshotRecord(value.screenshot)) && (value.hilog === void 0 || isCountRecord(value.hilog, "lines")) && (value.jsheap === void 0 || isJsheapRecord(value.jsheap));
2691
2694
  }
2692
2695
  function isNumberArray(value) {
2693
2696
  return Array.isArray(value) && value.every((entry) => isFiniteNumber(entry));
@@ -2746,7 +2749,8 @@ function readSceneMetadata(layout) {
2746
2749
  bytes: parsed.capture.screenshot.bytes
2747
2750
  }
2748
2751
  },
2749
- ...parsed.capture.hilog === void 0 ? {} : { hilog: { lines: parsed.capture.hilog.lines } }
2752
+ ...parsed.capture.hilog === void 0 ? {} : { hilog: { lines: parsed.capture.hilog.lines } },
2753
+ ...parsed.capture.jsheap === void 0 ? {} : { jsheap: { bytes: parsed.capture.jsheap.bytes } }
2750
2754
  };
2751
2755
  }
2752
2756
  if (isFiniteNumber(parsed.startedAtNs) && parsed.startedAtNs > 0) {
@@ -3597,6 +3601,7 @@ var Device = class {
3597
3601
  if (!wantsHidumper) removeIfPresent(layout.hidumperFile);
3598
3602
  if (!wantsUitest) removeIfPresent(layout.uiFile);
3599
3603
  if (!wantsScreenshot) removeIfPresent(layout.screenshotFile);
3604
+ if (!wantsJsheap) removeIfPresent(layout.jsheapFile);
3600
3605
  if (!wantsHilog) {
3601
3606
  removeIfPresent(layout.hilogFile);
3602
3607
  removeIfPresent(layout.hilogJsonlFile);
@@ -3628,7 +3633,8 @@ var Device = class {
3628
3633
  ...wantsHidumper ? ["hidumper"] : [],
3629
3634
  ...wantsUitest ? ["uitest"] : [],
3630
3635
  ...wantsScreenshot ? ["screenshot"] : [],
3631
- ...wantsHilog ? ["hilog"] : []
3636
+ ...wantsHilog ? ["hilog"] : [],
3637
+ ...wantsJsheap ? ["jsheap"] : []
3632
3638
  ],
3633
3639
  // A zero-count capture is recorded explicitly: "the collector ran
3634
3640
  // and saw nothing" is a different fact from "it did not run", and
@@ -3642,7 +3648,8 @@ var Device = class {
3642
3648
  ...hidumperCapture === void 0 ? {} : { hidumper: { frames: frameDelta(hidumperCapture).frames } },
3643
3649
  ...uiNodes === void 0 ? {} : { uitest: { nodes: uiNodes.length } },
3644
3650
  ...screenshotCapture === void 0 ? {} : { screenshot: screenshotCapture },
3645
- ...hilogLines === void 0 ? {} : { hilog: { lines: hilogLines } }
3651
+ ...hilogLines === void 0 ? {} : { hilog: { lines: hilogLines } },
3652
+ ...jsheapCapture === void 0 ? {} : { jsheap: { bytes: jsheapCapture.bytes } }
3646
3653
  }
3647
3654
  });
3648
3655
  return ingestScene(streamer, layout);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ohos-perf/core",
3
- "version": "0.13.0",
4
- "description": "HarmonyOS performance analysis: capability probing, eight collectors, trace ingest, typed queries, nineteen analyzers with provenance and fidelity, reports and a scenario runner",
3
+ "version": "0.13.2",
4
+ "description": "HarmonyOS performance analysis: capability probing, nine collectors, trace ingest, typed queries, twenty analyzers with provenance and fidelity, reports and a scenario runner",
5
5
  "keywords": [
6
6
  "harmonyos",
7
7
  "openharmony",