1# HiDumper 2 3HiDumper is a command-line tool used to export essential system information for analyzing and locating issues. 4 5## Prerequisites 6 7- The [environment setup](hdc.md#environment-setup) is complete. 8 9- The devices are properly connected. 10 11## Command Description 12 13| Commands| Description| 14| -------- | -------- | 15| -h | Displays help information.| 16| -lc | Lists system information clusters.| 17| -ls | Lists system capabilities.| 18| -c | Obtains detailed information about the system information cluster.| 19| -s | Obtains detailed information about all system capabilities.| 20| -s [SA] -a ["option"] | Executes a specific option of a system capability. **SA** indicates a system capability, and **option** indicates an option supported by the system capability. You can run **-s [SA] -a ["-h"]** to obtain all options supported by a system capability.| 21| -e | Obtains crash logs.| 22| --net [pid] | Obtains network information. If **pid** is specified, obtains only the network traffic usage of the specified process.| 23| --storage [pid] | Obtains storage information. If **pid** is specified, obtains the I/O information of the specified process.| 24| -p [pid] | Obtains all process and thread information.| 25| --cpuusage [pid] | Obtains the CPU usage by process and category. If **pid** is specified, obtains the CPU usage of the specified process.| 26| --cpufreq | Obtains the actual CPU frequency.| 27| --mem [pid] | Obtains the total memory usage. If **pid** is specified, obtains the memory usage of the specified process.| 28| --zip | Saves the exported compressed file to **/data/log/hidumper**.| 29| --ipc pid/-a --start-stat/stop-stat/stat | Collects the IPC statistics of a process in a period of time. **-a** is used to collect the IPC statistics of all processes, **--start-stat** is used to start collecting statistics, **--stat** is used to obtain statistics, and **--stop-stat** is used to stop collecting statistics.| 30| --mem-smaps pid [-v] | Obtains the memory usage of a specified process from **/proc/pid/smaps**. **-v** is used to specify more details about the process. This command is only available in the Debug version.| 31| --mem-jsheap pid [-T tid] [--gc] [--leakobj] | Triggers the Garbage Collection (GC) and exports the snapshot of all threads. **pid** is mandatory. If **tid** is specified, triggers the GC and exports the snapshot of the specified thread. If **--gc** is specified, triggers the GC but not exports the snapshot. If **--leakobj** is specified, obtains the list of leaked objects.| 32 33## Examples 34 351. Display help information. 36 37 ``` 38 hidumper -h 39 ``` 40 41 **Example** 42 43  44 452. Obtain memory usage of the specified process on the device. 46 47 ``` 48 hidumper --mem pid 49 ``` 50 51 **Example** 52 53  54 55 The **Graph** field represents the memory size used by the process in the **/proc/process_dmabuf_info** node. 56 573. Obtain memory usage of all processes. 58 59 ``` 60 hidumper --mem 61 ``` 62 63 **Example** 64 65  66 674. Obtain CPU usage, which is displayed by process and category. 68 69 ``` 70 hidumper --cpuusage 71 ``` 72 73 **Example** 74 75  76 775. Obtain CPU usage of the specified process. 78 79 ``` 80 hidumper --cpuusage pid 81 ``` 82 83 **Example** 84 85  86 876. List system capabilities. 88 ``` 89 hidumper -ls 90 ``` 91 92 **Example** 93 94  95 967. Obtain detailed information about all system capabilities. 97 98 ``` 99 hidumper -s 100 ``` 101 102 **Example** 103 104  105 106 107 Obtain the help information about **RenderService**. 108 109 ``` 110 hidumper -s RenderService -a "h" 111 ``` 112 113 **Example** 114 115  116 1178. Obtain the refresh frame rate of a surface. 118 119 ``` 120 hidumper -s RenderService -a "surface_name fps" 121 ``` 122 123 **Example** 124 125  126 1279. Obtain the crash information generated by the Faultlog module. 128 129 ``` 130 hidumper -e 131 ``` 132 133 **Example** 134 135  136 13710. Obtain network information. Specify **pid** to obtain the network traffic usage of the specified process. 138 139 ``` 140 hidumper --net 141 ``` 142 143 **Example** 144 145  146 14711. Obtain all process and thread information. 148 149 ``` 150 hidumper -p 151 ``` 152 153 **Example** 154 155  156 15712. Collect IPC statistics of the process in a period. Use **-a** to collect the IPC statistics of all processes. Specify **pid** to collect the IPC statistics of the specified process. Use **--start-stat** to start collecting statistics, use **--stat:** to obtain statistics, and use **--stop-stat** to stop collecting statistics. 158 159 ``` 160 hidumper --ipc pid --start-stat 161 hidumper --ipc pid --stat 162 hidumper --ipc pid --stop-stat 163 ``` 164 165 **Example** 166 167  168 16913. Export the detailed memory usage of the specified process. 170 171 ``` 172 hidumper --mem-smaps pid [-v] 173 ``` 174 175 > **Note** 176 > 177 > This command is available only in the Debug version and is unavailable in the Release version. 178 > 179 > How to distinguish the Debug and Release versions: 180 > 181 > 1. Run the **hdc shell "param get|grep const.debuggable"** command to check whether the output is **0** or **1**. 182 > 183 > 2. Run the **hdc shell "param get|grep const.product.software.version"** command to check whether the current version contains the **log** string. 184 > 185 > The Release version outputs **0** and does not contain the **log** string. 186 > 187 > The Debug version outputs **1** and contain the **log** string. 188 189 **Example** 190 191  192 19314. Run the **hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj]** command to trigger GC and export snapshot of all threads. **pid** is mandatory. Specify **tid** to trigger GC and export snapshot of the specified thread. Specify **--gc** to trigger GC but not to export snapshot. Specify **--leakobj** to obtain the list of leaked objects. This command is only available in the Debug version. 194 195 ``` 196 hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj] 197 ``` 198 199 > **Note** 200 > 201 > In the Release version, this command can be used to export the snapshot information of the debugging applications. 202 > 203 > For details about how to distinguish the Debug and Release versions, see the last example. 204 > 205 > The path of the jsheap file: **/data/log/faultlog/temp or /data/log/reliability/resource_leak/memory_leak**. 206 207 **Example** 208 209  210