From 1f14e9f4747ddcf8820c81eedff5e592683e8ce0 Mon Sep 17 00:00:00 2001 From: Kodi Obika Date: Tue, 6 Aug 2019 10:27:09 -0700 Subject: [PATCH] Added trace event to screenrecord Bug: 135278534 Test: Run Perfetto with "screen recording" enabled and execute a query for the "first_frame" slice Exempt-From-Owner-Approval: cherry-pick (cherry-picked from commit c840c0bfee6aa9be4e05e957e8d1ee8d9e330f75) Merged-In: I20abf7300e8c46b6e6dc52096db699e95c93297d Change-Id: I20abf7300e8c46b6e6dc52096db699e95c93297d --- cmds/screenrecord/screenrecord.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp index b73951faf6..9cfbbf9a8b 100644 --- a/cmds/screenrecord/screenrecord.cpp +++ b/cmds/screenrecord/screenrecord.cpp @@ -378,6 +378,7 @@ static status_t runEncoder(const sp& encoder, int64_t startWhenNsec = systemTime(CLOCK_MONOTONIC); int64_t endWhenNsec = startWhenNsec + seconds_to_nanoseconds(gTimeLimitSec); DisplayInfo mainDpyInfo; + bool firstFrame = true; assert((rawFp == NULL && muxer != NULL) || (rawFp != NULL && muxer == NULL)); @@ -394,6 +395,11 @@ static status_t runEncoder(const sp& encoder, int64_t ptsUsec; uint32_t flags; + if (firstFrame) { + ATRACE_NAME("first_frame"); + firstFrame = false; + } + if (systemTime(CLOCK_MONOTONIC) > endWhenNsec) { if (gVerbose) { printf("Time limit reached\n");