1# HiDebug 2 3 4## Overview 5 6Provides APIs for debugging. 7 8You can use the APIs to obtain CPU usage, memory information, heap information, and capture traces. 9 10**Since**: 12 11 12 13## Summary 14 15 16### Files 17 18| Name| Description| 19| -------- | -------- | 20| [hidebug.h](hidebug_8h.md) | Defines the APIs for debugging.| 21| [hidebug_type.h](hidebug__type_8h.md) | Defines the structs of the HiDebug module.| 22 23 24### Structs 25 26| Name| Description| 27| -------- | -------- | 28| struct [HiDebug_ThreadCpuUsage](_hi_debug___thread_cpu_usage.md) | Defines the CPU usage of all threads of an application.| 29| struct [HiDebug_SystemMemInfo](_hi_debug___system_mem_info.md) | Defines the system memory information.| 30| struct [HiDebug_NativeMemInfo](_hi_debug___native_mem_info.md) | Defines the local memory information of an application process.| 31| struct [HiDebug_MemoryLimit](_hi_debug___memory_limit.md) | Defines the memory limit of an application process.| 32 33 34### Macros 35 36| Name| Description| 37| -------- | -------- | 38| [HIDEBUG_TRACE_TAG_FFRT](#hidebug_trace_tag_ffrt) (1ULL << 13) | Indicates the FFRT task.| 39| [HIDEBUG_TRACE_TAG_COMMON_LIBRARY](#hidebug_trace_tag_common_library) (1ULL << 16) | Indicates the common library subsystem.| 40| [HIDEBUG_TRACE_TAG_HDF](#hidebug_trace_tag_hdf) (1ULL << 18) | Indicates the HDF subsystem.| 41| [HIDEBUG_TRACE_TAG_NET](#hidebug_trace_tag_net) (1ULL << 23) | Indicates the network.| 42| [HIDEBUG_TRACE_TAG_NWEB](#hidebug_trace_tag_nweb) (1ULL << 24) | Indicates the NWeb.| 43| [HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO](#hidebug_trace_tag_distributed_audio) (1ULL << 27) | Indicates the distributed audio.| 44| [HIDEBUG_TRACE_TAG_FILE_MANAGEMENT](#hidebug_trace_tag_file_management) (1ULL << 29) | Indicates the file management.| 45| [HIDEBUG_TRACE_TAG_OHOS](#hidebug_trace_tag_ohos) (1ULL << 30) | Indicates the OpenHarmony OS.| 46| [HIDEBUG_TRACE_TAG_ABILITY_MANAGER](#hidebug_trace_tag_ability_manager) (1ULL << 31) | Indicates the ability manager.| 47| [HIDEBUG_TRACE_TAG_CAMERA](#hidebug_trace_tag_camera) (1ULL << 32) | Indicates the camera module.| 48| [HIDEBUG_TRACE_TAG_MEDIA](#hidebug_trace_tag_media) (1ULL << 33) | Indicates the media module.| 49| [HIDEBUG_TRACE_TAG_IMAGE](#hidebug_trace_tag_image) (1ULL << 34) | Indicates the image module.| 50| [HIDEBUG_TRACE_TAG_AUDIO](#hidebug_trace_tag_audio) (1ULL << 35) | Indicates the audio module.| 51| [HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA](#hidebug_trace_tag_distributed_data) (1ULL << 36) | Indicates the distributed data management.| 52| [HIDEBUG_TRACE_TAG_GRAPHICS](#hidebug_trace_tag_graphics) (1ULL << 38) | Indicates the graphics module.| 53| [HIDEBUG_TRACE_TAG_ARKUI](#hidebug_trace_tag_arkui) (1ULL << 39) | Indicates the ArkUI development framework.| 54| [HIDEBUG_TRACE_TAG_NOTIFICATION](#hidebug_trace_tag_notification) (1ULL << 40) | Indicates the notification module.| 55| [HIDEBUG_TRACE_TAG_MISC](#hidebug_trace_tag_misc) (1ULL << 41) | Indicates the MISC module.| 56| [HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT](#hidebug_trace_tag_multimodal_input) (1ULL << 42) | Indicates the multimodal input module.| 57| [HIDEBUG_TRACE_TAG_RPC](#hidebug_trace_tag_rpc) (1ULL << 46) | Indicates the RPC.| 58| [HIDEBUG_TRACE_TAG_ARK](#hidebug_trace_tag_ark) (1ULL << 47) | Indicates the JSVM.| 59| [HIDEBUG_TRACE_TAG_WINDOW_MANAGER](#hidebug_trace_tag_window_manager) (1ULL << 48) | Indicates the window manager.| 60| [HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN](#hidebug_trace_tag_distributed_screen) (1ULL << 50) | Indicates the distributed screen.| 61| [HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA](#hidebug_trace_tag_distributed_camera) (1ULL << 51) | Indicates the distributed camera.| 62| [HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK](#hidebug_trace_tag_distributed_hardware_framework) (1ULL << 52) | Indicates the distributed hardware framework.| 63| [HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER](#hidebug_trace_tag_global_resource_manager) (1ULL << 53) | Indicates the global resource manager.| 64| [HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER](#hidebug_trace_tag_distributed_hardware_device_manager) (1ULL << 54) | Indicates the distributed hardware device manager.| 65| [HIDEBUG_TRACE_TAG_SAMGR](#hidebug_trace_tag_samgr) (1ULL << 55) | Indicates the service ability manager (SAMGR).| 66| [HIDEBUG_TRACE_TAG_POWER_MANAGER](#hidebug_trace_tag_power_manager) (1ULL << 56) | Indicates the power manager.| 67| [HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER](#hidebug_trace_tag_distributed_scheduler) (1ULL << 57) | Indicates the distributed scheduler.| 68| [HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT](#hidebug_trace_tag_distributed_input) (1ULL << 59) | Indicates the distributed input.| 69| [HIDEBUG_TRACE_TAG_BLUETOOTH](#hidebug_trace_tag_bluetooth) (1ULL << 60) | Indicates the Bluetooth.| 70 71 72### Types 73 74| Name| Description| 75| -------- | -------- | 76| typedef enum [HiDebug_ErrorCode](#hidebug_errorcode-1) [HiDebug_ErrorCode](#hidebug_errorcode) | Defines an enum for error codes.| 77| typedef struct [HiDebug_ThreadCpuUsage](_hi_debug___thread_cpu_usage.md) [HiDebug_ThreadCpuUsage](#hidebug_threadcpuusage) | Defines a struct for the CPU usage of all threads of an application.| 78| typedef [HiDebug_ThreadCpuUsage](_hi_debug___thread_cpu_usage.md) \* [HiDebug_ThreadCpuUsagePtr](#hidebug_threadcpuusageptr) | Defines the pointer to **HiDebug_ThreadCpuUsage**.| 79| typedef struct [HiDebug_SystemMemInfo](_hi_debug___system_mem_info.md) [HiDebug_SystemMemInfo](#hidebug_systemmeminfo) | Defines a struct for the system memory information.| 80| typedef struct [HiDebug_NativeMemInfo](_hi_debug___native_mem_info.md) [HiDebug_NativeMemInfo](#hidebug_nativememinfo) | Defines a struct for the local memory information of the application process.| 81| typedef struct [HiDebug_MemoryLimit](_hi_debug___memory_limit.md) [HiDebug_MemoryLimit](#hidebug_memorylimit) | Defines a struct for the memory limit of an application process.| 82| typedef enum [HiDebug_TraceFlag](#hidebug_traceflag-1) [HiDebug_TraceFlag](#hidebug_traceflag) | Defines an enum for the types of threads for trace collection.| 83 84 85### Enums 86 87| Name| Description| 88| -------- | -------- | 89| [HiDebug_ErrorCode](#hidebug_errorcode-1) {<br>HIDEBUG_SUCCESS = 0,<br>HIDEBUG_INVALID_ARGUMENT = 401,<br>HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102,<br>HIDEBUG_NO_PERMISSION = 11400103,<br>HIDEBUG_TRACE_ABNORMAL = 11400104,<br>HIDEBUG_NO_TRACE_RUNNING = 11400105<br>} | Enumerates the error codes used in the HiDebug module.| 90| [HiDebug_TraceFlag](#hidebug_traceflag-1) {<br>HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1, HIDEBUG_TRACE_FLAG_ALL_THREADS = 2<br>} | Enumerates the types of the threads for trace collection.| 91 92 93### Functions 94 95| Name| Description| 96| -------- | -------- | 97| double [OH_HiDebug_GetSystemCpuUsage](#oh_hidebug_getsystemcpuusage) () | Obtains the CPU usage of the system.| 98| double [OH_HiDebug_GetAppCpuUsage](#oh_hidebug_getappcpuusage) () | Obtains the CPU usage of an application.| 99| [HiDebug_ThreadCpuUsagePtr](#hidebug_threadcpuusageptr) [OH_HiDebug_GetAppThreadCpuUsage](#oh_hidebug_getappthreadcpuusage) () | Obtains the CPU usage of all threads of an application.| 100| void [OH_HiDebug_FreeThreadCpuUsage](#oh_hidebug_freethreadcpuusage) ([HiDebug_ThreadCpuUsagePtr](#hidebug_threadcpuusageptr) \*threadCpuUsage) | Releases the **HiDebug_ThreadCpuUsagePtr**.| 101| void [OH_HiDebug_GetSystemMemInfo](#oh_hidebug_getsystemmeminfo) ([HiDebug_SystemMemInfo](_hi_debug___system_mem_info.md) \*systemMemInfo) | Obtains system memory information.| 102| void [OH_HiDebug_GetAppNativeMemInfo](#oh_hidebug_getappnativememinfo) ([HiDebug_NativeMemInfo](_hi_debug___native_mem_info.md) \*nativeMemInfo) | Obtains the memory information of an application process.| 103| void [OH_HiDebug_GetAppMemoryLimit](#oh_hidebug_getappmemorylimit) ([HiDebug_MemoryLimit](_hi_debug___memory_limit.md) \*memoryLimit) | Obtains the memory limit of an application process.| 104| [HiDebug_ErrorCode](#hidebug_errorcode) [OH_HiDebug_StartAppTraceCapture](#oh_hidebug_startapptracecapture) ([HiDebug_TraceFlag](#hidebug_traceflag) flag, uint64_t tags, uint32_t limitSize, char \*fileName, uint32_t length) | Starts application trace collection.| 105| [HiDebug_ErrorCode](#hidebug_errorcode) [OH_HiDebug_StopAppTraceCapture](#oh_hidebug_stopapptracecapture) () | Stops application trace collection.| 106 107 108## Macro Description 109 110 111### HIDEBUG_TRACE_TAG_ABILITY_MANAGER 112 113``` 114#define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31) 115``` 116 117**Description** 118 119Indicates the ability manager. 120 121**Since**: 12 122 123 124### HIDEBUG_TRACE_TAG_ARK 125 126``` 127#define HIDEBUG_TRACE_TAG_ARK (1ULL << 47) 128``` 129 130**Description** 131 132Indicates the JSVM. 133 134**Since**: 12 135 136 137### HIDEBUG_TRACE_TAG_ARKUI 138 139``` 140#define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) 141``` 142 143**Description** 144 145Indicates the ArkUI development framework. 146 147**Since**: 12 148 149 150### HIDEBUG_TRACE_TAG_AUDIO 151 152``` 153#define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35) 154``` 155 156**Description** 157 158Indicates the audio module. 159 160**Since**: 12 161 162 163### HIDEBUG_TRACE_TAG_BLUETOOTH 164 165``` 166#define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) 167``` 168 169**Description** 170 171Indicates the Bluetooth. 172 173**Since**: 12 174 175 176### HIDEBUG_TRACE_TAG_CAMERA 177 178``` 179#define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32) 180``` 181 182**Description** 183 184Indicates the camera module. 185 186**Since**: 12 187 188 189### HIDEBUG_TRACE_TAG_COMMON_LIBRARY 190 191``` 192#define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16) 193``` 194 195**Description** 196 197Indicates the common library subsystem. 198 199**Since**: 12 200 201 202### HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO 203 204``` 205#define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27) 206``` 207 208**Description** 209 210Indicates the distributed audio. 211 212**Since**: 12 213 214 215### HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA 216 217``` 218#define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51) 219``` 220 221**Description** 222 223Indicates the distributed camera. 224 225**Since**: 12 226 227 228### HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA 229 230``` 231#define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36) 232``` 233 234**Description** 235 236Indicates the distributed data management. 237 238**Since**: 12 239 240 241### HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER 242 243``` 244#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54) 245``` 246 247**Description** 248 249Indicates the distributed hardware device manager. 250 251**Since**: 12 252 253 254### HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK 255 256``` 257#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52) 258``` 259 260**Description** 261 262Indicates the distributed hardware framework. 263 264**Since**: 12 265 266 267### HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT 268 269``` 270#define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59) 271``` 272 273**Description** 274 275Indicates the distributed input. 276 277**Since**: 12 278 279 280### HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER 281 282``` 283#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57) 284``` 285 286**Description** 287 288Indicates the distributed scheduler. 289 290**Since**: 12 291 292 293### HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN 294 295``` 296#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50) 297``` 298 299**Description** 300 301Indicates the distributed screen. 302 303**Since**: 12 304 305 306### HIDEBUG_TRACE_TAG_FFRT 307 308``` 309#define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13) 310``` 311 312**Description** 313 314Indicates the FFRT task. 315 316**Since**: 12 317 318 319### HIDEBUG_TRACE_TAG_FILE_MANAGEMENT 320 321``` 322#define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29) 323``` 324 325**Description** 326 327Indicates the file management. 328 329**Since**: 12 330 331 332### HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER 333 334``` 335#define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53) 336``` 337 338**Description** 339 340Indicates the global resource manager. 341 342**Since**: 12 343 344 345### HIDEBUG_TRACE_TAG_GRAPHICS 346 347``` 348#define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) 349``` 350 351**Description** 352 353Indicates the graphics module. 354 355**Since**: 12 356 357 358### HIDEBUG_TRACE_TAG_HDF 359 360``` 361#define HIDEBUG_TRACE_TAG_HDF (1ULL << 18) 362``` 363 364**Description** 365 366Indicates the HDF subsystem. 367 368**Since**: 12 369 370 371### HIDEBUG_TRACE_TAG_IMAGE 372 373``` 374#define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34) 375``` 376 377**Description** 378 379Indicates the image module. 380 381**Since**: 12 382 383 384### HIDEBUG_TRACE_TAG_MEDIA 385 386``` 387#define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33) 388``` 389 390**Description** 391 392Indicates the media module. 393 394**Since**: 12 395 396 397### HIDEBUG_TRACE_TAG_MISC 398 399``` 400#define HIDEBUG_TRACE_TAG_MISC (1ULL << 41) 401``` 402 403**Description** 404 405Indicates the MISC module. 406 407**Since**: 12 408 409 410### HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT 411 412``` 413#define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42) 414``` 415 416**Description** 417 418Indicates the multimodal input module. 419 420**Since**: 12 421 422 423### HIDEBUG_TRACE_TAG_NET 424 425``` 426#define HIDEBUG_TRACE_TAG_NET (1ULL << 23) 427``` 428 429**Description** 430 431Indicates the network. 432 433**Since**: 12 434 435 436### HIDEBUG_TRACE_TAG_NOTIFICATION 437 438``` 439#define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40) 440``` 441 442**Description** 443 444Indicates the notification module. 445 446**Since**: 12 447 448 449### HIDEBUG_TRACE_TAG_NWEB 450 451``` 452#define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24) 453``` 454 455**Description** 456 457Indicates the NWeb. 458 459**Since**: 12 460 461 462### HIDEBUG_TRACE_TAG_OHOS 463 464``` 465#define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30) 466``` 467 468**Description** 469 470Indicates the OpenHarmony OS. 471 472**Since**: 12 473 474 475### HIDEBUG_TRACE_TAG_POWER_MANAGER 476 477``` 478#define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56) 479``` 480 481**Description** 482 483Indicates the power manager. 484 485**Since**: 12 486 487 488### HIDEBUG_TRACE_TAG_RPC 489 490``` 491#define HIDEBUG_TRACE_TAG_RPC (1ULL << 46) 492``` 493 494**Description** 495 496Indicates the RPC. 497 498**Since**: 12 499 500 501### HIDEBUG_TRACE_TAG_SAMGR 502 503``` 504#define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55) 505``` 506 507**Description** 508 509Indicates the service ability manager (SAMGR). 510 511**Since**: 12 512 513 514### HIDEBUG_TRACE_TAG_WINDOW_MANAGER 515 516``` 517#define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48) 518``` 519 520**Description** 521 522Indicates the window manager. 523 524**Since**: 12 525 526 527## Type Description 528 529 530### HiDebug_ErrorCode 531 532``` 533typedef enum HiDebug_ErrorCode HiDebug_ErrorCode 534``` 535 536**Description** 537 538Defines an enum for error codes. 539 540**Since**: 12 541 542 543### HiDebug_MemoryLimit 544 545``` 546typedef struct HiDebug_MemoryLimit HiDebug_MemoryLimit 547``` 548 549**Description** 550 551Defines a struct for the memory limit of an application process. 552 553**Since**: 12 554 555 556### HiDebug_NativeMemInfo 557 558``` 559typedef struct HiDebug_NativeMemInfo HiDebug_NativeMemInfo 560``` 561 562**Description** 563 564Defines a struct for the local memory information of the application process. 565 566**Since**: 12 567 568 569### HiDebug_SystemMemInfo 570 571``` 572typedef struct HiDebug_SystemMemInfo HiDebug_SystemMemInfo 573``` 574 575**Description** 576 577Defines a struct for the system memory information. 578 579**Since**: 12 580 581 582### HiDebug_ThreadCpuUsage 583 584``` 585typedef struct HiDebug_ThreadCpuUsage HiDebug_ThreadCpuUsage 586``` 587 588**Description** 589 590Defines a struct for the CPU usage of all threads of an application. 591 592**Since**: 12 593 594 595### HiDebug_ThreadCpuUsagePtr 596 597``` 598typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr 599``` 600 601**Description** 602 603Defines the pointer to **HiDebug_ThreadCpuUsage**. 604 605**Since**: 12 606 607 608### HiDebug_TraceFlag 609 610``` 611typedef enum HiDebug_TraceFlag HiDebug_TraceFlag 612``` 613 614**Description** 615 616Defines an enum for the types of threads for trace collection. 617 618**Since**: 12 619 620 621## Enum Description 622 623 624### HiDebug_ErrorCode 625 626``` 627enum HiDebug_ErrorCode 628``` 629 630**Description** 631 632Enumerates the error codes used in the HiDebug module. 633 634**Since**: 12 635 636| Value| Description| 637| -------- | -------- | 638| HIDEBUG_SUCCESS | Execution successful.| 639| HIDEBUG_INVALID_ARGUMENT | Invalid parameter type or incorrect parameter value.| 640| HIDEBUG_TRACE_CAPTURED_ALREADY | Repeated collection.| 641| HIDEBUG_NO_PERMISSION | No file write permission.| 642| HIDEBUG_TRACE_ABNORMAL | Abnormal trace status.| 643 644 645### HiDebug_TraceFlag 646 647``` 648enum HiDebug_TraceFlag 649``` 650 651**Description** 652 653Enumerates the types of the threads for trace collection. 654 655**Since**: 12 656 657| Value| Description| 658| -------- | -------- | 659| HIDEBUG_TRACE_FLAG_MAIN_THREAD | Only the main thread of the current application.| 660| HIDEBUG_TRACE_FLAG_ALL_THREADS | All threads of the current application.| 661 662 663## Function Description 664 665 666### OH_HiDebug_FreeThreadCpuUsage() 667 668``` 669void OH_HiDebug_FreeThreadCpuUsage (HiDebug_ThreadCpuUsagePtr * threadCpuUsage) 670``` 671 672**Description** 673 674Releases the **HiDebug_ThreadCpuUsagePtr**. 675 676**Since**: 12 677 678**Parameters** 679 680| Name| Description| 681| -------- | -------- | 682| threadCpuUsage | Pointer to the buffer that stores the available CPU for all threads of the application. For details, see [HiDebug_ThreadCpuUsagePtr](#hidebug_threadcpuusageptr). The input parameter is obtained by **OH_HiDebug_GetAppThreadCpuUsage()**.| 683 684 685### OH_HiDebug_GetAppCpuUsage() 686 687``` 688double OH_HiDebug_GetAppCpuUsage () 689``` 690 691**Description** 692 693Obtains the CPU usage of an application. 694 695**Since**: 12 696 697**Returns** 698 699Returns the application CPU usage obtained if the operation is successful. Returns **0** if the operation fails. 700 701 702### OH_HiDebug_GetAppMemoryLimit() 703 704``` 705void OH_HiDebug_GetAppMemoryLimit (HiDebug_MemoryLimit * memoryLimit) 706``` 707 708**Description** 709 710Obtains the memory limit of an application process. 711 712**Since**: 12 713 714**Parameters** 715 716| Name| Description| 717| -------- | -------- | 718| memoryLimit | Pointer to the [HiDebug_MemoryLimit](_hi_debug___memory_limit.md) to obtain. If the struct is empty, the function call fails.| 719 720 721### OH_HiDebug_GetAppNativeMemInfo() 722 723``` 724void OH_HiDebug_GetAppNativeMemInfo (HiDebug_NativeMemInfo * nativeMemInfo) 725``` 726 727**Description** 728 729Obtains the memory information of an application process. 730 731**Since**: 12 732 733**Parameters** 734 735| Name| Description| 736| -------- | -------- | 737| nativeMemInfo | Pointer to the [HiDebug_NativeMemInfo](_hi_debug___native_mem_info.md) to obtain. If the struct is empty, the function call fails.| 738 739 740### OH_HiDebug_GetAppThreadCpuUsage() 741 742``` 743HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage () 744``` 745 746**Description** 747 748Obtains the CPU usage of all threads of an application. 749 750**Since**: 12 751 752**Returns** 753 754Returns the CPU usage of all threads. For details, see [HiDebug_ThreadCpuUsagePtr](#hidebug_threadcpuusageptr). Returns **null** if the function fails to be called. 755 756 757### OH_HiDebug_GetSystemCpuUsage() 758 759``` 760double OH_HiDebug_GetSystemCpuUsage () 761``` 762 763**Description** 764 765Obtains the CPU usage of the system. 766 767**Since**: 12 768 769**Returns** 770 771Returns the system CPU usage if the operation is successful. Returns **0** if the operation fails. 772 773### OH_HiDebug_GetSystemMemInfo() 774 775``` 776void OH_HiDebug_GetSystemMemInfo (HiDebug_SystemMemInfo * systemMemInfo) 777``` 778 779**Description** 780 781Obtains system memory information. 782 783**Since**: 12 784 785**Parameters** 786 787| Name| Description| 788| -------- | -------- | 789| systemMemInfo | Pointer to the [HiDebug_SystemMemInfo](_hi_debug___system_mem_info.md) to obtain. If the struct is empty, the function call fails.| 790 791 792### OH_HiDebug_StartAppTraceCapture() 793 794``` 795HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture (HiDebug_TraceFlag flag, uint64_t tags, uint32_t limitSize, char * fileName, uint32_t length ) 796``` 797 798**Description** 799 800Starts application trace collection. 801 802**Since**: 12 803 804**Parameters** 805 806| Name| Description| 807| -------- | -------- | 808| flag | Type of the thread (the main thread or all threads of the application) to trace.| 809| tags | Modules or subsystems to trace.| 810| limitSize | Maximum size of the trace file (in bytes), which is 500 MB.| 811| fileName | Buffer for the output trace file.| 812| length | Length of the buffer for the output trace file.| 813 814**Returns** 815 8160 - The operation is successful. 401 - The **fileName** parameter is a null pointer, the input **length** parameter is too small, or the value of **limitSize** is **0** or smaller than **0**. 11400102 - A trace is already started. 11400103 - You do not have the permission to start the trace function. 11400104 - An internal system error occurs. 817 818 819### OH_HiDebug_StopAppTraceCapture() 820 821``` 822HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture () 823``` 824 825**Description** 826 827Stops application trace collection. 828 829**Since**: 12 830 831**Returns** 832 8330 - The operation is successful. 11400104 - An internal system error occurs. 11400105 - No trace is being performed. 834 835### OH_HiDebug_GetGraphicsMemory(); 836``` 837HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value); 838``` 839 840**Description** 841 842Obtains the size of the GPU memory. 843 844**Since**: 14 845 846**Parameters** 847 848| Name| Description | 849| -------- |---------------------------------| 850| value | Pointer to the variable that stores the size (in KB) of the obtained GPU memory.| 851 852**Returns** 853 8540 - The operation is successful. 401- The input parameter is invalid. 11400104 - An internal system error occurs. 855