@ohos-perf/core 0.13.2 → 0.13.3

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 (2) hide show
  1. package/dist/index.js +14 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2148,16 +2148,17 @@ function detail8(result) {
2148
2148
  ${result.stderr}`.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
2149
2149
  return lines.length === 0 ? "(no output)" : lines.slice(0, 5).join(" | ");
2150
2150
  }
2151
- function findNewestSnapshot(hdc, target, app) {
2151
+ function listSnapshots(hdc, target, app) {
2152
2152
  return hdc.shell(
2153
2153
  target,
2154
- `find ${DEVICE_SNAPSHOT_DIR}/${app} -maxdepth 6 -name '*.heapsnapshot' -printf "%T@ %p\\n" 2>/dev/null | sort -n | tail -1`
2155
- ).then((result) => {
2156
- const line = result.stdout.trim();
2157
- if (line === "") return void 0;
2158
- const space = line.indexOf(" ");
2159
- return space === -1 ? line : line.slice(space + 1).trim();
2160
- });
2154
+ `find ${DEVICE_SNAPSHOT_DIR}/${app} -maxdepth 6 -name '*.heapsnapshot' -printf "%T@ %p\\n" 2>/dev/null | sort -rn`
2155
+ ).then(
2156
+ (result) => result.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0)
2157
+ );
2158
+ }
2159
+ function rowPath(row2) {
2160
+ const space = row2.indexOf(" ");
2161
+ return space === -1 ? row2 : row2.slice(space + 1).trim();
2161
2162
  }
2162
2163
  function sleep(ms) {
2163
2164
  return new Promise((resolve2) => setTimeout(resolve2, ms));
@@ -2182,6 +2183,9 @@ var JsheapCollector = class {
2182
2183
  { code: "JSHEAP_NO_PID" }
2183
2184
  );
2184
2185
  }
2186
+ const before = new Set(
2187
+ (await listSnapshots(hdc, target, opts.app)).map(rowPath)
2188
+ );
2185
2189
  const dump = await hdc.shell(target, `hidumper --mem-jsheap ${pidText} -T ${pidText}`);
2186
2190
  if (dump.code !== 0) {
2187
2191
  throw new OhosPerfError(
@@ -2192,7 +2196,7 @@ var JsheapCollector = class {
2192
2196
  const deadline = Date.now() + timeoutMs;
2193
2197
  let devicePath;
2194
2198
  for (; ; ) {
2195
- devicePath = await findNewestSnapshot(hdc, target, opts.app);
2199
+ devicePath = (await listSnapshots(hdc, target, opts.app)).map(rowPath).find((path) => !before.has(path));
2196
2200
  if (devicePath !== void 0) break;
2197
2201
  if (Date.now() >= deadline) break;
2198
2202
  await sleep(Math.min(POLL_MS, Math.max(1, deadline - Date.now())));
@@ -6068,7 +6072,7 @@ var PARITY_ROWS = [
6068
6072
  row: 12,
6069
6073
  name: "RenderService skip reverse tracing",
6070
6074
  status: "partial",
6071
- reason: "Missing the system-API `UnMarsh RSTransactionData` backtracking and the CPU-waste metric; the NativeWindow path and per-frame evidence are ported.",
6075
+ reason: "Missing the system-API `UnMarsh RSTransactionData` backtracking; the NativeWindow path, per-frame evidence and `rs_skip.cpu_waste.ms` are ported.",
6072
6076
  analyzer: "RsSkipAnalyzer"
6073
6077
  },
6074
6078
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohos-perf/core",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
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",