Create a wrapper for atrace macros
Create a SF specific macro to call into atrace. This will make the
switch to perfetto for capturing atrace tags easier.
Flag: EXEMPT refactor
Bug: 349905670
Test: perfetto
Change-Id: I4d046d837f52ef78b08e3c97556f2eddb06232dd
diff --git a/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp b/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp
index f671006..5550565 100644
--- a/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp
+++ b/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp
@@ -22,8 +22,8 @@
#include <android-base/stringprintf.h>
#include <common/FlagManager.h>
+#include <common/trace.h>
#include <utils/Log.h>
-#include <utils/Trace.h>
#include <chrono>
#include <cinttypes>
@@ -829,7 +829,7 @@
namespace impl {
int64_t TokenManager::generateTokenForPredictions(TimelineItem&& predictions) {
- ATRACE_CALL();
+ SFTRACE_CALL();
std::scoped_lock lock(mMutex);
while (mPredictions.size() >= kMaxTokens) {
mPredictions.erase(mPredictions.begin());
@@ -875,7 +875,7 @@
std::shared_ptr<SurfaceFrame> FrameTimeline::createSurfaceFrameForToken(
const FrameTimelineInfo& frameTimelineInfo, pid_t ownerPid, uid_t ownerUid, int32_t layerId,
std::string layerName, std::string debugName, bool isBuffer, GameMode gameMode) {
- ATRACE_CALL();
+ SFTRACE_CALL();
if (frameTimelineInfo.vsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) {
return std::make_shared<SurfaceFrame>(frameTimelineInfo, ownerPid, ownerUid, layerId,
std::move(layerName), std::move(debugName),
@@ -911,14 +911,14 @@
}
void FrameTimeline::addSurfaceFrame(std::shared_ptr<SurfaceFrame> surfaceFrame) {
- ATRACE_CALL();
+ SFTRACE_CALL();
std::scoped_lock lock(mMutex);
mCurrentDisplayFrame->addSurfaceFrame(surfaceFrame);
}
void FrameTimeline::setSfWakeUp(int64_t token, nsecs_t wakeUpTime, Fps refreshRate,
Fps renderRate) {
- ATRACE_CALL();
+ SFTRACE_CALL();
std::scoped_lock lock(mMutex);
mCurrentDisplayFrame->onSfWakeUp(token, refreshRate, renderRate,
mTokenManager.getPredictionsForToken(token), wakeUpTime);
@@ -927,7 +927,7 @@
void FrameTimeline::setSfPresent(nsecs_t sfPresentTime,
const std::shared_ptr<FenceTime>& presentFence,
const std::shared_ptr<FenceTime>& gpuFence) {
- ATRACE_CALL();
+ SFTRACE_CALL();
std::scoped_lock lock(mMutex);
mCurrentDisplayFrame->setActualEndTime(sfPresentTime);
mCurrentDisplayFrame->setGpuFence(gpuFence);
@@ -937,7 +937,7 @@
}
void FrameTimeline::onCommitNotComposited() {
- ATRACE_CALL();
+ SFTRACE_CALL();
std::scoped_lock lock(mMutex);
mCurrentDisplayFrame->onCommitNotComposited();
mCurrentDisplayFrame.reset();
@@ -1516,7 +1516,7 @@
}
void FrameTimeline::parseArgs(const Vector<String16>& args, std::string& result) {
- ATRACE_CALL();
+ SFTRACE_CALL();
std::unordered_map<std::string, bool> argsMap;
for (size_t i = 0; i < args.size(); i++) {
argsMap[std::string(String8(args[i]).c_str())] = true;