subsys-dfx-hidumper.md 5.7 KB
Newer Older
S
shawn_he 已提交
1
# HiDumper
S
shawn_he 已提交
2 3 4 5 6 7


## Overview

HiDumper 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.

S
shawn_he 已提交
8
## Source Code Directories
S
shawn_he 已提交
9 10 11 12 13 14

  
```
/base/hiviewdfx/hidumper
├── frameworks           # Framework code
│   ├── native           # Core function code
S
shawn_he 已提交
15
│   │  │── include       # Header files
S
shawn_he 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
│   │  │── src           # Source files
│   │      │── common    # Common function code
│   │      │── executor  # Process executor code
│   │      │── factory   # Factory code
│   │      │── manager   # Core manager code
│   │      │── util      # Utility source code
│── sa_profile           # HiDumper SA profile
│── services             # HiDumper service code
│   │── native           # C++ service code
│   │── zidl             # Communication function
│   │   │── include      # Header files of the communication function
│   │   │── src          # Source code of the communication function
├── test                 # Test cases
│   ├── unittest         # Unit test code
│   ├── moduletest       # Module-level test code
```


S
shawn_he 已提交
34
# Usage
S
shawn_he 已提交
35 36


S
shawn_he 已提交
37
## Command-Line Options
S
shawn_he 已提交
38 39 40

  **Table 1** HiDumper command-line options

S
shawn_he 已提交
41
| Option| **Description**| 
S
shawn_he 已提交
42 43 44 45 46 47 48 49 50 51
| -------- | -------- |
| -h | Shows the help Information.| 
| -t [timeout] | Specifies the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.| 
| -lc | Shows the system information cluster list.| 
| -ls | Shows the system ability list.| 
| -c | Exports system cluster information.| 
| -c [base system] | Exports system cluster information based on **base** or **system** tags.| 
| -s | Exports all system ability information.| 
| -s [SA0 SA1] | Exports ability information corresponding to SA0 and SA1.| 
| -s [SA] -a ['-h'] | Exports the system ability information **SA** using the **-h** parameter.| 
S
shawn_he 已提交
52
| -e | Exports crash logs generated by the FaultLogger module.| 
S
shawn_he 已提交
53 54 55
| --net | Exports network information.| 
| --storage | Exports storage information.| 
| -p | Exports the process list and all process information.| 
S
shawn_he 已提交
56 57
| -p [pid] | Exports all information about the specified process.| 
| --cpuusage [pid] | Exports the CPU usage information. If **pid** is specified, the CPU usage of the corresponding process is exported.| 
S
shawn_he 已提交
58
| --cpufreq | Exports the actual CPU frequency.| 
S
shawn_he 已提交
59
| --mem [pid] | Export memory usage information. If **pid** is specified, the memory usage of the corresponding process is exported.| 
S
shawn_he 已提交
60 61 62
| --zip | Compresses the exported information to a specified folder.| 


S
shawn_he 已提交
63
## Development Example
S
shawn_he 已提交
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117

HiDumper 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.

The procedure is as follows:

1. Access the device CLI, and run the **hidumper -h** command to obtain the help information, which includes basic information and function syntax.
     
   ```
   hidumper -h
   ```

2. Run the **hidumper -lc** command to obtain the system information cluster list.
     
   ```
   hidumper -lc
   ```

3. Run the **hidumper -c** command to obtain all information that is classified by **base** and **system**.
     
   ```
   hidumper -c
   ```

4. Run the **hidumper -c [base | system]** to obtain the system cluster information that is classified by **base** or **system**.
     
   ```
   hidumper -c base
   hidumper -c system
   ```

5. Run the **hidumper -ls** command to obtain the system ability list.
     
   ```
   hidumper -ls
   ```

6. Run the **hidumper -s** command to obtain all system ability information.
     
   ```
   hidumper -s
   ```

7. Run the **hidumper -s 3301 -a "-h"** command to obtain the help information about the ability whose ID is **3301**.
     
   ```
   hidumper -s 3301 -a "-h"
   ```

8. Run the **hidumper -s 3008** command to obtain all information about the ability whose ID is **3008**.
     
   ```
   hidumper -s 3008
   ```

S
shawn_he 已提交
118
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLoger module.
S
shawn_he 已提交
119 120 121 122 123 124 125
     
   ```
   hidumper -e
   ```

10. Run the **hidumper --net** command to obtain network information.
     
S
shawn_he 已提交
126 127 128
    ```
    hidumper --net
    ```
S
shawn_he 已提交
129 130 131

11. Run the **hidumper --storage** command to obtain storage information.
     
S
shawn_he 已提交
132 133 134
    ```
    hidumper --storage
    ```
S
shawn_he 已提交
135 136 137

12. Run the **hidumper -p** command to obtain process information, including the list and information of processes and threads.
     
S
shawn_he 已提交
138 139 140
    ```
    hidumper -p
    ```
S
shawn_he 已提交
141 142 143

13. Run the **hidumper -p 1024** command to obtain information about the process whose PID is **1024**.
     
S
shawn_he 已提交
144 145 146
    ```
    hidumper -p 1024
    ```
S
shawn_he 已提交
147

S
shawn_he 已提交
148
14. 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.
S
shawn_he 已提交
149
     
S
shawn_he 已提交
150 151 152 153
    ```
    hidumper --cpuusage
    hidumper --cpuusage 1024
    ```
S
shawn_he 已提交
154 155 156

15. Run the **hidumper --cpufreq** command to obtain the actual operating frequency of each CPU core.
     
S
shawn_he 已提交
157 158 159
    ```
    hidumper --cpufreq
    ```
S
shawn_he 已提交
160

S
shawn_he 已提交
161
16. 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.
S
shawn_he 已提交
162
     
S
shawn_he 已提交
163 164 165
    ```
    hidumper --mem [pid]
    ```
S
shawn_he 已提交
166 167 168

17. Run the **hidumper --zip** command to compress data to the **/data/dumper** directory.
     
S
shawn_he 已提交
169 170 171
    ```
    hidumper --zip
    ```
S
shawn_he 已提交
172 173 174

18. Run the **hidumper -t timeout** command to set the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.
     
S
shawn_he 已提交
175 176 177
    ```
    hidumper -t [timeout]
    ```