Switch remaining atrace calls to use sf specific macro
Flag: EXEMPT refactor
Bug: 349905670
Test: presubmit
Change-Id: Ifed012cbaf76dba434191eff426c1c79f8c9dfbd
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
index da56014..334c104 100644
--- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
+++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
@@ -211,7 +211,7 @@
return;
}
SFTRACE_CALL();
- if (sTraceHintSessionData) ATRACE_INT("Session hint", static_cast<int>(hint));
+ if (sTraceHintSessionData) SFTRACE_INT("Session hint", static_cast<int>(hint));
{
std::scoped_lock lock(mHintSessionMutex);
if (!ensurePowerHintSessionRunning()) {
@@ -298,7 +298,7 @@
SFTRACE_CALL();
{
mTargetDuration = targetDuration;
- if (sTraceHintSessionData) ATRACE_INT64("Time target", targetDuration.ns());
+ if (sTraceHintSessionData) SFTRACE_INT64("Time target", targetDuration.ns());
if (targetDuration == mLastTargetDurationSent) return;
std::scoped_lock lock(mHintSessionMutex);
if (!ensurePowerHintSessionRunning()) {
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.h b/services/surfaceflinger/DisplayHardware/PowerAdvisor.h
index bc4a41b..1076b2b 100644
--- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.h
+++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.h
@@ -300,7 +300,7 @@
bool mSessionConfigSupported = true;
bool mFirstConfigSupportCheck = true;
- // Whether we should emit ATRACE_INT data for hint sessions
+ // Whether we should emit SFTRACE_INT data for hint sessions
static const bool sTraceHintSessionData;
// Default target duration for the hint session
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 86c7d16..9a4a153 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -3238,7 +3238,7 @@
return static_cast<nsecs_t>(0);
}();
- if (ATRACE_ENABLED() && presentTime > 0) {
+ if (SFTRACE_ENABLED() && presentTime > 0) {
const auto presentIn = TimePoint::fromNs(presentTime) - TimePoint::now();
SFTRACE_FORMAT_INSTANT("presentIn %s", to_string(presentIn).c_str());
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index d3b56f8..52f169e 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -1265,7 +1265,7 @@
const std::string mBlastTransactionName{"BufferTX - " + mName};
// This integer is incremented everytime a buffer arrives at the server for this layer,
// and decremented when a buffer is dropped or latched. When changed the integer is exported
- // to systrace with ATRACE_INT and mBlastTransactionName. This way when debugging perf it is
+ // to systrace with SFTRACE_INT and mBlastTransactionName. This way when debugging perf it is
// possible to see when a buffer arrived at the server, and in which frame it latched.
//
// You can understand the trace this way:
diff --git a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
index 0b17c84..a20cf9a 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
@@ -1065,7 +1065,7 @@
ALOGV("%s: overriding to %s for uid=%d", __func__, to_string(overrideFps).c_str(), uid);
SFTRACE_FORMAT_INSTANT("%s: overriding to %s for uid=%d", __func__,
to_string(overrideFps).c_str(), uid);
- if (ATRACE_ENABLED() && FlagManager::getInstance().trace_frame_rate_override()) {
+ if (SFTRACE_ENABLED() && FlagManager::getInstance().trace_frame_rate_override()) {
std::stringstream ss;
ss << "FrameRateOverride " << uid;
SFTRACE_INT(ss.str().c_str(), overrideFps.getIntValue());
diff --git a/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.cpp b/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.cpp
index 8dae3ca..900bce0 100644
--- a/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.cpp
+++ b/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.cpp
@@ -45,7 +45,7 @@
}
void traceEntry(const VSyncDispatchTimerQueueEntry& entry, nsecs_t now) {
- if (!ATRACE_ENABLED() || !entry.wakeupTime().has_value() || !entry.targetVsync().has_value()) {
+ if (!SFTRACE_ENABLED() || !entry.wakeupTime().has_value() || !entry.targetVsync().has_value()) {
return;
}
diff --git a/services/surfaceflinger/Scheduler/src/Timer.cpp b/services/surfaceflinger/Scheduler/src/Timer.cpp
index fba3d58..20c58eb 100644
--- a/services/surfaceflinger/Scheduler/src/Timer.cpp
+++ b/services/surfaceflinger/Scheduler/src/Timer.cpp
@@ -188,7 +188,7 @@
int nfds = epoll_wait(mEpollFd, events, DispatchType::MAX_DISPATCH_TYPE, -1);
setDebugState(DebugState::Running);
- if (ATRACE_ENABLED()) {
+ if (SFTRACE_ENABLED()) {
ftl::Concat trace("TimerIteration #", iteration++);
SFTRACE_NAME(trace.c_str());
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d00e762..c25c7bc 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3320,9 +3320,9 @@
});
}
- // Even though ATRACE_INT64 already checks if tracing is enabled, it doesn't prevent the
+ // Even though SFTRACE_INT64 already checks if tracing is enabled, it doesn't prevent the
// side-effect of getTotalSize(), so we check that again here
- if (ATRACE_ENABLED()) {
+ if (SFTRACE_ENABLED()) {
// getTotalSize returns the total number of buffers that were allocated by SurfaceFlinger
SFTRACE_INT64("Total Buffer Size", GraphicBufferAllocator::get().getTotalSize());
}
diff --git a/services/surfaceflinger/TracedOrdinal.h b/services/surfaceflinger/TracedOrdinal.h
index eba1ecf..51f33a6 100644
--- a/services/surfaceflinger/TracedOrdinal.h
+++ b/services/surfaceflinger/TracedOrdinal.h
@@ -79,7 +79,7 @@
private:
void trace() {
- if (CC_LIKELY(!ATRACE_ENABLED())) {
+ if (CC_LIKELY(!SFTRACE_ENABLED())) {
return;
}
diff --git a/services/surfaceflinger/common/include/common/trace.h b/services/surfaceflinger/common/include/common/trace.h
index c13cdde..344359e 100644
--- a/services/surfaceflinger/common/include/common/trace.h
+++ b/services/surfaceflinger/common/include/common/trace.h
@@ -20,6 +20,10 @@
#include <cutils/trace.h>
#include <stdint.h>
+#ifndef ATRACE_TAG
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#endif
+
#define SFTRACE_ENABLED() ATRACE_ENABLED()
#define SFTRACE_BEGIN(name) ATRACE_BEGIN(name)
#define SFTRACE_END() ATRACE_END()