From c924a433c8e956378d037da5f4e10dcd8229a001 Mon Sep 17 00:00:00 2001 From: zhouhaifeng Date: Fri, 19 Jul 2024 14:55:45 +0800 Subject: [PATCH 1/4] add the memory statistics api of application Signed-off-by: zhouhaifeng --- hiviewdfx/hidebug/include/hidebug/hidebug.h | 20 +++++++++++ .../hidebug/include/hidebug/hidebug_type.h | 33 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index a5bfec7b6..8af434ba5 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -138,6 +138,26 @@ HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, */ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); +/** + * @brief Get the memory of application by item. + * + * @param item Indicates memory item to {@link HiDebug_MemoryItem} + * @param value Indicates value of memory item + * @return Returns {@code HIDEBUG_SUCCESS} if successful. See {@link HiDebug_ErrorCode} + * @since 13 + */ +HiDebug_ErrorCode OH_HiDebug_GetApMemoryStat(HiDebug_MemoryItem item, uint32_t *value); + +/** + * @brief Get the memory of application. + * + * @param appMemoryItem Indicates memory item to {@link HiDebug_AppMemoryItemPtr} + * @param size Indicates size of HiDebug_AppMemoryItem + * @return Returns {@code HIDEBUG_SUCCESS} if successful. See {@link HiDebug_ErrorCode} + * @since 13 + */ +HiDebug_ErrorCode OH_HiDebug_GetApMemoryStats(HiDebug_AppMemoryItemPtr *appMemoryItem, uint32_t *size); + #ifdef __cplusplus } #endif // __cplusplus diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h index 6976244e2..b6fec6a4c 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h @@ -173,6 +173,39 @@ typedef enum HiDebug_TraceFlag { /** Capture all thread trace */ HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 } HiDebug_TraceFlag; + +/** + * @brief Enum for application memory item. + * + * @since 13 + */ +typedef enum HiDebug_MemoryItem { + /** total graphics memory, in kilobyte */ + HIDEBUG_MEMORY_ITEM_SUMMARY_GRAPHICS = 1, +} HiDebug_MemoryItem; + +/** + * @brief Defines application process memory statistics item. + * + * @since 13 + */ +typedef struct HiDebug_AppMemoryItem { + /** + * Application memory item + */ + HiDebug_MemoryItem item; + /** + * Application memory value of item + */ + uint32_t value; +} HiDebug_AppMemoryItem; + +/** + * @brief Defines pointer to application process memory statistics item. + * + * @since 13 + */ +typedef HiDebug_AppMemoryItem* HiDebug_AppMemoryItemPtr; #ifdef __cplusplus } #endif // __cplusplus -- Gitee From 322ecbf64c79a3ceb8aa918335efdbb3cb650e33 Mon Sep 17 00:00:00 2001 From: zhouhaifeng Date: Fri, 26 Jul 2024 19:45:57 +0800 Subject: [PATCH 2/4] add the api of graphics memory Signed-off-by: zhouhaifeng --- hiviewdfx/hidebug/include/hidebug/hidebug.h | 17 ++-------- .../hidebug/include/hidebug/hidebug_type.h | 32 ------------------- 2 files changed, 3 insertions(+), 46 deletions(-) diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index 8af434ba5..a2dee88f9 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -139,24 +139,13 @@ HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); /** - * @brief Get the memory of application by item. + * @brief Get the graphics memory of application. * - * @param item Indicates memory item to {@link HiDebug_MemoryItem} - * @param value Indicates value of memory item + * @param value Indicates value of graphics memory * @return Returns {@code HIDEBUG_SUCCESS} if successful. See {@link HiDebug_ErrorCode} * @since 13 */ -HiDebug_ErrorCode OH_HiDebug_GetApMemoryStat(HiDebug_MemoryItem item, uint32_t *value); - -/** - * @brief Get the memory of application. - * - * @param appMemoryItem Indicates memory item to {@link HiDebug_AppMemoryItemPtr} - * @param size Indicates size of HiDebug_AppMemoryItem - * @return Returns {@code HIDEBUG_SUCCESS} if successful. See {@link HiDebug_ErrorCode} - * @since 13 - */ -HiDebug_ErrorCode OH_HiDebug_GetApMemoryStats(HiDebug_AppMemoryItemPtr *appMemoryItem, uint32_t *size); +HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value); #ifdef __cplusplus } diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h index b6fec6a4c..cd8cbb8c8 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h @@ -174,38 +174,6 @@ typedef enum HiDebug_TraceFlag { HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 } HiDebug_TraceFlag; -/** - * @brief Enum for application memory item. - * - * @since 13 - */ -typedef enum HiDebug_MemoryItem { - /** total graphics memory, in kilobyte */ - HIDEBUG_MEMORY_ITEM_SUMMARY_GRAPHICS = 1, -} HiDebug_MemoryItem; - -/** - * @brief Defines application process memory statistics item. - * - * @since 13 - */ -typedef struct HiDebug_AppMemoryItem { - /** - * Application memory item - */ - HiDebug_MemoryItem item; - /** - * Application memory value of item - */ - uint32_t value; -} HiDebug_AppMemoryItem; - -/** - * @brief Defines pointer to application process memory statistics item. - * - * @since 13 - */ -typedef HiDebug_AppMemoryItem* HiDebug_AppMemoryItemPtr; #ifdef __cplusplus } #endif // __cplusplus -- Gitee From 2ab33602240532decb656ac72b19b803a1375515 Mon Sep 17 00:00:00 2001 From: zhouhaifeng Date: Wed, 14 Aug 2024 14:12:43 +0800 Subject: [PATCH 3/4] fix description of hidebug Signed-off-by: zhouhaifeng --- hiviewdfx/hidebug/include/hidebug/hidebug.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index a2dee88f9..e4b3776a0 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -141,8 +141,10 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); /** * @brief Get the graphics memory of application. * - * @param value Indicates value of graphics memory - * @return Returns {@code HIDEBUG_SUCCESS} if successful. See {@link HiDebug_ErrorCode} + * @param value Indicates value of graphics memory, in kibibytes. + * @return 0 - Success. + * 401 - Invalid argument,value is null. + * 11400104 - Failed to get the application memory due to a remote exception. * @since 13 */ HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value); -- Gitee From 482c48b013970dfbb20aa7344a29a0bdc0914e26 Mon Sep 17 00:00:00 2001 From: zhouhaifeng Date: Thu, 15 Aug 2024 10:56:50 +0800 Subject: [PATCH 4/4] fix the result code Signed-off-by: zhouhaifeng --- hiviewdfx/hidebug/include/hidebug/hidebug.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index e4b3776a0..cd9eaa828 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -142,9 +142,10 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); * @brief Get the graphics memory of application. * * @param value Indicates value of graphics memory, in kibibytes. - * @return 0 - Success. - * 401 - Invalid argument,value is null. - * 11400104 - Failed to get the application memory due to a remote exception. + * @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 13 */ HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value); -- Gitee