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