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 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]** command to obtain all memory usage information of the process whose PID has been specified. 155 156 ``` 157 hidumper --mem 158 hidumper --mem 1024 159 ``` 160 16117. Run the **hidumper --zip** command to compress data to the **/data/log/hidumper** directory. 162 163 ``` 164 hidumper --zip 165 ``` 166 16718. 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. 168 169 ``` 170 hidumper --zip 171 ``` 172 17319. run the **hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj]** 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. 174 175 ``` 176 hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj] 177 ``` 178 179## Repositories Involved<a name="section1371113476307"></a> 180 181[DFX Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/dfx.md) 182 183[hiviewdfx_hilog](https://gitee.com/openharmony/hiviewdfx_hilog/blob/master/README.md) 184 185[hiviewdfx_faultloggerd](https://gitee.com/openharmony/hiviewdfx_faultloggerd/blob/master/README.md) 186 187[hiviewdfx_hidumper](https://gitee.com/openharmony/hiviewdfx_hidumper/blob/master/README.md)