• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# HiDumper<a name="EN-US_TOPIC_0000001116225437"></a>
2
3  - [Introduction](#section11660541593)
4  - [Directory Structure](#section161941989596)
5  - [Usage](#section1312121216216)
6    - [How to Use](#section129654513264)
7  - [Repositories Involved](#section1371113476307)
8
9## Introduction<a name="section11660541593"></a>
10
11HiDumper is a unified system information collection tool provided by OpenHarmony for development and test personnel to analyze and locate faults.
12
13HiDumper consists of the following modules:
14
15-   hidumper: Serves as the executable program of HiDumper, which receives user input and communicates with the server.
16-   DumpManager: Serves as the manager of HiDumper, which provides functions such as information classification, command request distribution, and information collection.
17-   Dumpers: Exports various information, including file information, command information, CPU usage, and memory usage.
18-   Output: Outputs various contents. This module consists of two parts: FdOutput for standard output or file output and ZipOutput for compressed output.
19
20**Figure 1** HiDumper architecture
21
22![](figures/en-us_image_0000001116226343.png)
23
24## Directory Structure<a name="section161941989596"></a>
25
26```
27/base/hiviewdfx/hidumper
28├── client                # Client code
29│   ├── native            # Native code
30├── frameworks            # Framework code
31│   ├── native            # Core function code
32|   |   |── include        # Header files
33|   |   |── src           # Source files
34|   |       |── common    # Common function code
35|   |       |── executor  # Process executor code
36|   |       |── factory   # Factory code
37|   |       |── manager   # Core manager code
38|   |       |── util      # Utility code
39|── sa_profile            # HiDumper SA profile
40|── services              # HiDumper service code
41|   |── native            # C++ service code
42|   |── zidl              # Communication function
43|   |   |── include       # Header files of the communication function
44|   |   |── src           # Source code of the communication function
45├── test                  # Test cases
46│   ├── unittest          # Unit test code
47│   ├── moduletest        # Module-level test code
48```
49
50## Usage<a name="section1312121216216"></a>
51
52During OpenHarmony application development, you can use HiDumper to query system information, service information, and process stack information, and then use the information to analyze and locate faults.
53
54
55### How to Use<a name="section129654513264"></a>
56
57HiDumper helps you export basic system information to locate and analyze faults. When passing complex parameters to sub-services and abilities, enclose parameters in double quotation marks.
58
59The procedure is as follows:
60
611.  Access the device CLI, and run the **hidumper -h** command to obtain the help information, which includes basic information and function syntax.
62
63    ```
64    hidumper -h
65    ```
66
672.  Run the **hidumper -lc** command to obtain the system information cluster list.
68
69    ```
70    hidumper -lc
71    ```
72
733.  Run the **hidumper -c** command to obtain all information that is classified by **base** and **system**.
74
75    ```
76    hidumper -c
77    ```
78
794.  Run the **hidumper -c [base | system]** to obtain the system cluster information that is classified by **base** or **system**.
80
81    ```
82    hidumper -c base
83    hidumper -c system
84    ```
85
865.  Run the **hidumper -ls** command to obtain the system ability list.
87
88    ```
89    hidumper -ls
90    ```
91
926.  Run the **hidumper -s** command to obtain all system ability information.
93
94    ```
95    hidumper -s
96    ```
97
987.  Run the **hidumper -s 3301 -a "-h"** command to obtain the help information about the ability whose ID is **3301**.
99
100    ```
101    hidumper -s 3301  -a "-h"
102    ```
103
1048.  Run the **hidumper -s 3008** command to obtain all information about the ability whose ID is **3008**.
105
106    ```
107    hidumper -s 3008
108    ```
109
1109.  Run the **hidumper -e** command to obtain the crash information generated by the Faultlog module.
111
112    ```
113    hidumper -e
114    ```
115
11610. Run the **hidumper --net** command to obtain network information of the process whose PID has been specified.
117
118    ```
119    hidumper --net
120    hidumper --net 1024
121    ```
122
12311. Run the **hidumper --storage** command to obtain storage information of the process whose PID has been specified.
124
125    ```
126    hidumper --storage
127    hidumper --storage 1024
128    ```
12912. Run the **hidumper -p** command to obtain process information, including the list and information of processes and threads.
130
131    ```
132    hidumper -p
133    ```
134
13513. Run the **hidumper -p 1024** command to obtain information about the process whose PID is **1024**.
136
137    ```
138    hidumper -p 1024
139    ```
140
14114. Run the **hidumper --cpuusage [pid]** command to obtain the CPU usage information of the process whose PID has been specified.
142
143    ```
144    hidumper --cpuusage
145    hidumper --cpuusage 1024
146    ```
147
14815. Run the **hidumper --cpufreq** command to obtain the actual operating frequency of each CPU core.
149
150    ```
151    hidumper --cpufreq
152    ```
153
15416. Run the **hidumper --mem [pid] [--prune] [--show-ashmem] [--show-dmabuf]** command to obtain all memory usage information of the process whose PID has been specified; If --prune is specified, export simplified memory infomation quickly; By specified the specific PID and time, the memory change information of PID can be printed out.If the --show-ashmem option is specified, detailed information regarding ashmem usage will be appended to the output. For application processes, when the --show-dmabuf flag is enabled, comprehensive details pertaining to DMA memory will be additionally printed.
155
156    ```
157    hidumper --mem
158    hidumper --mem 1024
159    hidumper --mem --prune
160    hidumper --mem 1 -t 1
161    hidumper --mem 1024 --show-ashmem
162    hidumper --mem 1024 --show-dmabuf
163    ```
164
16517. Run the **hidumper --zip** command to compress data to the **/data/log/hidumper** directory.
166
167    ```
168    hidumper --zip
169    ```
170
17118. Run the **hidumper --mem-smaps pid [-v]** The pid parameter is mandatory.Run the following command to query the detailed memory usage of a specified process.
172
173    ```
174    hidumper --zip
175    ```
176
17719. run the **hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj] [--raw]** The pid parameter is mandatory.Run the following command to trigger all threads gc and export snapshot.If -T is specified, only the thread's GC and snapshot export will be triggered; If --gc is specified, only trigger GC without doing snapshot export; If --leakobj is specified, obtain the list of leaked objects; If --raw is specified, fast export snapshot in binary format.
178
179    ```
180    hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj] [--raw]
181    ```
182
18320. run the **hidumper --mem-cjheap pid [--gc]** The pid parameter is mandatory and belongs to the Cangjie process. Run the following command to trigger gc and export snapshot. If --gc is specified, only trigger GC without doing snapshot export. Use the cjprof tool provided in the Cangjie SDK to pares and view snapshot files.
184
185    ```
186    hidumper --mem-cjheap pid [--gc]
187    ```
188
189## Repositories Involved<a name="section1371113476307"></a>
190
191[DFX Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/dfx.md)
192
193[hiviewdfx_hilog](https://gitee.com/openharmony/hiviewdfx_hilog/blob/master/README.md)
194
195[hiviewdfx_faultloggerd](https://gitee.com/openharmony/hiviewdfx_faultloggerd/blob/master/README.md)
196
197[hiviewdfx_hidumper](https://gitee.com/openharmony/hiviewdfx_hidumper/blob/master/README.md)