summaryrefslogtreecommitdiff
path: root/libs/gui/DisplayEventDispatcher.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2024-06-14 13:41:12 -0700
committer Ady Abraham <adyabr@google.com> 2024-06-14 20:45:45 +0000
commit1d0cae97cd67a455563a92f1f11086dd1f030877 (patch)
treee49fc1a36c79189a36a0a1180a152cf8aa8d1600 /libs/gui/DisplayEventDispatcher.cpp
parent8c9cd3c537f7d4781862e2d95b32247fa5bb3d66 (diff)
SF: trace the render rate of an app
Add a trace point for both SF and apps when the render rate is overridden. Bug: 347314033 Test: manual Change-Id: I87dc9b17a4c1f97fa43b025cfa684f43c20c5a25
Diffstat (limited to 'libs/gui/DisplayEventDispatcher.cpp')
-rw-r--r--libs/gui/DisplayEventDispatcher.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/gui/DisplayEventDispatcher.cpp b/libs/gui/DisplayEventDispatcher.cpp
index f3de96d2cd..c46f9c50ef 100644
--- a/libs/gui/DisplayEventDispatcher.cpp
+++ b/libs/gui/DisplayEventDispatcher.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "DisplayEventDispatcher"
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#include <cinttypes>
#include <cstdint>
@@ -23,10 +24,13 @@
#include <gui/DisplayEventReceiver.h>
#include <utils/Log.h>
#include <utils/Looper.h>
-
#include <utils/Timers.h>
+#include <utils/Trace.h>
+
+#include <com_android_graphics_libgui_flags.h>
namespace android {
+using namespace com::android::graphics::libgui;
// Number of events to read at a time from the DisplayEventDispatcher pipe.
// The value should be large enough that we can quickly drain the pipe
@@ -171,6 +175,13 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
*outDisplayId = ev.header.displayId;
*outCount = ev.vsync.count;
*outVsyncEventData = ev.vsync.vsyncData;
+
+ // Trace the RenderRate for this app
+ if (ATRACE_ENABLED() && flags::trace_frame_rate_override()) {
+ const auto frameInterval = ev.vsync.vsyncData.frameInterval;
+ int fps = frameInterval > 0 ? 1e9f / frameInterval : 0;
+ ATRACE_INT("RenderRate", fps);
+ }
break;
case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
if (ev.hotplug.connectionError == 0) {