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