diff options
author | Wiwit Rifa'i <wiwitrifai@google.com> | 2022-10-12 21:29:28 +0800 |
---|---|---|
committer | Wiwit Rifa'i <wiwitrifai@google.com> | 2022-12-12 11:54:15 +0800 |
commit | 5d0685b97bf164e96ffe3fc4e0bd45c14cdabcb2 (patch) | |
tree | 1bdd24e36f8f2074662e9d13dc2076c05db80975 /libhwc2.1/ExynosHWCDebug.h | |
parent | da079aad87a44d4ab7fd837ce32a59a06a00b1c0 (diff) |
libhwc2.1: update some traces to include display name and ID
All counter traces in HWC will be updated to include display name and ID
with format "<old_trace_name> for <display_name>(<display_id>)".
Some function traces will also updated to include display name and ID
with the same format, e.g. for validateDisplay and presentDisplay.
Bug: 245533789
Test: Perfetto trace
Change-Id: Id8f7d74241431ebdc2ca5578e150df7b210d47be
Diffstat (limited to 'libhwc2.1/ExynosHWCDebug.h')
-rw-r--r-- | libhwc2.1/ExynosHWCDebug.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libhwc2.1/ExynosHWCDebug.h b/libhwc2.1/ExynosHWCDebug.h index 8d2355b..25178d1 100644 --- a/libhwc2.1/ExynosHWCDebug.h +++ b/libhwc2.1/ExynosHWCDebug.h @@ -17,6 +17,8 @@ #define HWC_DEBUG_H #include <utils/String8.h> +#include <utils/Trace.h> + #include "ExynosHWC.h" #include "ExynosHWCHelper.h" @@ -131,4 +133,30 @@ int32_t saveFenceTrace(ExynosDisplay *display); saveErrorLog(saveString, display); \ } +class ScopedTraceEnder { +public: + ~ScopedTraceEnder() { ATRACE_END(); } +}; + +#define ATRACE_FORMAT(fmt, ...) \ + if (CC_UNLIKELY(ATRACE_ENABLED())) { \ + String8 traceName; \ + traceName.appendFormat(fmt, ##__VA_ARGS__); \ + ATRACE_BEGIN(traceName.string()); \ + } \ + ScopedTraceEnder traceEnder + +#define DISPLAY_ATRACE_NAME(name) ATRACE_FORMAT("%s for %s", name, mDisplayTraceName.string()) +#define DISPLAY_ATRACE_CALL() DISPLAY_ATRACE_NAME(__func__) +#define DISPLAY_ATRACE_INT(name, value) \ + if (CC_UNLIKELY(ATRACE_ENABLED())) { \ + ATRACE_INT(String8::format("%s for %s", name, mDisplayTraceName.string()).string(), \ + value); \ + } +#define DISPLAY_ATRACE_INT64(name, value) \ + if (CC_UNLIKELY(ATRACE_ENABLED())) { \ + ATRACE_INT64(String8::format("%s for %s", name, mDisplayTraceName.string()).string(), \ + value); \ + } + #endif |