Add tracepoints to dumpstate_board sections am: 9df2606139

Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs-common/+/22553206

Change-Id: I1ebccc2cde9a322450eb4a5dacfa2927791c8871
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/gear/dumpstate/Dumpstate.cpp b/gear/dumpstate/Dumpstate.cpp
index 8abc237..9fe7c1a 100644
--- a/gear/dumpstate/Dumpstate.cpp
+++ b/gear/dumpstate/Dumpstate.cpp
@@ -15,6 +15,7 @@
  */
 
 #define LOG_TAG "dumpstate_device"
+#define ATRACE_TAG ATRACE_TAG_ALWAYS
 
 #include <inttypes.h>
 
@@ -22,6 +23,7 @@
 #include <android-base/stringprintf.h>
 #include <android-base/properties.h>
 #include <android-base/unique_fd.h>
+#include <cutils/trace.h>
 #include <log/log.h>
 #include <sys/stat.h>
 #include <dump/pixel_dump.h>
@@ -46,6 +48,7 @@
 const char kVerboseLoggingProperty[] = "persist.vendor.verbose_logging_enabled";
 
 timepoint_t startSection(int fd, const std::string &sectionName) {
+    ATRACE_BEGIN(sectionName.c_str());
     ::android::base::WriteStringToFd(
             "\n"
             "------ Section start: " + sectionName + " ------\n"
@@ -54,6 +57,7 @@
 }
 
 void endSection(int fd, const std::string &sectionName, timepoint_t startTime) {
+    ATRACE_END();
     auto endTime = std::chrono::steady_clock::now();
     auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds>
             (endTime - startTime).count();
@@ -152,6 +156,7 @@
 ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
                                              IDumpstateDevice::DumpstateMode in_mode,
                                              int64_t in_timeoutMillis) {
+    ATRACE_BEGIN("dumpstateBoard");
     // Unused arguments.
     (void) in_timeoutMillis;
 
@@ -181,6 +186,7 @@
           dumpLogSection(fd, fd_bin);
     }
 
+    ATRACE_END();
     return ndk::ScopedAStatus::ok();
 }