Defines the structs of the HiDebug module.
File to include: <hidebug/hidebug_type.h>
Library: libohhidebug.so
System capability: SystemCapability.HiviewDFX.HiProfiler.HiDebug
Since: 12
Related module: HiDebug
| Name | typedef Keyword | Description |
|---|---|---|
| HiDebug_ThreadCpuUsage | HiDebug_ThreadCpuUsage | Defines the CPU usage structure for all threads in the current process. Use cases: Application performance monitoring: Obtain thread CPU usage to monitor the running status and performance bottlenecks of the application. Thread performance optimization: Analyze the CPU usage of each thread to optimize thread scheduling and resource allocation. System debugging: Track thread CPU usage during debugging to locate performance issues. |
| HiDebug_SystemMemInfo | HiDebug_SystemMemInfo | Defines the system memory information structure type. It is used to obtain key information such as the total, free, and available system memory, and is applicable to scenarios such as system performance analysis, memory monitoring, and fault diagnosis, helping developers understand system memory usage and optimize memory management strategies. |
| HiDebug_NativeMemInfo | HiDebug_NativeMemInfo | Defines the local memory information of an application process. |
| HiDebug_MemoryLimit | HiDebug_MemoryLimit | Defines the memory limit of an application process. |
| OH_HiDebug_RequestTraceConfig | OH_HiDebug_RequestTraceConfig | Defines the configuration structure type for requesting trace collection. It is used to configure trace collection parameters in application performance analysis and debugging scenarios, such as locating performance issues like slow application startup, UI lag, and high CPU usage. |
| HiDebug_JsStackFrame | HiDebug_JsStackFrame | Defines the js stack frame content. It is used to record frame information of the js call stack in performance analysis and debugging scenarios, including key information such as code location, function name, and mapping region. |
| HiDebug_NativeStackFrame | HiDebug_NativeStackFrame | Defines the native stack frame content. |
| HiDebug_StackFrame | HiDebug_StackFrame | Defines the stack frame content. This structure is used to represent stack frame information during debugging, and supports obtaining the type of the current stack and the corresponding js stack frame or Native stack frame content, helping developers locate issues and perform debugging analysis. |
| HiDebug_MallocDispatch | HiDebug_MallocDispatch | Defines the HiDebug_MallocDispatch table structure type that can be replaced/restored by the application process. Through this structure, developers can customize memory management function pointers to monitor and customize process memory allocation and deallocation. Key features include: supporting dynamic replacement and restoration of memory management functions, providing comprehensive memory operation interfaces (malloc, calloc, realloc, free, mmap, munmap), and not affecting the default system memory management behavior. Use cases include: memory leak detection, memory usage performance analysis, custom memory allocation strategies, and memory safety monitoring. It helps developers promptly identify and resolve memory issues, improving application stability and performance. |
| HiDebug_GraphicsMemorySummary | HiDebug_GraphicsMemorySummary | Defines the application graphics memory usage details. |
| HiDebug_ProcessSamplerConfig | HiDebug_ProcessSamplerConfig | Defines the sampling configuration. |
| HiDebug_Backtrace_Object__* | HiDebug_Backtrace_Object | Defines the object used for stack backtrace and stack parsing. This object encapsulates the context information required for stack backtrace, including data such as call stack addresses and thread states. Detailed stack frame information and symbol parsing results can be obtained through related interfaces. This object is created through HiDebug-related interfaces and must be released by calling the corresponding destruction interface after use. |
| HiDebug_ThreadCpuUsage* | HiDebug_ThreadCpuUsagePtr | Defines the pointer to HiDebug_ThreadCpuUsage. |
| OH_HiDebug_ResProfilerConfig | OH_HiDebug_ResProfilerConfig | Defines the resource profiling configurations. |
| OH_HiDebug_ProfilingResult | OH_HiDebug_ProfilingResult | Define the encapsulated result of a single resource profiling. |
| Name | typedef Keyword | Description |
|---|---|---|
| HiDebug_ErrorCode | HiDebug_ErrorCode | Enumerates the error codes. They are used as the return status identifier for each functional API of the HiDebug module, including success, invalid parameter, permission issue, system internal error, device not supported, and other cases. Developers can locate the cause of an issue based on the error code and take corresponding error handling measures. |
| HiDebug_TraceFlag | HiDebug_TraceFlag | Enumerates the thread types for trace collection. |
| HiDebug_StackFrameType | HiDebug_StackFrameType | Enumerates the stack frame types. |
| HiDebug_CrashObjType | HiDebug_CrashObjType | Enumerates the data types of debugging information. |
| OH_HiDebug_ResourceType | OH_HiDebug_ResourceType | Enumerates the resource profiling types. |
| OH_HiDebug_MemListenerType | OH_HiDebug_MemListenerType | Enumerates the memory listener callback types. Developers handle related logic based on the callback type. |
| Name | Description |
|---|---|
| HIDEBUG_TRACE_TAG_FFRT (1ULL << 13) | Indicates a function flow runtime (FFRT) task. Since: 12 |
| HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16) | Indicates the common library subsystem. Since: 12 |
| HIDEBUG_TRACE_TAG_HDF (1ULL << 18) | Indicates the HDF subsystem. Since: 12 |
| HIDEBUG_TRACE_TAG_NET (1ULL << 23) | Indicates the Network. Since: 12 |
| HIDEBUG_TRACE_TAG_NWEB (1ULL << 24) | Indicates the NWeb. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27) | Indicates the distributed audio. Since: 12 |
| HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29) | Indicates the file management. Since: 12 |
| HIDEBUG_TRACE_TAG_OHOS (1ULL << 30) | Indicates the HarmonyOS OS. Since: 12 |
| HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31) | Indicates the Ability Manager. Since: 12 |
| HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32) | Indicates the camera module. Since: 12 |
| HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33) | Indicates the media module. Since: 12 |
| HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34) | Indicates the image module. Since: 12 |
| HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35) | Indicates the audio module. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36) | Indicates the distributed data management. Since: 12 |
| HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) | Indicates the graphics module. Since: 12 |
| HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) | Indicates the ArkUI development framework. Since: 12 |
| HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40) | Indicates the notification module. Since: 12 |
| HIDEBUG_TRACE_TAG_MISC (1ULL << 41) | Indicates the MISC module. Since: 12 |
| HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42) | Indicates the multimodal input module. Since: 12 |
| HIDEBUG_TRACE_TAG_RPC (1ULL << 46) | Indicates a remote procedure call (RPC). Since: 12 |
| HIDEBUG_TRACE_TAG_ARK (1ULL << 47) | Indicates a JavaScript virtual machine (JSVM). Since: 12 |
| HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48) | Indicates the window manager. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50) | Indicates the distributed screen. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51) | Indicates the distributed camera. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52) | Indicates the distributed hardware framework. Since: 12 |
| HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53) | Indicates the global resource management. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54) | Indicates the distributed hardware device management. Since: 12 |
| HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55) | Indicates the Samgr (SA). Since: 12 |
| HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56) | Indicates the power manager. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57) | Indicates the distributed scheduler. Since: 12 |
| HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59) | Indicates the distributed input. Since: 12 |
| HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) | Indicates the Bluetooth. Since: 12 |
| Name | typedef Keyword | Description |
|---|---|---|
| typedef void (*OH_HiDebug_RequestTraceCallback)(HiDebug_ErrorCode errorCode, const char* filePath) | OH_HiDebug_RequestTraceCallback | Triggered for the trace collection request. |
| typedef void (*OH_HiDebug_ProfilingCallback)(OH_HiDebug_ProfilingResult* result) | OH_HiDebug_ProfilingCallback | Triggered for the resource profiling. |
enum HiDebug_ErrorCode
Description
Enumerates the error codes. They are used as the return status identifier for each functional API of the HiDebug module, including success, invalid parameter, permission issue, system internal error, device not supported, and other cases. Developers can locate the cause of an issue based on the error code and take corresponding error handling measures.
Since: 12
| Enum Item | Description |
|---|---|
| HIDEBUG_SUCCESS = 0 | Operation successful. |
| HIDEBUG_INVALID_ARGUMENT = 401 | Invalid parameter. Possible causes: 1. The parameter value is incorrect. 2. The parameter type is incorrect. |
| HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102 | Repeated collection. |
| HIDEBUG_NO_PERMISSION = 11400103 | No file write permission. |
| HIDEBUG_TRACE_ABNORMAL = 11400104 | Internal system error. |
| HIDEBUG_NO_TRACE_RUNNING = 11400105 | No trace task is running. |
| OH_HIDEBUG_TRACE_STORAGE_LIMIT = 11400120 | Trace file storage reaches the limit. since: 24 |
| HIDEBUG_INVALID_SYMBOLIC_PC_ADDRESS = 11400200 | The pc address passed to the symbol resolution function is invalid. since: 20 |
| HIDEBUG_NOT_SUPPORTED = 11400300 | Current device is not supported. Since: 22 |
| HIDEBUG_UNDER_SAMPLING = 11400301 | Current process is being sampled. Since: 22 |
| HIDEBUG_RESOURCE_UNAVAILABLE = 11400302 | Sampling resources are unavailable. Since: 22 |
| HIDEBUG_RES_PROF_SUCCESS = 11400400 | Resource profiling started or stopped successfully. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_ARG = 11400410 | Invalid resource profiling parameter. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_MAX_DURATION = 11400411 | Invalid maximum duration for resource profiling. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_FILTER_SIZE = 11400412 | Invalid resource profiling filtering size. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_MAX_STACK_DEPTH = 11400413 | Invalid maximum stack depth for resource profiling. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_STATISTICS_INTERVAL = 11400414 | Invalid statistics interval for resource profiling. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_SAMPLE_INTERVAL = 11400415 | Invalid sampling size for resource profiling. Since: 24 |
| HIDEBUG_RES_PROF_INVALID_RESOURCE_TYPE = 11400416 | Invalid resource type for resource profiling. Since: 24 |
| HIDEBUG_RES_PROF_PERMISSION_DENIED = 11400420 | Insufficient resource profiling permission. The target process for resource profiling can only be the process that calls this API. Since: 24 |
| HIDEBUG_RES_PROF_ALREADY_STARTED = 11400421 | Resource profiling is repeatedly started. Since: 24 |
| HIDEBUG_RES_PROF_NOT_STARTED = 11400422 | Failed to stop resource profiling because it is not started. Since: 24 |
| HIDEBUG_RES_PROF_PROCESS_OVERLIMIT = 11400423 | The number of resource profiling processes exceeds 4. Since: 24 |
| HIDEBUG_RES_PROF_CONFLICT = 11400424 | Resource profiling conflicts with CLI tools or system collection tasks. Since: 24 |
| HIDEBUG_RES_PROF_AUTO_STOPPED_BY_DURATION = 11400425 | Resource profiling automatically stopped due to the duration limit. Since: 24 |
| HIDEBUG_RES_PROF_DAILY_QUOTA_EXCEEDED = 11400426 | The daily quota for resource profiling exceeded 10 times. Since: 24 |
| HIDEBUG_RES_PROF_CPU_OVERLOADED = 11400427 | The system CPU is overloaded, with the CPU usage exceeding 70%. Since: 24 |
| HIDEBUG_RES_PROF_MEM_PRESSURE_CRITICAL = 11400428 | The available memory space is less than 15%. Since: 24 |
| HIDEBUG_RES_PROF_STORAGE_PRESSURE_CRITICAL = 11400429 | The available storage space is less than 15%. Since: 24 |
| HIDEBUG_RES_PROF_FAILURE = 11400430 | Failed to start or stop resource profiling. Since: 24 |
enum HiDebug_TraceFlag
Description
Enumerates the thread types for trace collection.
Since: 12
| Enum Item | Description |
|---|---|
| HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1 | Only the main thread of the current application. |
| HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 | All threads of the application. |
enum HiDebug_StackFrameType
Description
Enumerates the stack frame types.
Since: 20
| Enum Item | Description |
|---|---|
| HIDEBUG_STACK_FRAME_TYPE_JS = 1 | JS stack frame. |
| HIDEBUG_STACK_FRAME_TYPE_NATIVE = 2 | Native stack frame. |
enum HiDebug_CrashObjType
Description
Enumerates the data types of debugging information.
Since: 23
| Enum Item | Description |
|---|---|
| HIDEBUG_CRASHOBJ_STRING = 0 | String. |
| HIDEBUG_CRASHOBJ_MEMORY_64B = 1 | 64-byte memory block. |
| HIDEBUG_CRASHOBJ_MEMORY_256B = 2 | 256-byte memory block. |
| HIDEBUG_CRASHOBJ_MEMORY_1024B = 3 | 1024-byte memory block. |
| HIDEBUG_CRASHOBJ_MEMORY_2048B = 4 | 2048-byte memory block. |
| HIDEBUG_CRASHOBJ_MEMORY_4096B = 5 | 4096-byte memory block. |
enum OH_HiDebug_ResourceType
Description
Enumerates the resource profiling types.
Since: 24
| Enum Item | Description |
|---|---|
| OH_RES_TYPE_FD | File descriptor. Since: 24 |
| OH_RES_TYPE_THREAD | Thread. Since: 24 |
| OH_RES_TYPE_NATIVE | Native memory. Since: 24 |
| OH_RES_TYPE_GPU | GPU memory. Since: 24 |
| OH_RES_TYPE_GLOBAL_HANDLE | Global handle. Since: 24 |
enum OH_HiDebug_MemListenerType
Description
Enumerates the memory listener callback types. Developers handle related logic based on the callback type.
Since: 26.0.0
| Enum Item | Description |
|---|---|
| OH_HIDEBUG_DO_NOTHING = 0 | No specific operation is performed. Only a notification callback is performed. Since: 26.0.0 |
| OH_HIDEBUG_RUNNING_GC = 1 | Perform garbage collection (GC). Since: 26.0.0 |
| OH_HIDEBUG_DUMP_SNAPSHOT = 2 | Export memory snapshot. Since: 26.0.0 |
#define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13)
Description
Indicates a function flow runtime (FFRT) task.
Since: 12
#define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16)
Description
Indicates the common library subsystem.
Since: 12
#define HIDEBUG_TRACE_TAG_HDF (1ULL << 18)
Description
Indicates the HDF subsystem.
Since: 12
#define HIDEBUG_TRACE_TAG_NET (1ULL << 23)
Description
Indicates the Network.
Since: 12
#define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24)
Description
Indicates the NWeb.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27)
Description
Indicates the distributed audio.
Since: 12
#define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29)
Description
Indicates the file management.
Since: 12
#define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30)
Description
Indicates the HarmonyOS OS.
Since: 12
#define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31)
Description
Indicates the Ability Manager.
Since: 12
#define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32)
Description
Indicates the camera module.
Since: 12
#define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33)
Description
Indicates the media module.
Since: 12
#define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34)
Description
Indicates the image module.
Since: 12
#define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35)
Description
Indicates the audio module.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36)
Description
Indicates the distributed data management.
Since: 12
#define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38)
Description
Indicates the graphics module.
Since: 12
#define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39)
Description
Indicates the ArkUI development framework.
Since: 12
#define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40)
Description
Indicates the notification module.
Since: 12
#define HIDEBUG_TRACE_TAG_MISC (1ULL << 41)
Description
Indicates the MISC module.
Since: 12
#define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42)
Description
Indicates the multimodal input module.
Since: 12
#define HIDEBUG_TRACE_TAG_RPC (1ULL << 46)
Description
Indicates a remote procedure call (RPC).
Since: 12
#define HIDEBUG_TRACE_TAG_ARK (1ULL << 47)
Description
Indicates a JavaScript virtual machine (JSVM).
Since: 12
#define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48)
Description
Indicates the window manager.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50)
Description
Indicates the distributed screen.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51)
Description
Indicates the distributed camera.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52)
Description
Indicates the distributed hardware framework.
Since: 12
#define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53)
Description
Indicates the global resource management.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54)
Description
Indicates the distributed hardware device management.
Since: 12
#define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55)
Description
Indicates the Samgr (SA).
Since: 12
#define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56)
Description
Indicates the power manager.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57)
Description
Indicates the distributed scheduler.
Since: 12
#define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59)
Description
Indicates the distributed input.
Since: 12
#define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60)
Description
Indicates the Bluetooth.
Since: 12
typedef void (*OH_HiDebug_RequestTraceCallback)(HiDebug_ErrorCode errorCode, const char* filePath)
Description
Triggered for the trace collection request.
Since: 24
Parameters
| Name | Description |
|---|---|
| HiDebug_ErrorCode errorCode | Result code. For details, see HiDebug_ErrorCode. |
| const char* filePath | Pointer to the collected trace file. If the operation fails, a null pointer may be returned. |
typedef void (*OH_HiDebug_ProfilingCallback)(OH_HiDebug_ProfilingResult* result)
Description
Triggered for the resource profiling.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_HiDebug_ProfilingResult* result | Pointer to the parameters of the resource profiling callback function. |