@ohos-perf/core 0.22.1 → 0.22.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.
- package/dist/index.js +40 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -746,6 +746,7 @@ function buildHiprofilerConfig(opts) {
|
|
|
746
746
|
var DEVICE_CONFIG_PATH = "/data/local/tmp/ohos-perf-hiprofiler.cfg";
|
|
747
747
|
var DEVICE_OUTPUT_PATH = "/data/local/tmp/ohos-perf-hiprofiler.htrace";
|
|
748
748
|
var DONE_MARKER = "DONE";
|
|
749
|
+
var SKELETON_MAX_BYTES = 2048;
|
|
749
750
|
var MAX_DURATION_MS = 2147483647;
|
|
750
751
|
var DETAIL_MAX_LINES2 = 5;
|
|
751
752
|
function detail2(text) {
|
|
@@ -828,6 +829,12 @@ var HiprofilerCollector = class {
|
|
|
828
829
|
{ code: "HIPROFILER_NO_OUTPUT" }
|
|
829
830
|
);
|
|
830
831
|
}
|
|
832
|
+
if (size <= SKELETON_MAX_BYTES) {
|
|
833
|
+
throw new OhosPerfError(
|
|
834
|
+
`hiprofiler wrote ${size} bytes to ${DEVICE_OUTPUT_PATH}, which is the container skeleton and holds no events: the session ran but recorded nothing. Check that the target app was running and that the plugins asked for are supported by this device. ls -l output: ${detail2(combined2(listing))}`,
|
|
835
|
+
{ code: "HIPROFILER_NO_OUTPUT" }
|
|
836
|
+
);
|
|
837
|
+
}
|
|
831
838
|
const partial = `${layout.traceFile}.partial`;
|
|
832
839
|
try {
|
|
833
840
|
await hdc.recv(target, DEVICE_OUTPUT_PATH, partial);
|
|
@@ -8749,6 +8756,38 @@ function targetOf(tree, x, y) {
|
|
|
8749
8756
|
};
|
|
8750
8757
|
return containing.slice().sort((a, b) => Number(b.clickable) - Number(a.clickable) || area(a) - area(b))[0];
|
|
8751
8758
|
}
|
|
8759
|
+
function rectOf2(node) {
|
|
8760
|
+
return node.boundsRect ?? parseBounds(node.bounds);
|
|
8761
|
+
}
|
|
8762
|
+
function gapTo(rect, x, y) {
|
|
8763
|
+
return Math.max(rect.left - x, 0, x - rect.right, rect.top - y, 0, y - rect.bottom);
|
|
8764
|
+
}
|
|
8765
|
+
function containsRect(outer, inner) {
|
|
8766
|
+
return outer.left <= inner.left && outer.top <= inner.top && outer.right >= inner.right && outer.bottom >= inner.bottom;
|
|
8767
|
+
}
|
|
8768
|
+
var NEAR_MISS_PX = 24;
|
|
8769
|
+
function nearMissOf(tree, x, y, landedOn) {
|
|
8770
|
+
let best;
|
|
8771
|
+
for (const node of tree) {
|
|
8772
|
+
if (irreversibleReason(node) === void 0) continue;
|
|
8773
|
+
const rect = rectOf2(node);
|
|
8774
|
+
if (rect === void 0) continue;
|
|
8775
|
+
const gap = gapTo(rect, x, y);
|
|
8776
|
+
if (gap > NEAR_MISS_PX) continue;
|
|
8777
|
+
if (landedOn !== void 0 && landedOn !== node && landedOn.clickable) {
|
|
8778
|
+
const landing = rectOf2(landedOn);
|
|
8779
|
+
if (landing === void 0 || !containsRect(landing, rect)) continue;
|
|
8780
|
+
}
|
|
8781
|
+
if (best === void 0 || gap < best.gap) best = { node, gap };
|
|
8782
|
+
}
|
|
8783
|
+
return best;
|
|
8784
|
+
}
|
|
8785
|
+
function refusalFor(tree, x, y, landedOn) {
|
|
8786
|
+
const direct = landedOn === void 0 ? void 0 : irreversibleReason(landedOn);
|
|
8787
|
+
if (direct !== void 0) return direct;
|
|
8788
|
+
const near = nearMissOf(tree, x, y, landedOn);
|
|
8789
|
+
return near === void 0 ? void 0 : irreversibleReason(near.node);
|
|
8790
|
+
}
|
|
8752
8791
|
function unmetExpectation(expect, tree, app) {
|
|
8753
8792
|
const outcomes = evaluateExpectation(expect, tree, app);
|
|
8754
8793
|
const failed = outcomes.filter((outcome) => !outcome.ok);
|
|
@@ -8818,7 +8857,7 @@ async function runAgent(device, model, options) {
|
|
|
8818
8857
|
const gesture = decision.action;
|
|
8819
8858
|
const point = gesture.action === "click" || gesture.action === "inputText" ? { x: gesture.x, y: gesture.y } : void 0;
|
|
8820
8859
|
const target = point === void 0 ? void 0 : targetOf(tree, point.x, point.y);
|
|
8821
|
-
const refused =
|
|
8860
|
+
const refused = point === void 0 ? void 0 : refusalFor(tree, point.x, point.y, target);
|
|
8822
8861
|
if (refused !== void 0 && options.allowIrreversible !== true) {
|
|
8823
8862
|
status = "refused";
|
|
8824
8863
|
steps.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-perf/core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"description": "HarmonyOS performance analysis: capability probing, nine collectors, trace ingest, typed queries, twenty-one analyzers with provenance and fidelity, reports and a scenario runner",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"harmonyos",
|