@onekeyfe/react-native-perf-memory 3.0.162 → 3.0.163
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 +47 -0
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @onekeyfe/react-native-perf-memory
|
|
2
|
+
|
|
3
|
+
Native process memory sampling for OneKey React Native applications on iOS and
|
|
4
|
+
Android. The Nitro module returns one numeric byte count under the historical
|
|
5
|
+
`rss` field. Callers own sampling frequency, aggregation and presentation;
|
|
6
|
+
the package does not start a recurring sampler or upload measurements.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
yarn add @onekeyfe/react-native-perf-memory react-native-nitro-modules
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Install the application's iOS pods and rebuild the native application. The
|
|
15
|
+
measurement is performed by native code and requires the Nitro runtime.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { ReactNativePerfMemory } from '@onekeyfe/react-native-perf-memory';
|
|
21
|
+
|
|
22
|
+
const { rss } = await ReactNativePerfMemory.getMemoryUsage();
|
|
23
|
+
const memoryMiB = rss / (1024 * 1024);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Measurement semantics
|
|
27
|
+
|
|
28
|
+
`getMemoryUsage()` returns `Promise<{ rss: number }>` with the value in bytes.
|
|
29
|
+
Despite the shared field name, the preferred measurements differ:
|
|
30
|
+
|
|
31
|
+
| Platform | Preferred sample | Fallback |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| iOS | Mach `phys_footprint` | Mach resident size, then zero. |
|
|
34
|
+
| Android | `/proc/self/status` VmRSS | ActivityManager total PSS converted from KiB, then zero. |
|
|
35
|
+
|
|
36
|
+
A zero result can indicate that a measurement could not be obtained. It is not
|
|
37
|
+
proof that the application has no memory usage. The number covers native process
|
|
38
|
+
memory rather than only the JavaScript heap, and should not be compared across
|
|
39
|
+
platforms as if both use an identical accounting method.
|
|
40
|
+
|
|
41
|
+
Use bounded sampling intervals suited to diagnostics rather than requesting a
|
|
42
|
+
sample on every render. The exported interface is defined in
|
|
43
|
+
[src/ReactNativePerfMemory.nitro.ts](src/ReactNativePerfMemory.nitro.ts).
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
MIT.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-perf-memory",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.163",
|
|
4
|
+
"description": "Native process memory sampling for OneKey on iOS and Android",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -50,14 +50,15 @@
|
|
|
50
50
|
],
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/OneKeyHQ/app-modules
|
|
53
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
54
|
+
"directory": "native-modules/react-native-perf-memory"
|
|
54
55
|
},
|
|
55
56
|
"author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
56
57
|
"license": "MIT",
|
|
57
58
|
"bugs": {
|
|
58
|
-
"url": "https://github.com/OneKeyHQ/app-modules/
|
|
59
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
59
60
|
},
|
|
60
|
-
"homepage": "https://github.com/OneKeyHQ/app-modules/react-native-perf-memory#readme",
|
|
61
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-perf-memory#readme",
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"registry": "https://registry.npmjs.org/"
|
|
63
64
|
},
|