From a363a945c426ccc066eadd789ad0f9cde64144fc Mon Sep 17 00:00:00 2001 From: yu_haoqiang Date: Sat, 12 Jul 2025 15:18:07 +0800 Subject: [PATCH] =?UTF-8?q?hidebug=E6=96=B0=E5=A2=9Endk=E6=8E=A5=E5=8F=A3G?= =?UTF-8?q?etAppNativeMemInfoWithCache?= 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 | 91 ++------------------- 1 file changed, 9 insertions(+), 82 deletions(-) diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index 23cf8235c..147ce6caf 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -34,13 +34,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 @@ -145,96 +142,26 @@ 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 */ HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value); /** - * @brief Replace MallocDispatch table with developer-defined memory allocation functions. - * - * @param dispatchTable A pointer to the MallocDispatch table. - * @return Result code - * {@link HIDEBUG_SUCCESS} The MallocDispatch table is successfully overriden. - * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument, dispatchTable is a null pointer. - * @since 20 - */ -HiDebug_ErrorCode OH_HiDebug_SetMallocDispatchTable(struct HiDebug_MallocDispatch *dispatchTable); - -/** - * @brief Obtain current MallocDispatch table. - * - * @return Returns a pointer to MallocDispatch table on success, or NULL on failure. - - * @since 20 - */ -HiDebug_MallocDispatch* OH_HiDebug_GetDefaultMallocDispatchTable(void); - -/** - * @brief Restore original MallocDispatch table. - * - * @since 20 - */ -void OH_HiDebug_RestoreMallocDispatchTable(void); - -/** - * @brief Get backtrace frames start from the given frame pointer and the function is signal-safe. + * @brief Obtains the memory info of application process. The application memory info cache is refresh every 5 minute. + * It will be forced to refresh when input true of forceRefresh parameter. * - * @param object The backtrace object create by {@link OH_HiDebug_CreateBacktraceObject}. - * @param startFp The entry frame pointer. - * @param pcArray The array to place program counter values. - * @param size The size of the array to place program counter values. - * @return The number of stack frames written to array. - * @since 20 - */ -int OH_HiDebug_BacktraceFromFp(HiDebug_Backtrace_Object object, void* startFp, void** pcArray, int size); - -/** - * @brief Defines the callback of the {@link OH_HiDebug_SymbolicAddress} function. - * - * @param pc The program counter pass to {@link OH_HiDebug_SymbolicAddress}. - * @param arg The arg pass to {@link OH_HiDebug_SymbolicAddress}. - * @param frame The parsed frame content, the content is invalid after return of {@link OH_HiDebug_SymbolicAddress}. - * @since 20 - */ -typedef void (*OH_HiDebug_SymbolicAddressCallback)(void* pc, void* arg, const HiDebug_StackFrame* frame); - -/** - * @brief Get detailed symbol info by given pc and the function is not signal-safe. - * - * @param object The backtrace object create by {@link OH_HiDebug_CreateBacktraceObject}. - * @param pc The program counter return by {@link OH_HiDebug_BacktraceFromFp}. - * @param arg The arg will be pass to callback. - * @param callback The function to pass parsed frame to caller. - * @return Result code - * {@link HIDEBUG_SUCCESS} Get detailed frame info successfully and the callback is invoked. - * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument. - * {@link HIDEBUG_INVALID_SYMBOLIC_PC_ADDRESS} Could not find symbol info by given pc. - * @since 20 - */ -HiDebug_ErrorCode OH_HiDebug_SymbolicAddress(HiDebug_Backtrace_Object object, void* pc, void* arg, - OH_HiDebug_SymbolicAddressCallback callback); - -/** - * @brief Create a backtrace object for further using and the function is not signal-safe. - * - * @return BacktraceObject if Success or NULL if is not supported on current arch - * @since 20 - */ -HiDebug_Backtrace_Object OH_HiDebug_CreateBacktraceObject(void); - -/** - * @brief Destroy a backtrace object and the function is not signal-safe. - * - * @param object The object to be destroyed. + * @param nativeMemInfo Indicates the pointer to {@link HiDebug_NativeMemInfo}. + * If there is no data in structure after the function.The Possible reason is system error. + * @param forceRefresh It's true when application memeory info cache need to refresh. * @since 20 */ -void OH_HiDebug_DestroyBacktraceObject(HiDebug_Backtrace_Object object); - +void OH_HiDebug_GetAppNativeMemInfoWithCache(HiDebug_NativeMemInfo *nativeMemInfo, bool forceRefresh); #ifdef __cplusplus } #endif // __cplusplus -/** @} */ +/** @} */ +/** @} */ #endif // HIVIEWDFX_HIDEBUG_H \ No newline at end of file -- Gitee