1# HiDumper 2 3 4## Overview 5 6HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool engineers to obtain system information necessary for analyzing and locating faults. This section applies only to the standard system. 7 8## Source Code Directories 9 10 11``` 12/base/hiviewdfx/hidumper 13├── frameworks # Framework code 14│ ├── native # Core function code 15│ │ │── include # Header files 16│ │ │── src # Source files 17│ │ │── common # Common function code 18│ │ │── executor # Process executor code 19│ │ │── factory # Factory code 20│ │ │── manager # Core manager code 21│ │ │── util # Utility source code 22│── sa_profile # HiDumper SA profile 23│── services # HiDumper service code 24│ │── native # C++ service code 25│ │── zidl # Communication function 26│ │ │── include # Header files of the communication function 27│ │ │── src # Source code of the communication function 28├── test # Test cases 29│ ├── unittest # Unit test code 30│ ├── moduletest # Module-level test code 31``` 32 33 34# Usage 35 36 37## Command-Line Options 38 39 **Table 1** HiDumper command-line options 40 41| Option| **Description**| 42| -------- | -------- | 43| -h | Shows the help Information.| 44| -t [timeout] | Specifies the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.| 45| -lc | Shows the system information cluster list.| 46| -ls | Shows the system ability list.| 47| -c | Exports system cluster information.| 48| -c [base system] | Exports system cluster information based on **base** or **system** tags.| 49| -s | Exports all system ability information.| 50| -s [SA0 SA1] | Exports ability information corresponding to SA0 and SA1.| 51| -s [SA] -a ['-h'] | Exports the system ability information **SA** using the **-h** parameter.| 52| -e | Exports crash logs generated by the FaultLogger module.| 53| --net [pid] | Exports network information. If **pid** is specified, the network information of the corresponding process is exported.| 54| --storage [pid] | Exports storage information. If **pid** is specified, the I/O information of the corresponding process is exported.| 55| -p | Exports the process list and all process information.| 56| -p [pid] | Exports all information about the specified process.| 57| --cpuusage [pid] | Exports the CPU usage information. If **pid** is specified, the CPU usage of the corresponding process is exported.| 58| --cpufreq | Exports the actual CPU frequency.| 59| --mem [pid] | Export memory usage information. If **pid** is specified, the memory usage of the corresponding process is exported.| 60| --zip | Compresses the exported information to a specified folder.| 61 62 63## Development Example 64 65HiDumper helps you export basic system information to locate and analyze faults. Complex parameters passed to sub-services and abilities must be enclosed in double quotation marks. 66 67The procedure is as follows: 68 691. Access the device CLI, and run the **hidumper -h** command to obtain the help information, which includes basic information and function syntax. 70 71 ``` 72 hidumper -h 73 ``` 74 752. Run the **hidumper -lc** command to obtain the system information cluster list. 76 77 ``` 78 hidumper -lc 79 ``` 80 813. Run the **hidumper -c** command to obtain all information that is classified by **base** and **system**. 82 83 ``` 84 hidumper -c 85 ``` 86 874. Run the **hidumper -c [base | system]** to obtain the system cluster information that is classified by **base** or **system**. 88 89 ``` 90 hidumper -c base 91 hidumper -c system 92 ``` 93 945. Run the **hidumper -ls** command to obtain the system ability list. 95 96 ``` 97 hidumper -ls 98 ``` 99 1006. Run the **hidumper -s** command to obtain all system ability information. 101 102 ``` 103 hidumper -s 104 ``` 105 1067. Run the **hidumper -s 3301 -a "-h"** command to obtain the help information about the ability whose ID is **3301**. 107 108 ``` 109 hidumper -s 3301 -a "-h" 110 ``` 111 1128. Run the **hidumper -s 3008** command to obtain all information about the ability whose ID is **3008**. 113 114 ``` 115 hidumper -s 3008 116 ``` 117 1189. Run the **hidumper -e** command to obtain the crash information generated by the FaultLogger module. 119 120 ``` 121 hidumper -e 122 ``` 123 12410. Run the **hidumper --net** command to obtain network information of the process whose PID has been specified. 125 126 ``` 127 hidumper --net 128 hidumper --net 1024 129 ``` 130 13111. Run the **hidumper --storage** command to obtain storage information of the process whose PID has been specified. 132 133 ``` 134 hidumper --storage 135 hidumper --storage 1024 136 ``` 137 13812. Run the **hidumper -p** command to obtain process information, including the list and information of processes and threads. 139 140 ``` 141 hidumper -p 142 ``` 143 14413. Run the **hidumper -p 1024** command to obtain information about the process whose PID is **1024**. 145 146 ``` 147 hidumper -p 1024 148 ``` 149 15014. Run the **hidumper --cpuusage [pid]** command to obtain the CPU usage information. If the PID of a process is specified, only the CPU usage of the process is returned. 151 152 ``` 153 hidumper --cpuusage 154 hidumper --cpuusage 1024 155 ``` 156 15715. Run the **hidumper --cpufreq** command to obtain the actual operating frequency of each CPU core. 158 159 ``` 160 hidumper --cpufreq 161 ``` 162 16316. Run the **hidumper --mem [pid]** command to obtain all memory usage information. If the PID of a process is specified, only the memory usage of the process is returned. 164 165 ``` 166 hidumper --mem [pid] 167 ``` 168 The following table describes the parameters in the first column of the command output when the PID of the process is specified. 169 | Name | Description| 170 |----------------|----| 171 | GL | GPU memory. | 172 | Graph | Graphics memory. | 173 | ark ts heap | Memory usage of the ArkTS heap. | 174 | guard | Memory occupied by the protection section. | 175 | native heap | Heap memory. | 176 | AnonPage other | Memory occupied by other pages that are not mapped to files. | 177 | stack | Stack memory. | 178 | .hap | Memory occupied by the application. | 179 | .db | Memory occupied by the **.db** files loaded by processes. | 180 | .so | Memory occupied by the **.so** dynamic library files loaded by processes. | 181 | .ttf | Memory occupied by the **.ttf** font files loaded by processes. | 182 | dev | Memory occupied by the files that are named with the **/dev** prefix and loaded by processes. | 183 | FilePage other | Memory occupied by other pages that are mapped to files. | 184 18517. Run the **hidumper --zip** command to compress data to the **/data/dumper** directory. 186 187 ``` 188 hidumper --zip 189 ``` 190 19118. Run the **hidumper -t timeout** command to set the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit. 192 193 ``` 194 hidumper -t [timeout] 195 ``` 196 19719. Run the **hidumper --mem-smaps pid [-v]** command to obtain the detailed memory usage of the specified process. 198 199 ``` 200 hidumper --mem-smaps pid [-v] 201 ``` 202