From d5e0c61f7d3aea0ed9b9af2e475200d55191ccbb Mon Sep 17 00:00:00 2001 From: yu_haoqiang Date: Thu, 14 Aug 2025 09:50:28 +0800 Subject: [PATCH] =?UTF-8?q?hidebug=E6=96=B0=E5=A2=9Endk=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yu_haoqiang --- hiviewdfx/hidebug/include/hidebug/hidebug.h | 23 +++++++++++++++---- .../hidebug/include/hidebug/hidebug_type.h | 20 +++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index 287cf4433ec..f097a060c55 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -1,3 +1,4 @@ + /* * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,13 +35,10 @@ * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug * @since 12 */ - #ifndef HIVIEWDFX_HIDEBUG_H #define HIVIEWDFX_HIDEBUG_H - #include #include "hidebug_type.h" - #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -159,7 +157,7 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); * @param value Indicates value of graphics memory, in kibibytes. * @return Result code * {@link HIDEBUG_SUCCESS} Get graphics memory success. - * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument,value is null. + * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument£¬value is null. * {@link HIDEBUG_TRACE_ABNORMAL} Failed to get the application memory due to a remote exception. * @since 14 */ @@ -246,9 +244,24 @@ HiDebug_Backtrace_Object OH_HiDebug_CreateBacktraceObject(void); */ void OH_HiDebug_DestroyBacktraceObject(HiDebug_Backtrace_Object object); +/** + * @brief Create the graphics memory summary of application. + * + * @param interval If the cache of graphics memory is older than interval (unit: second), than the latest + * graphics memory data will be obtained. The interval value range is 2 seconds to + * 3600 seconds, If interval is an invalid value, the default value is 300 seconds. + * @param summary Indicates value of graphics memory summary, in kibibytes. + * @return Result code + * {@link HIDEBUG_SUCCESS} Get graphics memory success. + * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument, value is null. + * {@link HIDEBUG_TRACE_ABNORMAL} Failed to get the application memory due to a remote exception. + * @since 21 + */ +HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemorySummary(uint32_t interval, GraphicsMemorySummary *summary); #ifdef __cplusplus } #endif // __cplusplus -/** @} */ +/** @} */ +/** @} */ #endif // HIVIEWDFX_HIDEBUG_H \ No newline at end of file diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h index 9ff70423aea..0d1b798a45f 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h @@ -185,7 +185,7 @@ typedef enum HiDebug_TraceFlag { * @brief Defines structure type for MallocDispatch table. * * @since 20 - */ +*/ typedef struct HiDebug_MallocDispatch { void* (*malloc)(size_t); void* (*calloc)(size_t, size_t); @@ -313,6 +313,23 @@ typedef struct HiDebug_StackFrame { */ typedef struct HiDebug_Backtrace_Object__* HiDebug_Backtrace_Object; +/** + * @brief Defines the graphics memory summary structure type. + * + * @since 21 + */ +typedef struct GraphicsMemorySummary { + /** + * GL memory + */ + uint32_t gl; + + /** + * graph memory + */ + uint32_t graph; +} GraphicsMemorySummary; + #ifdef __cplusplus } #endif // __cplusplus @@ -510,6 +527,7 @@ typedef struct HiDebug_Backtrace_Object__* HiDebug_Backtrace_Object; */ #define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) +/** @} */ /** @} */ #endif // HIVIEWDFX_HIDEBUG_TYPE_H \ No newline at end of file -- Gitee