README.md
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.
117
118 ```
119 hidumper --net
120 ```
121
12211. Run the **hidumper --storage** command to obtain storage information.
123
124 ```
125 hidumper --storage
126 ```
12712. Run the **hidumper -p** command to obtain process information, including the list and information of processes and threads.
128
129 ```
130 hidumper -p
131 ```
132
13313. Run the **hidumper -p 1024** command to obtain information about the process whose PID is **1024**.
134
135 ```
136 hidumper -p 1024
137 ```
138
13914. Run the **hidumper --cpuusage [pid]** command to obtain the CPU usage information of the process whose PID has been specified.
140
141 ```
142 hidumper --cpuusage
143 hidumper --cpuusage 1024
144 ```
145
14615. Run the **hidumper --cpufreq** command to obtain the actual operating frequency of each CPU core.
147
148 ```
149 hidumper --cpufreq
150 ```
151
15216. Run the **hidumper --mem [pid]** command to obtain all memory usage information of the process whose PID has been specified.
153
154 ```
155 hidumper --mem
156 hidumper --mem 1024
157 ```
158
15917. Run the **hidumper --zip** command to compress data to the **/data/log/hidumper** directory.
160
161 ```
162 hidumper --zip
163 ```
164
16518. 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.
166
167 ```
168 hidumper --zip
169 ```
170
171## Repositories Involved<a name="section1371113476307"></a>
172
173[DFX Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/dfx.md)
174
175[hiviewdfx_hilog](https://gitee.com/openharmony/hiviewdfx_hilog/blob/master/README.md)
176
177[hiviewdfx_faultloggerd](https://gitee.com/openharmony/hiviewdfx_faultloggerd/blob/master/README.md)
178
179[hiviewdfx_hidumper](https://gitee.com/openharmony/hiviewdfx_hidumper/blob/master/README.md)