@ohos-perf/core 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +53 -2
- package/dist/index.d.ts +3063 -0
- package/dist/index.js +8976 -0
- package/package.json +46 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 growvv
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ohos-perf/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
HarmonyOS performance analysis as a typed library: capability probing, six
|
|
4
|
+
collectors, `trace_streamer` ingest, typed queries over the resulting SQLite
|
|
5
|
+
databases, and analyzers that emit metrics with provenance and fidelity.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ohos-perf/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Node `^22.13.0 || >=23.4.0`. `hdc` and `trace_streamer` from a DevEco
|
|
14
|
+
Studio installation are needed for live capture and ingest; offline analysis of
|
|
15
|
+
an existing `trace.db` needs neither.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
connect, FrameQuery, ProcessQuery, FrameAnalyzer,
|
|
22
|
+
} from '@ohos-perf/core';
|
|
23
|
+
|
|
24
|
+
const device = await connect();
|
|
25
|
+
const caps = await device.capabilities();
|
|
26
|
+
|
|
27
|
+
const scene = await device.collect({
|
|
28
|
+
app: 'com.example.app',
|
|
29
|
+
durationMs: 10_000,
|
|
30
|
+
sceneRoot: 'scenes/demo',
|
|
31
|
+
}).ingest();
|
|
32
|
+
|
|
33
|
+
const processes = new ProcessQuery(scene.traceDb);
|
|
34
|
+
const result = await new FrameAnalyzer().run({
|
|
35
|
+
frames: new FrameQuery(scene.traceDb),
|
|
36
|
+
processes,
|
|
37
|
+
app: { packageName: 'com.example.app', pids: [], processNames: [] },
|
|
38
|
+
window: { startNs: 0, endNs: Number.MAX_SAFE_INTEGER },
|
|
39
|
+
caps,
|
|
40
|
+
deviceId: device.id,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
console.log(result.metrics); // Metric[] with provenance + fidelity
|
|
44
|
+
console.log(result.evidence); // Evidence[] with drill-down handles
|
|
45
|
+
scene.close();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Every metric carries `fidelity` (`exact`, `approximate`, `proxy`) and
|
|
49
|
+
`provenance` (collector, table, rows, device). A missing capability is a value
|
|
50
|
+
with a `reason`, never a silent zero.
|
|
51
|
+
|
|
52
|
+
- Website: <https://growvv.github.io/ohos-perf/>
|
|
53
|
+
- Source and full documentation: <https://github.com/growvv/ohos-perf>
|
|
54
|
+
- License: MIT
|