> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
You can run the hidebug command to obtain the memory usage of an application, including the static heap memory (native heap) and proportional set size (PSS) occupied by the application process. You can also export VM memory slices and collect VM CPU profiling data.
## Modules to Import
```
```js
importhidebugfrom'@ohos.hidebug';
```
...
...
@@ -18,9 +18,11 @@ getNativeHeapSize(): bigint
Obtains the total size of the native heap memory.
This API is defined but not implemented in OpenHarmony 3.1 Release.
@@ -135,9 +182,9 @@ Starts the profiling method. `startProfiling()` and `stopProfiling()` are called
```js
hidebug.startProfiling("cpuprofiler-20220216");
// Code block
// code block
// ...
// Code block
// code block
hidebug.stopProfiling();
```
...
...
@@ -147,7 +194,7 @@ hidebug.stopProfiling();
stopProfiling() : void
Stops the profiling method. `stopProfiling()` and `startProfiling()` are called in pairs. `stopProfiling()` always occurs after `startProfiling()`; that is, calling the functions in the following sequences is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`.
Stops the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the following sequences is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`.
| filename | string | Yes | User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the app based on the specified `filename`.|
...
...
@@ -180,3 +227,31 @@ Exports the heap data.
```js
hidebug.dumpHeapData("heap-20220216");
```
## hidebug.getServiceDump<sup>9+<sup>
getServiceDump(serviceid : number) : string
Obtains information on the specified system service.
This is a system API and cannot be called by third-party applications.