@ohos-perf/core 0.1.0 → 0.2.0
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.d.ts +344 -4
- package/dist/index.js +1557 -146
- package/package.json +48 -40
package/dist/index.d.ts
CHANGED
|
@@ -180,7 +180,7 @@ declare class Hdc {
|
|
|
180
180
|
* probe output that produced the verdict. Callers never have to infer "empty
|
|
181
181
|
* result" from "unsupported device".
|
|
182
182
|
*/
|
|
183
|
-
type CapabilityId = 'trace.frames' | 'trace.sched' | 'trace.binder' | 'trace.thread_state' | 'perf.samples' | 'perf.pmu' | 'mem.procfs' | 'mem.native_hook' | 'mem.gpu' | 'render.fps_live' | 'render.hitch' | 'render.vsync' | 'ui.tree' | 'ui.gesture' | 'power.xpower' | 'net.io' | 'disk.io' | 'js.heap' | 'coverage' | 'startup.app_startup';
|
|
183
|
+
type CapabilityId = 'trace.frames' | 'trace.sched' | 'trace.binder' | 'trace.thread_state' | 'trace.ark' | 'perf.samples' | 'perf.pmu' | 'mem.procfs' | 'mem.native_hook' | 'mem.gpu' | 'render.fps_live' | 'render.hitch' | 'render.vsync' | 'ui.tree' | 'ui.gesture' | 'power.xpower' | 'net.io' | 'disk.io' | 'js.heap' | 'coverage' | 'startup.app_startup';
|
|
184
184
|
/**
|
|
185
185
|
* How directly a capability measures the thing it claims to measure.
|
|
186
186
|
*
|
|
@@ -1677,19 +1677,28 @@ declare class CallstackQuery {
|
|
|
1677
1677
|
* quotes or a `--` comment is matched as text. The result is capped by
|
|
1678
1678
|
* `opts.limit` (default {@link DEFAULT_MATCH_LIMIT}), and `opts.range`
|
|
1679
1679
|
* restricts `ts` inclusively.
|
|
1680
|
+
*
|
|
1681
|
+
* `opts.ipids` restricts the result to rows emitted by a thread of one of
|
|
1682
|
+
* those processes. **An empty array matches nothing** — an empty app
|
|
1683
|
+
* identity means no process was identified, and widening to device-wide is
|
|
1684
|
+
* the attribution bug `MemoryMeasureAnalyzer` guards against. `undefined`
|
|
1685
|
+
* leaves the query unscoped.
|
|
1680
1686
|
*/
|
|
1681
1687
|
matching(pattern: string, opts?: {
|
|
1682
1688
|
range?: TimeRange;
|
|
1683
1689
|
limit?: number;
|
|
1690
|
+
ipids?: readonly number[];
|
|
1684
1691
|
}): CallstackEvent[];
|
|
1685
1692
|
/**
|
|
1686
1693
|
* Rows `matching()` would return without its `opts.limit` cap.
|
|
1687
1694
|
*
|
|
1688
1695
|
* Uses the same `WHERE` as `matching()`, so the pair can report a true
|
|
1689
|
-
* match count while the fetched rows stay bounded.
|
|
1696
|
+
* match count while the fetched rows stay bounded. An empty `opts.ipids`
|
|
1697
|
+
* counts zero, for the same reason `matching()` returns nothing.
|
|
1690
1698
|
*/
|
|
1691
1699
|
countMatching(pattern: string, opts?: {
|
|
1692
1700
|
range?: TimeRange;
|
|
1701
|
+
ipids?: readonly number[];
|
|
1693
1702
|
}): number;
|
|
1694
1703
|
/**
|
|
1695
1704
|
* Callstack rows with their arguments resolved through `args` + `data_dict`.
|
|
@@ -1740,6 +1749,18 @@ interface PerfCallchain {
|
|
|
1740
1749
|
callchainId: number;
|
|
1741
1750
|
functions: PerfFunction[];
|
|
1742
1751
|
}
|
|
1752
|
+
/**
|
|
1753
|
+
* One folded stack, in the format `flamegraph.pl` and every flamegraph viewer
|
|
1754
|
+
* understands: `a;b;c` with `samples` samples ending at `c`.
|
|
1755
|
+
*/
|
|
1756
|
+
interface FoldedStack {
|
|
1757
|
+
/** Semicolon-joined symbol path, root first. */
|
|
1758
|
+
stack: string;
|
|
1759
|
+
/** The last symbol on the stack — the frame the samples were taken in. */
|
|
1760
|
+
leaf: string;
|
|
1761
|
+
/** Summed `event_count` of every sample folded into this stack. */
|
|
1762
|
+
samples: number;
|
|
1763
|
+
}
|
|
1743
1764
|
/**
|
|
1744
1765
|
* Typed accessor over the optional `perf_*` tables.
|
|
1745
1766
|
*
|
|
@@ -1760,6 +1781,27 @@ declare class PerfQuery {
|
|
|
1760
1781
|
* table returns `[]`.
|
|
1761
1782
|
*/
|
|
1762
1783
|
threads(pids: number[]): PerfThread[];
|
|
1784
|
+
/**
|
|
1785
|
+
* The `thread_id`s of the threads named `threadName` in one of `pids`.
|
|
1786
|
+
*
|
|
1787
|
+
* Exists for the GC analyzer, which attributes samples to `OS_GC_Thread`.
|
|
1788
|
+
* Ordering is by `thread_id` so the result is byte-stable (D5); an empty
|
|
1789
|
+
* `pids` or an absent `perf_thread` table returns `[]`.
|
|
1790
|
+
*/
|
|
1791
|
+
threadIdsNamed(pids: readonly number[], threadName: string): number[];
|
|
1792
|
+
/**
|
|
1793
|
+
* The summed weight of the samples recorded by `threadIds`.
|
|
1794
|
+
*
|
|
1795
|
+
* `perf_sample.event_count` is the sample's weight — the number of events
|
|
1796
|
+
* the sample stands for — not 1. Summing rows instead of this column makes
|
|
1797
|
+
* every share computed from it wrong by the sampling period. `threadIds`
|
|
1798
|
+
* omitted sums the whole database; an empty array returns 0.
|
|
1799
|
+
*
|
|
1800
|
+
* `range` restricts the sum to samples whose `timestamp_trace` falls inside
|
|
1801
|
+
* it, which is what a windowed share needs: summing the whole table while the
|
|
1802
|
+
* stacks are windowed makes the share describe a different population.
|
|
1803
|
+
*/
|
|
1804
|
+
eventCount(threadIds?: readonly number[], range?: TimeRange): number;
|
|
1763
1805
|
/**
|
|
1764
1806
|
* Samples of `threadIds` whose `timestamp_trace` is in `[startNs, endNs]`.
|
|
1765
1807
|
*
|
|
@@ -1782,6 +1824,31 @@ declare class PerfQuery {
|
|
|
1782
1824
|
* so the result is `[]` (HapRay does the same).
|
|
1783
1825
|
*/
|
|
1784
1826
|
callchains(threadIds: number[], range: TimeRange, maxChainsPerThread?: number): PerfCallchain[];
|
|
1827
|
+
/**
|
|
1828
|
+
* Folds every sample of `threadIds` in `range` into semicolon-joined stacks.
|
|
1829
|
+
*
|
|
1830
|
+
* Deliberately **not** built on {@link callchains}: that method caps at 50
|
|
1831
|
+
* chain ids and 20 chains per thread (HapRay's UI budget), which would
|
|
1832
|
+
* silently drop samples from an aggregate. This reads every distinct
|
|
1833
|
+
* `callchain_id` the samples reference and weights each by `event_count` —
|
|
1834
|
+
* the sample's weight, not 1 row.
|
|
1835
|
+
*
|
|
1836
|
+
* Stacks are sorted by `samples` descending then `stack` ascending, so equal
|
|
1837
|
+
* weights never fall back to row order, and sliced to `top` — omit `top` to
|
|
1838
|
+
* get every distinct stack, which is what a count of stacks needs. A chain
|
|
1839
|
+
* with no frames contributes nothing. An empty `threadIds`, a missing
|
|
1840
|
+
* `perf_callchain`/`perf_files`, or no samples in range yields `[]`.
|
|
1841
|
+
*/
|
|
1842
|
+
foldedStacks(threadIds: readonly number[], range: TimeRange, top?: number): FoldedStack[];
|
|
1843
|
+
/**
|
|
1844
|
+
* Resolves each chain id to its frames, ordered by `depth`.
|
|
1845
|
+
*
|
|
1846
|
+
* Symbols resolve through `perf_files` by the exact `(file_id, serial_id)`
|
|
1847
|
+
* pair first and by `file_id` alone as the fallback; a frame with neither
|
|
1848
|
+
* keeps its raw `perf_callchain.name`. A missing `perf_callchain` or
|
|
1849
|
+
* `perf_files` yields an empty map (nothing can be resolved).
|
|
1850
|
+
*/
|
|
1851
|
+
private chainFunctions;
|
|
1785
1852
|
private hasTable;
|
|
1786
1853
|
}
|
|
1787
1854
|
|
|
@@ -1861,7 +1928,7 @@ declare class StartupQuery {
|
|
|
1861
1928
|
private hasTable;
|
|
1862
1929
|
}
|
|
1863
1930
|
|
|
1864
|
-
type EvidenceKind = 'no_data' | 'jank' | 'empty_frame' | 'vsync_anomaly' | 'fps_baseline' | 'degraded_capability' | 'fault_pattern' | 'binder_hotspot' | 'thread_redundancy' | 'memory_growth' | 'startup';
|
|
1931
|
+
type EvidenceKind = 'no_data' | 'jank' | 'empty_frame' | 'vsync_anomaly' | 'fps_baseline' | 'degraded_capability' | 'fault_pattern' | 'binder_hotspot' | 'thread_redundancy' | 'memory_growth' | 'gc_pressure' | 'rs_skip' | 'startup';
|
|
1865
1932
|
/**
|
|
1866
1933
|
* A follow-up query an agent can issue to drill into an evidence item.
|
|
1867
1934
|
*
|
|
@@ -2623,6 +2690,263 @@ declare class RenderAnalyzer implements Analyzer {
|
|
|
2623
2690
|
}>;
|
|
2624
2691
|
}
|
|
2625
2692
|
|
|
2693
|
+
interface GcSignals {
|
|
2694
|
+
full: number;
|
|
2695
|
+
sharedFull: number;
|
|
2696
|
+
shared: number;
|
|
2697
|
+
partial: number;
|
|
2698
|
+
/** Every GC phase event the app emitted. */
|
|
2699
|
+
invocations: number;
|
|
2700
|
+
/** `max(ts) - min(ts)` over the whole `callstack` table. */
|
|
2701
|
+
spanNs: number;
|
|
2702
|
+
/** `invocations` per second over `spanNs`; 0 when the span is empty. */
|
|
2703
|
+
rate: number;
|
|
2704
|
+
/** True when the count clause alone fires: `> 10` invocations and `> 1/s`. */
|
|
2705
|
+
tooMany: boolean;
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* Counts the app's GC phase events and measures its invocation rate.
|
|
2709
|
+
*
|
|
2710
|
+
* `ipids` must already be resolved (see `resolveAppIpids`); an empty list
|
|
2711
|
+
* matches nothing, so the result is all zeros rather than device-wide counts.
|
|
2712
|
+
* The raw SQL is here because no query class owns a `LIKE` count scoped by
|
|
2713
|
+
* `thread.ipid`; the `LIKE` predicates stay bound as parameters.
|
|
2714
|
+
*/
|
|
2715
|
+
declare function computeGc(db: QueryHandle, opts: {
|
|
2716
|
+
ipids: readonly number[];
|
|
2717
|
+
}): GcSignals;
|
|
2718
|
+
/**
|
|
2719
|
+
* Emits `gc.*` metrics from Ark-runtime GC phase events.
|
|
2720
|
+
*
|
|
2721
|
+
* Counts only events the app's own threads emitted (`callstack.callid` joins
|
|
2722
|
+
* `thread.id`), so another process's GCs never inflate the app's numbers.
|
|
2723
|
+
*/
|
|
2724
|
+
declare class GcAnalyzer implements Analyzer {
|
|
2725
|
+
readonly id = "gc";
|
|
2726
|
+
readonly requires: CapabilityId[];
|
|
2727
|
+
run(ctx: AnalyzeContext): Promise<AnalyzeResult>;
|
|
2728
|
+
/**
|
|
2729
|
+
* `gc.perf.share` plus the number behind it, or a degraded proxy and
|
|
2730
|
+
* `undefined`.
|
|
2731
|
+
*
|
|
2732
|
+
* HapRay computes the share over the app's own perf threads, so the
|
|
2733
|
+
* denominator is the app's sample weight — not the device's. The caller
|
|
2734
|
+
* needs the number, not just the metric: HapRay's second pressure clause is
|
|
2735
|
+
* `perf_percentage > 0.15`.
|
|
2736
|
+
*/
|
|
2737
|
+
private perfShare;
|
|
2738
|
+
private pressureEvidence;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
type VsyncPeriodKind = 'high_frequency' | 'low_frequency';
|
|
2742
|
+
type VsyncSeverity = 'low' | 'medium' | 'high';
|
|
2743
|
+
interface VsyncPeriod {
|
|
2744
|
+
kind: VsyncPeriodKind;
|
|
2745
|
+
startVsync: number;
|
|
2746
|
+
endVsync: number;
|
|
2747
|
+
/** Absolute trace nanoseconds; the window an evidence item covers. */
|
|
2748
|
+
startNs: number;
|
|
2749
|
+
endNs: number;
|
|
2750
|
+
intervalCount: number;
|
|
2751
|
+
avgIntervalNs: number;
|
|
2752
|
+
avgFrequencyHz: number;
|
|
2753
|
+
severity: VsyncSeverity;
|
|
2754
|
+
}
|
|
2755
|
+
interface VsyncAnalysis {
|
|
2756
|
+
/** Distinct `vsync` values the app rendered under. */
|
|
2757
|
+
signals: number;
|
|
2758
|
+
mismatches: number;
|
|
2759
|
+
periods: VsyncPeriod[];
|
|
2760
|
+
anomalyRate: number;
|
|
2761
|
+
}
|
|
2762
|
+
/**
|
|
2763
|
+
* The pure VSync analysis over an already app-scoped frame list.
|
|
2764
|
+
*
|
|
2765
|
+
* Exported so a caller can test or reuse the algorithm without a database.
|
|
2766
|
+
*/
|
|
2767
|
+
declare function computeVsyncAnomalies(frames: readonly Frame[]): VsyncAnalysis;
|
|
2768
|
+
/**
|
|
2769
|
+
* Emits `vsync.*` metrics and one `vsync_anomaly` evidence item per period.
|
|
2770
|
+
*
|
|
2771
|
+
* Only the app's frames are analyzed; an app that rendered nothing in the
|
|
2772
|
+
* window produces no metrics and one `no_data` item rather than an exact 0%
|
|
2773
|
+
* anomaly rate, which would read as "the cadence was perfect".
|
|
2774
|
+
*/
|
|
2775
|
+
declare class VsyncAnalyzer implements Analyzer {
|
|
2776
|
+
readonly id = "vsync";
|
|
2777
|
+
readonly requires: CapabilityId[];
|
|
2778
|
+
run(ctx: AnalyzeContext): Promise<AnalyzeResult>;
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
/** The two filter verdicts, plus the frames that survived both. */
|
|
2782
|
+
interface EmptyFrameFilter {
|
|
2783
|
+
/** Frames no rule dropped. */
|
|
2784
|
+
confirmed: Frame[];
|
|
2785
|
+
/** Frames dropped by either rule, in input order. */
|
|
2786
|
+
filtered: Frame[];
|
|
2787
|
+
/** Frames dropped because their own thread submitted a buffer inside them. */
|
|
2788
|
+
rule1: Frame[];
|
|
2789
|
+
/** Frames dropped because the same `(vsync, itid)` already drew a frame. */
|
|
2790
|
+
rule2: Frame[];
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Splits `frames` into confirmed empties and the ones each rule dropped.
|
|
2794
|
+
*
|
|
2795
|
+
* Input order is preserved in every output list, and a frame dropped by both
|
|
2796
|
+
* rules appears in both — the lists answer "which rule would have caught this",
|
|
2797
|
+
* not "which rule did".
|
|
2798
|
+
*/
|
|
2799
|
+
declare function filterEmptyFrames(db: QueryHandle, frames: readonly Frame[]): EmptyFrameFilter;
|
|
2800
|
+
/**
|
|
2801
|
+
* Emits `empty_frame.*` metrics and one `empty_frame` evidence per confirmed
|
|
2802
|
+
* frame.
|
|
2803
|
+
*
|
|
2804
|
+
* `empty_frame.rate` is **this package's** definition — `confirmed / app actual
|
|
2805
|
+
* frames × 100` — not a HapRay field: upstream reports empty-frame counts and
|
|
2806
|
+
* load, not a rate. It is omitted when the app rendered no actual frames, so a
|
|
2807
|
+
* consumer never reads a fabricated 0% as "the app never wasted a frame".
|
|
2808
|
+
*/
|
|
2809
|
+
declare class EmptyFrameAnalyzer implements Analyzer {
|
|
2810
|
+
readonly id = "empty-frame";
|
|
2811
|
+
readonly requires: CapabilityId[];
|
|
2812
|
+
run(ctx: AnalyzeContext): Promise<AnalyzeResult>;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
/** One RenderService frame that skipped, and what it traced back to. */
|
|
2816
|
+
interface RsSkipFrame {
|
|
2817
|
+
frame: Frame;
|
|
2818
|
+
/** `DisplayNode skip` rows inside the frame's inclusive window. */
|
|
2819
|
+
events: number;
|
|
2820
|
+
traced?: {
|
|
2821
|
+
frame: Frame;
|
|
2822
|
+
/** The buffer event's timestamp. */
|
|
2823
|
+
eventNs: number;
|
|
2824
|
+
/** `|appFrame.ts - eventNs|`. */
|
|
2825
|
+
timeDiffNs: number;
|
|
2826
|
+
};
|
|
2827
|
+
}
|
|
2828
|
+
interface RsSkipResult {
|
|
2829
|
+
/** RenderService frames with at least one skip event, ordered by `ts`. */
|
|
2830
|
+
frames: RsSkipFrame[];
|
|
2831
|
+
/** Every skip event assigned to a frame. */
|
|
2832
|
+
totalEvents: number;
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* Traces every RenderService skip back to the app frame that fed it.
|
|
2836
|
+
*
|
|
2837
|
+
* Both `appIpids` and `rsIpids` must already be resolved; an empty list matches
|
|
2838
|
+
* nothing rather than widening the query. `window` bounds the RenderService
|
|
2839
|
+
* frames and the skip events considered — the buffer and app-frame windows are
|
|
2840
|
+
* relative to each frame, so they may reach slightly outside it.
|
|
2841
|
+
*/
|
|
2842
|
+
declare function computeRsSkip(db: QueryHandle, opts: {
|
|
2843
|
+
window: TimeRange;
|
|
2844
|
+
appIpids: readonly number[];
|
|
2845
|
+
rsIpids: readonly number[];
|
|
2846
|
+
}): RsSkipResult;
|
|
2847
|
+
/**
|
|
2848
|
+
* Emits `rs_skip.*` metrics and one `rs_skip` evidence per RenderService frame
|
|
2849
|
+
* that skipped.
|
|
2850
|
+
*
|
|
2851
|
+
* `rs_skip.trace.accuracy` is traced / skip frames × 100 — HapRay's
|
|
2852
|
+
* `trace_accuracy`, emitted only when at least one skip frame exists. A trace
|
|
2853
|
+
* with no `render_service` process or no skip event produces one `no_data` item
|
|
2854
|
+
* naming what is missing rather than four fabricated zeros.
|
|
2855
|
+
*/
|
|
2856
|
+
declare class RsSkipAnalyzer implements Analyzer {
|
|
2857
|
+
readonly id = "rs-skip";
|
|
2858
|
+
readonly requires: CapabilityId[];
|
|
2859
|
+
run(ctx: AnalyzeContext): Promise<AnalyzeResult>;
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
/**
|
|
2863
|
+
* Folded flamegraph stacks from a perf capture.
|
|
2864
|
+
*
|
|
2865
|
+
* HapRay renders flamegraph HTML by shelling out to `perf -i` and a
|
|
2866
|
+
* flamegraph.pl script; neither works from a trace database alone, so this
|
|
2867
|
+
* analyzer produces the data a renderer needs instead of the HTML: folded
|
|
2868
|
+
* stacks (`a;b;c N`), weighted by `perf_sample.event_count`.
|
|
2869
|
+
*
|
|
2870
|
+
* ## What the numbers mean
|
|
2871
|
+
*
|
|
2872
|
+
* - `flamegraph.samples.count` — the app threads' summed sample weight, not a
|
|
2873
|
+
* row count. `event_count` is how many events each sample stands for.
|
|
2874
|
+
* - `flamegraph.app.share` — that weight over every sample in the database
|
|
2875
|
+
* × 100. On a capture filtered to the app this is 100; on a device-wide one
|
|
2876
|
+
* it is the app's slice of the profile.
|
|
2877
|
+
* - `flamegraph.stacks.count` — the number of distinct folded stacks in the
|
|
2878
|
+
* window. The `top.*` payload is cut to the heaviest 20; this count is not.
|
|
2879
|
+
* - `flamegraph.top.symbol` / `flamegraph.top.samples` — the leaf of the
|
|
2880
|
+
* heaviest folded stack and that stack's weight.
|
|
2881
|
+
*
|
|
2882
|
+
* These are **not** HapRay metrics: upstream reports flamegraph files, not
|
|
2883
|
+
* numbers. The definitions live here and in the test, not in a parity claim.
|
|
2884
|
+
*
|
|
2885
|
+
* Without `perf.db` there is nothing to fold, so the analyzer emits one
|
|
2886
|
+
* `flamegraph.degraded` proxy naming the capture requirements rather than five
|
|
2887
|
+
* zeros that read as "the app did nothing".
|
|
2888
|
+
*/
|
|
2889
|
+
declare class FlamegraphAnalyzer implements Analyzer {
|
|
2890
|
+
readonly id = "flamegraph";
|
|
2891
|
+
readonly requires: CapabilityId[];
|
|
2892
|
+
run(ctx: AnalyzeContext): Promise<AnalyzeResult>;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
/** HapRay's payload shape: the busiest component plus per-component counts. */
|
|
2896
|
+
interface ComponentReuse {
|
|
2897
|
+
max_component: string;
|
|
2898
|
+
/** The max component's build count, not the total across components. */
|
|
2899
|
+
total_builds: number;
|
|
2900
|
+
/** The max component's recycled builds. */
|
|
2901
|
+
recycled_builds: number;
|
|
2902
|
+
/** `round2HalfEven(recycled_builds / total_builds)`, or 0 when nothing built. */
|
|
2903
|
+
reusability_ratio: number;
|
|
2904
|
+
/** `[builds, recycled]` per component, in first-seen order. */
|
|
2905
|
+
details: Record<string, [number, number]>;
|
|
2906
|
+
}
|
|
2907
|
+
/**
|
|
2908
|
+
* Python's `round(value, 2)` for a non-negative double.
|
|
2909
|
+
*
|
|
2910
|
+
* Python rounds the **exact decimal value of the double** to two places,
|
|
2911
|
+
* breaking exact ties toward the even digit. `Math.round(value * 100) / 100`
|
|
2912
|
+
* is half-up and also rounds the already-rounded product, so it disagrees at
|
|
2913
|
+
* `0.125` (→ `0.13`) and agrees only by luck elsewhere.
|
|
2914
|
+
*
|
|
2915
|
+
* The decomposition below is exact: a finite double is `mantissa × 2^exponent`
|
|
2916
|
+
* with an integer mantissa, so the scaled value is a rational whose rounding
|
|
2917
|
+
* can be decided with integers alone.
|
|
2918
|
+
*/
|
|
2919
|
+
declare function round2HalfEven(value: number): number;
|
|
2920
|
+
/**
|
|
2921
|
+
* Counts builds and recycles per component and picks the busiest one.
|
|
2922
|
+
*
|
|
2923
|
+
* `ipids` must already be resolved. An empty list means "no app to scope to"
|
|
2924
|
+
* and matches every process, which is what makes the parity fixture
|
|
2925
|
+
* reproducible; a non-empty list restricts to `callstack` rows whose
|
|
2926
|
+
* `thread.id` belongs to one of those ipids. **The analyzer never passes an
|
|
2927
|
+
* empty list** — it degrades first, because a device-wide answer labelled as
|
|
2928
|
+
* the app's is worse than no answer. This function keeps the unscoped mode
|
|
2929
|
+
* because the parity golden needs it. Ties for the busiest component
|
|
2930
|
+
* resolve to the first one seen (rows are read `ORDER BY ts, id`), matching
|
|
2931
|
+
* HapRay's strict `>`.
|
|
2932
|
+
*/
|
|
2933
|
+
declare function computeComponentReuse(db: QueryHandle, opts: {
|
|
2934
|
+
ipids: readonly number[];
|
|
2935
|
+
}): ComponentReuse;
|
|
2936
|
+
/**
|
|
2937
|
+
* Emits the four `components.*` metrics and no evidence.
|
|
2938
|
+
*
|
|
2939
|
+
* There is no evidence kind for component reuse: a busy component is not a
|
|
2940
|
+
* fault, and HapRay reports it as a table rather than an issue. The reuse rate
|
|
2941
|
+
* and the top name are omitted when nothing was built, so a consumer never
|
|
2942
|
+
* reads a fabricated 0% as "the app reused nothing".
|
|
2943
|
+
*/
|
|
2944
|
+
declare class ComponentReuseAnalyzer implements Analyzer {
|
|
2945
|
+
readonly id = "components";
|
|
2946
|
+
readonly requires: CapabilityId[];
|
|
2947
|
+
run(ctx: AnalyzeContext): Promise<AnalyzeResult>;
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2626
2950
|
/**
|
|
2627
2951
|
* Runs every analyzer whose capability requirements are satisfied.
|
|
2628
2952
|
*
|
|
@@ -2664,6 +2988,22 @@ declare function defaultAnalyzers(): Analyzer[];
|
|
|
2664
2988
|
* when the process was not found.
|
|
2665
2989
|
*/
|
|
2666
2990
|
declare function resolveAppIdentity(processes: ProcessQuery, packageName: string): AppIdentity;
|
|
2991
|
+
/**
|
|
2992
|
+
* The `ipid` of every app pid, in `pids` order, without duplicates.
|
|
2993
|
+
*
|
|
2994
|
+
* `AppIdentity.pids` are **pids** while `thread.ipid`, `frame_slice.ipid`,
|
|
2995
|
+
* `process_measure_filter.ipid` and `app_startup.ipid` are **ipids**: the two
|
|
2996
|
+
* number spaces overlap, so comparing them directly silently reads another
|
|
2997
|
+
* process's rows (measured on the Mate 60: sceneboard has `pid=6500` and
|
|
2998
|
+
* `ipid=117`). `ProcessQuery.byPid` is the only safe translation, and it
|
|
2999
|
+
* resolves duplicate pids to the lowest row id (D5).
|
|
3000
|
+
*
|
|
3001
|
+
* `ipid` 0 is a NULL column, not a process — the query layer maps NULL to 0 —
|
|
3002
|
+
* so it is skipped, as are non-integers. An empty result means "no process
|
|
3003
|
+
* identified", which every caller must treat as "no data", never as
|
|
3004
|
+
* "device-wide".
|
|
3005
|
+
*/
|
|
3006
|
+
declare function resolveAppIpids(processes: ProcessQuery, pids: readonly number[]): number[];
|
|
2667
3007
|
|
|
2668
3008
|
/**
|
|
2669
3009
|
* Which way a metric improves.
|
|
@@ -2720,4 +3060,4 @@ interface BaselineComparison {
|
|
|
2720
3060
|
*/
|
|
2721
3061
|
declare function compareResults(baseline: AnalyzeResult, current: AnalyzeResult): BaselineComparison;
|
|
2722
3062
|
|
|
2723
|
-
export { type AnalyzeContext, type AnalyzeResult, type Analyzer, type AppIdentity, type BaselineComparison, type BelowThresholdPattern, type BinderAnalysis, BinderAnalyzer, type BinderEndpoint, type BinderEvent, type BinderInterfaceStat, type BinderProcessStat, BinderQuery, type BinderThreadStat, type BinderTransaction, type CallchainSample, type CallstackEvent, type CallstackEventWithArgs, CallstackQuery, type CapabilityId, type CapabilityInputs, CapabilityMatrix, type CapabilityState, type CollectOptions, type CollectSession, type Collector, type ConnectOptions, DEFAULT_QUERY_LIMIT, DEVICE_PERF_PATH, DEVICE_UI_PATH, type DeltaStatus, Device, type DeviceDeps, type DeviceIdentity, DeviceNotFoundError, type DrillDownHandle, type Env, type Evidence, type EvidenceKind, FPS_COMMAND, FTRACE_CATEGORIES, FaultTreeAnalyzer, type FaultTreeSignals, type Fidelity, type FpsBucket, type Frame, FrameAnalyzer, type FrameFlag, FrameQuery, type FrameStats, type FrameType, type FtraceOptions, HIPROFILER_PLUGIN_NAMES, HITCH_COMMAND, HITRACE_DEFAULT_CATEGORIES, Hdc, HdcNotFoundError, type HdcOptions, type HdcResult, type HdcTarget, type HidumperCapture, HidumperCollector, type HidumperSnapshot, type HiperfCapture, type HiperfCollectOptions, HiperfCollector, type HiprofilerCollectOptions, type HiprofilerCollectRequest, HiprofilerCollector, type HiprofilerConfigOptions, type HiprofilerPlugin, type HiprofilerPluginName, HitraceCollector, IngestError, InstantQuery, MAX_QUERY_LIMIT, METRIC_DIRECTIONS, MIN_BUFFER_PAGES, MemMeasureQuery, MemoryAnalyzer, MemoryMeasureAnalyzer, type MemoryPluginOptions, type Metric, type MetricDelta, type MetricDirection, type MetricUnit, type NamedQueryDefinition, type NamedQueryInfo, type NamedQueryResult, type NativehookOptions, OhosPerfError, type OptimizationPotential, PLANE_A_PLUGINS, type PerfCallchain, type PerfFunction, PerfQuery, type PerfSampleRow, type PerfThread, type ProbeResult, type ProbeRunner, type ProbeSnapshot, type ProcessInfo, type ProcessMeasure, type ProcessMeasureFilter, ProcessQuery, ProcfsCollector, type ProcfsSample, type ProcfsStatus, type Provenance, type QueryArgument, type QueryContext, type QueryHandle, type RedundancyLevel, type RedundancyType, type RedundantThreadPattern, type RedundantThreadsSummary, RenderAnalyzer, Scene, type SceneLayout, type SceneMetadata, SchedQuery, type SchedSlice, type SmapsRollup, StartupAnalyzer, StartupQuery, type StartupRecord, Streamer, StreamerNotFoundError, type StreamerOptions, type ThreadAnalysis, type ThreadAnalysisSummary, ThreadAnalyzer, type ThreadInfo, ThreadQuery, type ThreadState, ThreadStateQuery, type ThreadWakeupResult, type ThreadWakeupThread, type TimeRange, type TraceCollectOptions, type UiNode, UitestCollector, type WakeupEvent, type WindowHitches, analyzeThreadWakeup, buildHiprofilerConfig, buildMatrix, compareResults, computeBinderAnalysis, computeFaultTree, computeThreadAnalysis, connect, createSceneLayout, defaultAnalyzers, evidence, flattenUiTree, ftracePlugin, gpuPlugin, hiperfRecordCommand, ingestScene, lookupQuery, memoryPlugin, metric, nativehookPlugin, openDb, parseFpsCounts, parseHiperfSummary, parseHitches, parseProcfsStatus, parseSmapsRollup, queryDefinitions, readHidumperCapture, readProcfsSamples, readSceneMetadata, readUiTree, resolveAppIdentity, resolveQueryLimit, runAnalyzers, runDrillDown, runNamedQuery, runProbe, tableRowCounts, unknownQueryError, writeProcfsSamples, writeSceneMetadata, xpowerPlugin };
|
|
3063
|
+
export { type AnalyzeContext, type AnalyzeResult, type Analyzer, type AppIdentity, type BaselineComparison, type BelowThresholdPattern, type BinderAnalysis, BinderAnalyzer, type BinderEndpoint, type BinderEvent, type BinderInterfaceStat, type BinderProcessStat, BinderQuery, type BinderThreadStat, type BinderTransaction, type CallchainSample, type CallstackEvent, type CallstackEventWithArgs, CallstackQuery, type CapabilityId, type CapabilityInputs, CapabilityMatrix, type CapabilityState, type CollectOptions, type CollectSession, type Collector, type ComponentReuse, ComponentReuseAnalyzer, type ConnectOptions, DEFAULT_QUERY_LIMIT, DEVICE_PERF_PATH, DEVICE_UI_PATH, type DeltaStatus, Device, type DeviceDeps, type DeviceIdentity, DeviceNotFoundError, type DrillDownHandle, EmptyFrameAnalyzer, type EmptyFrameFilter, type Env, type Evidence, type EvidenceKind, FPS_COMMAND, FTRACE_CATEGORIES, FaultTreeAnalyzer, type FaultTreeSignals, type Fidelity, FlamegraphAnalyzer, type FoldedStack, type FpsBucket, type Frame, FrameAnalyzer, type FrameFlag, FrameQuery, type FrameStats, type FrameType, type FtraceOptions, GcAnalyzer, type GcSignals, HIPROFILER_PLUGIN_NAMES, HITCH_COMMAND, HITRACE_DEFAULT_CATEGORIES, Hdc, HdcNotFoundError, type HdcOptions, type HdcResult, type HdcTarget, type HidumperCapture, HidumperCollector, type HidumperSnapshot, type HiperfCapture, type HiperfCollectOptions, HiperfCollector, type HiprofilerCollectOptions, type HiprofilerCollectRequest, HiprofilerCollector, type HiprofilerConfigOptions, type HiprofilerPlugin, type HiprofilerPluginName, HitraceCollector, IngestError, InstantQuery, MAX_QUERY_LIMIT, METRIC_DIRECTIONS, MIN_BUFFER_PAGES, MemMeasureQuery, MemoryAnalyzer, MemoryMeasureAnalyzer, type MemoryPluginOptions, type Metric, type MetricDelta, type MetricDirection, type MetricUnit, type NamedQueryDefinition, type NamedQueryInfo, type NamedQueryResult, type NativehookOptions, OhosPerfError, type OptimizationPotential, PLANE_A_PLUGINS, type PerfCallchain, type PerfFunction, PerfQuery, type PerfSampleRow, type PerfThread, type ProbeResult, type ProbeRunner, type ProbeSnapshot, type ProcessInfo, type ProcessMeasure, type ProcessMeasureFilter, ProcessQuery, ProcfsCollector, type ProcfsSample, type ProcfsStatus, type Provenance, type QueryArgument, type QueryContext, type QueryHandle, type RedundancyLevel, type RedundancyType, type RedundantThreadPattern, type RedundantThreadsSummary, RenderAnalyzer, RsSkipAnalyzer, type RsSkipFrame, type RsSkipResult, Scene, type SceneLayout, type SceneMetadata, SchedQuery, type SchedSlice, type SmapsRollup, StartupAnalyzer, StartupQuery, type StartupRecord, Streamer, StreamerNotFoundError, type StreamerOptions, type ThreadAnalysis, type ThreadAnalysisSummary, ThreadAnalyzer, type ThreadInfo, ThreadQuery, type ThreadState, ThreadStateQuery, type ThreadWakeupResult, type ThreadWakeupThread, type TimeRange, type TraceCollectOptions, type UiNode, UitestCollector, type VsyncAnalysis, VsyncAnalyzer, type VsyncPeriod, type VsyncPeriodKind, type VsyncSeverity, type WakeupEvent, type WindowHitches, analyzeThreadWakeup, buildHiprofilerConfig, buildMatrix, compareResults, computeBinderAnalysis, computeComponentReuse, computeFaultTree, computeGc, computeRsSkip, computeThreadAnalysis, computeVsyncAnomalies, connect, createSceneLayout, defaultAnalyzers, evidence, filterEmptyFrames, flattenUiTree, ftracePlugin, gpuPlugin, hiperfRecordCommand, ingestScene, lookupQuery, memoryPlugin, metric, nativehookPlugin, openDb, parseFpsCounts, parseHiperfSummary, parseHitches, parseProcfsStatus, parseSmapsRollup, queryDefinitions, readHidumperCapture, readProcfsSamples, readSceneMetadata, readUiTree, resolveAppIdentity, resolveAppIpids, resolveQueryLimit, round2HalfEven, runAnalyzers, runDrillDown, runNamedQuery, runProbe, tableRowCounts, unknownQueryError, writeProcfsSamples, writeSceneMetadata, xpowerPlugin };
|