!9520 新增PerfScoped特性

Merge pull request !9520 from wenlong_12/master
This commit is contained in:
openharmony_ci 2024-04-02 07:01:26 +00:00 committed by Gitee
commit 3abc804c8c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 9 additions and 0 deletions

View File

@ -92,6 +92,7 @@ ohos_shared_library("libvsync") {
"c_utils:utils",
"eventhandler:libeventhandler",
"hilog:libhilog",
"hitrace:hitrace_meter",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",

View File

@ -18,6 +18,7 @@
#include <unistd.h>
#include <scoped_bytrace.h>
#include <fcntl.h>
#include <hitrace_meter.h>
#include "event_handler.h"
#include "graphic_common.h"
#include "vsync_log.h"
@ -30,6 +31,7 @@ constexpr int32_t INVALID_FD = -1;
}
void VSyncCallBackListener::OnReadable(int32_t fileDescriptor)
{
HitracePerfScoped perfTrace(ScopedDebugTrace::isEnabled(), HITRACE_TAG_GRAPHIC_AGP, "OnReadablePerfCount");
if (fileDescriptor < 0) {
return;
}

View File

@ -34,6 +34,12 @@ class ScopedDebugTrace {
public:
ScopedDebugTrace(const std::string &traceStr);
~ScopedDebugTrace();
static bool isEnabled()
{
return debugTraceEnabled_;
}
private:
static bool debugTraceEnabled_;
};