1# hitrace 2 3<!--Kit: Performance Analysis Kit--> 4<!--Subsystem: HiviewDFX--> 5<!--Owner: @qq_437963121--> 6<!--Designer: @MontSaintMichel--> 7<!--Tester: @gcw_KuLfPSbe--> 8<!--Adviser: @foryourself--> 9 10hitrace provides the capability of collecting trace information in text or binary format, including system logging and custom logging set through the [HiTraceMeter APIs](hitracemeter-intro.md), helping you observe program running status and locate faults. 11 12 13## Environment Requirements 14 15- The environment for OpenHarmony Device Connector (hdc) has been set up. For details, see [Environment Setup](hdc.md#environment-setup). 16 17- The devices are properly connected and **hdc shell** is executed. 18 19 20## Command Description 21 22| Command| Description| 23| -------- | -------- | 24| -h/--help | Displays the help information.| 25| -l/--list_categories | Displays the tag list.| 26| --trace_begin | Starts capturing trace data.| 27| --trace_finish | Stops capturing trace data.| 28| --trace_finish_nodump | Stops capturing trace data. Unlike **--trace_finish**, this command does not output trace information.| 29| --trace_dump | Dumps trace information.| 30| --record | Enables the recording mode, which allows long-time trace data collection and persisting. This command must be used together with **--trace_begin** or **--trace_finish**.| 31| --overwrite | Sets the behavior after the kernel buffer is full. If this option is not set, the earliest data is discarded by default. Otherwise, the latest data is discarded.| 32| --file_size | Sets the file size, in KB. This option is valid only for collecting trace data in binary format.| 33| -b N/--buffer_size N | Sets the buffer size for storing and reading trace data, in KB. The minimum value is 512, and the maximum value depends on the available memory of the device.| 34| -t N/--time N | Sets the collection duration, in seconds.| 35| -o/--output filename | Specifies the name of the target file. If the exported trace data is in text format, the default value is **stdout**. If you want to save the trace data to a file, you are advised to use the **/data/local/tmp** directory. This option is not supported if the exported trace data is in binary format.| 36| -z | Compresses the captured trace data.| 37| --text | Exports trace data in text format (text format is used by default).| 38| --raw | Exports trace data in binary format (text format is used by default).| 39| --trace_clock | Sets the clock type used by the timestamp in the trace data. The value can be **boot** (default), **global**, **mono**, **uptime**, or **perf**. Supported clock types vary according to devices. You are advised to use the default **boot** to collect data, which is the timestamp of the current startup, in seconds. The time types are described as follows:<br>- **boot**: timestamp that starts at system startup and continues to accumulate while the system is hibernated or suspended.<br>- **global**: global clock, which may cause performance overhead.<br>- **mono**: timestamp that starts at system startup and does not accumulate when the system is hibernated or suspended.<br>- **uptime**: timestamp that starts at system startup, which is similar to **mono**.<br>- **perf**: high-performance counter, which is suitable for performance analysis.| 40| --start_bgsrv | Starts trace collection in the snapshot mode.| 41| --dump_bgsrv | Dumps the trace data in the snapshot mode to a file.| 42| --stop_bgsrv | Stops trace collection in the snapshot mode.| 43| --trace_level | Sets the trace level threshold. The value can be **Debug**, **Info**, **Critical**, **Commercial**, or **D**, **I**, **C**, or **M**.<br>**Note**: This command is supported since API version 19.| 44 45> **NOTE** 46> 47> Trace information can be saved in text or binary format. The trace information in text format can be viewed using a text editor, and the trace information in binary format can be analyzed using the [Smartperf_Host](https://gitee.com/openharmony/developtools_smartperf_host). You can download the tool from [developtools_smartperf_host Release](https://gitee.com/openharmony/developtools_smartperf_host/releases). 48 49 50## Examples 51 52 53### Querying Help Information 54 55 56```shell 57hitrace -h 58``` 59 60 61**Example** 62 63 64```shell 65$ hitrace -h 662025/05/28 15:19:52 hitrace enter, running_state is SHOW_HELP 67usage: hitrace [options] [categories...] 68options include: 69 -b N Set the size of the buffer (KB) for storing and reading traces. 70 The default buffer size is 18432 KB. 71 --buffer_size N Like "-b N". 72 -l List available hitrace categories. 73 --list_categories Like "-l". 74 -t N Set the hitrace running duration in seconds (5s by default), which depends on 75 the time required for analysis. 76 --time N Like "-t N". 77 --trace_clock clock Sets the type of the clock for adding a timestamp to a trace, which can be 78 boot (default), global, mono, uptime, or perf. 79 --trace_begin Start capturing traces. 80 --trace_dump Dump traces to a specified path (stdout by default). 81 --trace_finish Stop capturing traces and dumps traces to a specified path (stdout by default). 82 --trace_finish_nodump Stop capturing traces and not dumps traces. 83 --record Enable or disable long-term trace collection tasks in conjunction with 84 "--trace_begin" and "--trace_finish". 85 --overwrite Set the action to take when the buffer is full. If this option is used, 86 the latest traces are discarded; if this option is not used (default setting), 87 the earliest traces are discarded. 88 -o filename Specifies the name of the target file (stdout by default). 89 --output filename Like "-o filename". 90 -z Compresses a captured trace. 91 --text Specify the output format of trace as text. 92 --raw Specify the output format of trace as raw trace, the default format is text. 93 --start_bgsrv Enable trace_service in snapshot mode. 94 --dump_bgsrv Trigger the dump trace task of the trace_service. 95 --stop_bgsrv Disable trace_service in snapshot mode. 96 --file_size Sets the size of the raw trace (KB). The default file size is 102400 KB. 97 Only effective in raw trace mode 98 --trace_level level Set the system parameter "persist.hitrace.level.threshold", which can control 99 the level threshold of trace dotting. Valid values for "level" include 100 D or Debug, I or Info, C or Critical, M or Commercial. 101``` 102 103 104### Displaying the Tag List in hitrace 105 106```shell 107hitrace -l 108``` 109 110**Example** 111 112```shell 113$ hitrace -l 1142025/05/27 16:24:38 hitrace enter, running_state is SHOW_LIST_CATEGORY 115 tagName: description: 116 ability - Ability Manager 117 accesscontrol - Access Control Module 118 accessibility - Accessibility Manager 119 account - Account Manager 120 ace - ACE development framework 121 animation - Animation 122 app - APP Module 123 ark - ARK Module 124 binder - Binder kernel Info 125 bluetooth - communication bluetooth 126 cloud - Cloud subsystem tag 127 commercial - Commercial version tag 128 commonlibrary - commonlibrary subsystem 129 daudio - Distributed Audio 130 dcamera - Distributed Camera 131 deviceauth - Device Auth 132 devicemanager - Device Manager 133 deviceprofile - Device Profile 134 dhfwk - Distributed Hardware FWK 135 dinput - Distributed Input 136 disk - Disk I/O 137 distributeddatamgr - Distributed Data Manager 138 dlpcre - Dlp Credential Service 139 drm - Digital Rights Management 140 dsched - Distributed Schedule 141 dscreen - Distributed Screen 142 dslm - device security level 143 dsoftbus - Distributed Softbus 144 ffrt - ffrt tasks 145 filemanagement - filemanagement 146 freq - CPU Frequency 147 graphic - Graphic Module 148 gresource - Global Resource Manager 149 hdcd - hdcd 150 hdf - hdf subsystem 151 hmfs - HMFS commands 152 huks - Universal KeyStore 153 i2c - I2C Events 154 idle - CPU Idle 155 interconn - Interconnection subsystem 156 ipa - thermal power allocator 157 irq - IRQ Events 158 irqoff - IRQ-disabled code section tracing 159 load - CPU Load 160 mdfs - Mobile Distributed File System 161 membus - Memory Bus Utilization 162 memory - Memory 163 memreclaim - Kernel Memory Reclaim 164 misc - Misc Module 165 mmc - eMMC commands 166 msdp - Multimodal Sensor Data Platform 167 multimodalinput - HITRACE_TAG_MULTIMODALINPUT 168 musl - musl module 169 net - net 170 notification - Notification Module 171 nweb - NWEB Module 172 ohos - OpenHarmony 173 pagecache - Page cache 174 power - Power Manager 175 preemptoff - Preempt-disabled code section tracing 176 push - Push subsystem 177 regulators - Voltage and Current Regulators 178 rpc - RPC and IPC 179 samgr - samgr 180 sched - CPU Scheduling 181 security - Security subsystem 182 sensors - Sensors Module 183 sync - Synchronization 184 ufs - UFS commands 185 usb - usb subsystem 186 useriam - useriam 187 virse - Virtualization Service 188 window - Window Manager 189 workq - Kernel Workqueues 190 zaudio - OpenHarmony Audio Module 191 zbinder - OpenHarmony binder communication 192 zcamera - OpenHarmony Camera Module 193 zimage - OpenHarmony Image Module 194 zmedia - OpenHarmony Media Module 195``` 196 197 198### Capturing Text Trace Data of a Specified Duration 199 200If the **-o** parameter is not specified, the captured trace content is displayed in the CLI by default. The following command is used to collect data for 10 seconds, with the buffer size set to **204800** KB and the tag to **app**. 201 202```shell 203hitrace -t 10 -b 204800 app 204``` 205 206 207**Example** 208 209 210```shell 211$ hitrace -t 10 -b 204800 app 2122025/06/04 10:14:52 start capture, please wait 10s ... 213# tracer: nop 214# _-----=> irqs-off 215# / _----=> need-resched 216# | / _---=> hardirq/softirq 217# || / _--=> preempt-depth 218# ||| / delay 219# TASK-PID TGID CPU# |||| TIMESTAMP FUNCTION 220# | | | | |||| | | 221 KstateRecvThrea-1132 ( 952) [003] .... 589942.951387: tracing_mark_write: B|952|H:CheckMsgFromNetlink|I62 222 KstateRecvThrea-1132 ( 952) [003] .... 589942.951554: tracing_mark_write: B|952|H:OnKstateCallback, mask: 8, data: [PID 15461 KILLED][SIG 9]|I62 223 KstateRecvThrea-1132 ( 952) [003] .... 589942.951693: tracing_mark_write: E|952|I62 224 KstateRecvThrea-1132 ( 952) [003] .... 589942.951737: tracing_mark_write: E|952|I62 225 state_change_ha-1139 ( 952) [001] .... 589942.951909: tracing_mark_write: B|952|H:ProcessEvent, eventId: 6|I62 226 state_change_ha-1139 ( 952) [001] .... 589942.952510: tracing_mark_write: E|952|I62 2272025/06/04 10:15:02 TraceFinish done. 228``` 229 230 231Specify the **-o** option to save trace information to a specified directory. You are advised to save it to the **/data/local/tmp** directory. 232 233 234```shell 235hitrace -t 10 -b 204800 app -o /data/local/tmp/test.ftrace 236``` 237 238 239**Example** 240 241 242```shell 243$ hitrace -t 10 -b 204800 app -o /data/local/tmp/test.ftrace 2442025/06/04 10:19:47 start capture, please wait 10s ... 2452025/06/04 10:19:57 capture done, start to read trace. 2462025/06/04 10:19:57 trace read done, output: /data/local/tmp/test.ftrace 2472025/06/04 10:19:57 TraceFinish done. 248``` 249 250 251### Capturing Binary Trace Data of a Specified Duration 252 253Specify the **--raw** option to capture binary trace data, which is always saved in **/data/log/hitrace**. After the collection is complete, the absolute path of the generated file is displayed in the CLI. 254 255```shell 256hitrace -t 10 -b 204800 app --raw 257``` 258 259 260**Example** 261 262 263```shell 264$ hitrace -t 10 -b 204800 app --raw 2652025/06/04 10:21:16 hitrace enter, running_state is RECORDING_SHORT_RAW 2662025/06/04 10:21:16 args: tags:app bufferSize:204800 overwrite:1 2672025/06/04 10:21:16 start capture, please wait 10s ... 2682025/06/04 10:21:27 capture done, output files: 269 /data/log/hitrace/record_trace_20250604102116@590322-695861087.sys 270``` 271 272 273### Capturing Text Trace Data in Snapshot Mode 274 275In snapshot mode, trace data is stored in the kernel buffer. When the data volume exceeds the buffer size, the earliest data is discarded by default. 276 277Run the following command to enable the snapshot mode, with the buffer size set to 204800 KB and the collection tags to **app** and **graphic**. 278 279```shell 280hitrace --trace_begin -b 204800 app graphic 281``` 282 283**Example** 284 285```shell 286$ hitrace --trace_begin -b 204800 app graphic 2872025/06/04 16:03:39 hitrace enter, running_state is RECORDING_LONG_BEGIN 2882025/06/04 16:03:39 args: tags:app,graphic bufferSize:204800 overwrite:1 2892025/06/04 16:03:39 OpenRecording done. 290``` 291 292After the snapshot mode is enabled, you can run the following command to export the data in the buffer. By default, the trace data is displayed in the CLI. 293 294```shell 295hitrace --trace_dump 296``` 297 298**Example** 299 300```shell 301$ hitrace --trace_dump 3022025/06/04 16:07:57 start to read trace. 303# tracer: nop 304# _-----=> irqs-off 305# / _----=> need-resched 306# | / _---=> hardirq/softirq 307# || / _--=> preempt-depth 308# ||| / delay 309# TASK-PID TGID CPU# |||| TIMESTAMP FUNCTION 310# | | | | |||| | | 311 KstateRecvThrea-1132 ( 952) [002] .... 610865.463378: tracing_mark_write: B|952|H:CheckMsgFromNetlink|I62 312 KstateRecvThrea-1132 ( 952) [002] .... 610865.463503: tracing_mark_write: B|952|H:OnKstateCallback, mask: 8, data: [PID 14446 KILLED][SIG 9]|I62 313 KstateRecvThrea-1132 ( 952) [002] .... 610865.463626: tracing_mark_write: E|952|I62 314 KstateRecvThrea-1132 ( 952) [002] .... 610865.463654: tracing_mark_write: E|952|I62 315 state_change_ha-1139 ( 952) [001] .... 610865.463767: tracing_mark_write: B|952|H:ProcessEvent, eventId: 6|I62 316 state_change_ha-1139 ( 952) [001] .... 610865.463879: tracing_mark_write: E|952|I62 317 state_change_ha-1139 ( 952) [001] .... 610866.506055: tracing_mark_write: B|952|H:ProcessEvent, eventId: 0|I62 318 state_change_ha-1139 ( 952) [001] .... 610866.506297: tracing_mark_write: B|952|H:HandleStateTransition, 20020111_com.ohos.medialibrary.medialibrarydata_[6255]|I62 319 state_change_ha-1139 ( 952) [001] .... 610866.506782: tracing_mark_write: E|952|I62 320 state_change_ha-1139 ( 952) [001] .... 610866.506824: tracing_mark_write: E|952|I62 321 state_change_ha-1139 ( 952) [001] .... 610866.557458: tracing_mark_write: B|952|H:ProcessEvent, eventId: 0|I62 322 state_change_ha-1139 ( 952) [001] .... 610866.558060: tracing_mark_write: E|952|I62 323 state_change_ha-1139 ( 952) [001] .... 610866.558101: tracing_mark_write: E|952|I62 324``` 325 326You can also run the **-o** command to save the exported data to a specified file. You are advised to save the file to the **/data/local/tmp** directory. 327 328```shell 329hitrace --trace_dump -o /data/local/tmp/test.ftrace 330``` 331 332**Example** 333 334```shell 335$ hitrace --trace_dump -o /data/local/tmp/test.ftrace 3362025/06/04 16:09:10 start to read trace. 3372025/06/04 16:09:10 trace read done, output: /data/local/tmp/test.ftrace 338``` 339 340To stop the collection, run any of the following commands: 341 3421. Stop the collection and display the trace information in the buffer in the CLI. 343 344 ```shell 345 hitrace --trace_finish 346 ``` 347 348 **Example** 349 350 ```shell 351 $ hitrace --trace_finish 352 2025/06/04 16:22:02 start to read trace. 353 # tracer: nop 354 # _-----=> irqs-off 355 # / _----=> need-resched 356 # | / _---=> hardirq/softirq 357 # || / _--=> preempt-depth 358 # ||| / delay 359 # TASK-PID TGID CPU# |||| TIMESTAMP FUNCTION 360 # | | | | |||| | | 361 KstateRecvThrea-1132 ( 952) [002] .... 610865.463378: tracing_mark_write: B|952|H:CheckMsgFromNetlink|I62 362 KstateRecvThrea-1132 ( 952) [002] .... 610865.463503: tracing_mark_write: B|952|H:OnKstateCallback, mask: 8, data: [PID 14446 KILLED][SIG 9]|I62 363 KstateRecvThrea-1132 ( 952) [002] .... 610865.463626: tracing_mark_write: E|952|I62 364 KstateRecvThrea-1132 ( 952) [002] .... 610865.463654: tracing_mark_write: E|952|I62 365 ``` 366 3672. Stop the collection and save the trace information in the buffer to a specified file. You are advised to save it to /data/local/tmp. 368 369 ```shell 370 hitrace --trace_finish -o /data/local/tmp/test.ftrace 371 ``` 372 373 **Example** 374 375 ```shell 376 $ hitrace --trace_finish -o /data/local/tmp/test.ftrace 377 2025/06/04 16:24:52 start to read trace. 378 2025/06/04 16:24:52 trace read done, output: /data/local/tmp/test.ftrace 379 2025/06/04 16:24:52 Trace Closed. 380 ``` 381 3823. Stop trace collection and do not output trace information. 383 384 ```shell 385 hitrace --trace_finish_nodump 386 ``` 387 388 **Example** 389 390 ```shell 391 $ hitrace --trace_finish_nodump 392 2025/06/04 16:26:11 hitrace enter, running_state is RECORDING_LONG_FINISH_NODUMP 393 2025/06/04 16:26:11 end capture trace. 394 ``` 395 396 397### Capturing Binary Trace Data in Snapshot Mode 398 399 400When binary trace data is captured in snapshot mode, **tag** cannot be specified. By default, the following tags are collected: 401 402 403```shell 404"net", "dsched", "graphic", "multimodalinput", "dinput", "ark", "ace", "window","zaudio", "daudio", "zmedia", "dcamera", "zcamera", "dhfwk", "app", "gresource", "ability", "power", "samgr", "ffrt", "nweb", "hdf", "virse", "workq", "ipa", "sched", "freq", "disk", "sync", "binder", "mmc", "membus", "load" 405``` 406 407 408Run the following command to start capturing binary trace data: 409 410 411```shell 412hitrace --start_bgsrv 413``` 414 415 416**Example** 417 418 419```shell 420$ hitrace --start_bgsrv 4212025/06/04 16:44:54 hitrace enter, running_state is SNAPSHOT_START 4222025/06/04 16:44:54 OpenSnapshot done. 423``` 424 425 426Run the following command to export the trace information in the buffer to a file. Binary trace data cannot be exported to a specified path or displayed in the CLI. The exported file path is displayed in the CLI. 427 428 429```shell 430hitrace --dump_bgsrv 431``` 432 433 434**Example** 435 436 437```shell 438$ hitrace --dump_bgsrv 4392025/06/04 16:50:34 hitrace enter, running_state is SNAPSHOT_DUMP 4402025/06/04 16:50:35 DumpSnapshot done, output: 441 /data/log/hitrace/trace_20250604164454@613340-339960.sys 442``` 443 444 445Run the following command to stop the collection: 446 447 448```shell 449hitrace --stop_bgsrv 450``` 451 452 453**Example** 454 455 456```shell 457$ hitrace --stop_bgsrv 4582025/06/04 16:52:51 hitrace enter, running_state is SNAPSHOT_STOP 4592025/06/04 16:52:52 CloseSnapshot done. 460``` 461 462 463### Capturing Trace Data in Record Mode 464 465In record mode, the system continuously saves binary trace data generated during running. When the file size exceeds the preset value, a new file is generated. The save path cannot be specified. 466 467Run the following command to enable the record mode, with the buffer size set to **204800** KB, the file size to **102400** KB, and the collection tags to **app** and **graphic**. 468 469```shell 470hitrace --trace_begin --record -b 204800 --file_size 102400 app graphic 471``` 472 473**Example** 474 475```shell 476$ hitrace --trace_begin --record -b 204800 --file_size 102400 app graphic 4772025/06/04 17:03:37 hitrace enter, running_state is RECORDING_LONG_BEGIN_RECORD 4782025/06/04 17:03:37 args: tags:app,graphic bufferSize:204800 overwrite:1 fileSize:102400 4792025/06/04 17:03:37 trace capturing. 480``` 481 482 483After the collection is complete, run the following command to stop the collection. The absolute path of the generated file is displayed in the CLI. 484 485 486```shell 487hitrace --trace_finish --record 488``` 489 490 491**Example** 492 493 494```shell 495$ hitrace --trace_finish --record 4962025/06/04 17:06:14 hitrace enter, running_state is RECORDING_LONG_FINISH_RECORD 4972025/06/04 17:06:15 capture done, output files: 498 /data/log/hitrace/record_trace_20250604170337@614463-183970330.sys 499 /data/log/hitrace/record_trace_20250604170423@614508-554071886.sys 500 /data/log/hitrace/record_trace_20250604170552@614597-598551039.sys 501``` 502 503 504### Compressing Trace Data 505 506```shell 507hitrace -z -b 102400 -t 10 sched freq idle disk -o /data/local/tmp/test.ftrace 508``` 509 510**Example** 511 512```shell 513$ hitrace -z -b 102400 -t 10 sched freq idle disk -o /data/local/tmp/test.ftrace 5142024/11/14 12:00:18 start capture, please wait 10s ... 5152024/11/14 12:00:28 capture done, start to read trace. 5162024/11/14 12:00:29 trace read done, output: /data/local/tmp/test.ftrace 5172024/11/14 12:00:29 TraceFinish done. 518``` 519 520 521### Setting the Trace Output Level Threshold 522 523The priority of the trace level is as follows: **M** (**Commercial**), **C** (**Critical**), **I** (**Info**) and **D** (**Debug**). The trace level lower than the threshold does not take effect. 524 525You can use the logging APIs with the trace level (for details, see the logging APIs of API version 19 in [js-apis-hitracemeter](../reference/apis-performance-analysis-kit/js-apis-hitracemeter.md) and [_hitrace](../reference/apis-performance-analysis-kit/capi-trace-h.md)) to test whether the trace output under different thresholds meets the expectation. 526 527```shell 528// Set the trace output level threshold. 529hitrace --trace_level D/I/C/M 530hitrace --trace_level Debug/Info/Critical/Commercial 531``` 532 533**Example** 534 535```shell 536$ hitrace --trace_level Info 5372024/11/14 12:05:07 hitrace enter, running_state is SET_TRACE_LEVEL 5382024/11/14 12:05:07 success to set trace level. 539``` 540 541 542## Trace File Names 543 544When hitrace is used to collect trace information in binary format, the file path cannot be specified. By default, the trace file is saved in the **/data/log/hitrace** directory. hitrace automatically generates the file name and displays the absolute path in the CLI. 545 546In snapshot mode, the trace file name starts with **trace**; in record mode, it starts with **record**. The name ends with the local time and boot time (timestamp starting from the startup time). 547 548For example, the file name **20250701215441** indicates that the file is generated at 21:54:41 on July 1, 2025, and the corresponding boot time is **6016.653165227**. 549 550```shell 551$ hitrace --dump_bgsrv 5522025/07/01 21:54:41 hitrace enter, running_state is SNAPSHOT_DUMP 5532025/07/01 21:54:42 DumpSnapshot done, output: 554 /data/log/hitrace/trace_20250701215441@6016-653165227.sys 555``` 556 557 558## FAQs 559 560 561### What should I do if error code 1 is displayed after the hitrace command is executed? 562 563**Symptom** 564 565Error code 1 is displayed after the hitrace command is executed. 566 567```shell 568$ hitrace --dump_bgsrv 5692025/07/04 17:20:38 hitrace enter, running_state is SNAPSHOT_DUMP 5702025/07/04 17:20:38 error: DumpSnapshot failed, errorCode(1) 571``` 572 573**Possible Causes and Solution** 574 575Error code 1 indicates that the HiView process is abnormal. You can restart the mobile phone and collect data again. 576 577 578### What should I do if the error message "not support category on this device" is displayed after the hitrace command is executed? 579 580**Symptom** 581 582After the hitrace command is executed, the error message "not support category on this device" is displayed. 583 584```shell 585$ hitrace -t 10 aaa 5862025/07/04 17:24:21 error: aaa is not support category on this device. 5872025/07/04 17:24:21 error: parsing args failed, exit. 588``` 589 590**Possible Causes and Solution** 591 592The tag specified in the command does not exist. You are advised to run the **hitrace -l** command to view the supported tags. 593 594 595### What should I do if error code 1004 is displayed after the hitrace command is executed? 596 597**Symptom** 598 599Error code 1004 is displayed after the hitrace command is executed. 600 601```shell 602$ hitrace --dump_bgsrv 6032025/07/04 17:25:58 hitrace enter, running_state is SNAPSHOT_DUMP 6042025/07/04 17:25:58 error: DumpSnapshot failed, errorCode(1004) 605``` 606 607**Possible Causes and Solution** 608 6091004 indicates that an error occurs when data is written into the file. The possible causes are as follows: 610 6111. When the trace data in text format is collected, the output file path specified by the **-o** option does not exist or you do not have the permission to use the path. You are advised to save the trace data to the **/data/local/tmp** directory. 612 6132. When the disk space is full, no new trace file is generated. You are advised to release the disk space and ensure that the available space is greater than 500 MB. Then collect the trace data again. 614