Add tracepoints to dumpstate_board sections
This change adds per-section tracepoints to the Pixel 6 (and beyond) implementation of dumpstateBoard for the purpose of debugging possibly-long sections. This change is analagous to the previous gs101/gs201 tracepoint additions at ag/20414147 and ag/20413969. Test: Build+flash; verify that a trace of a bug report contains dumpstate board sections. Bug: 277296452 Change-Id: I6bdd040321e87b9b6e104c18198aa650d8e5ad42
This commit is contained in:
parent
aa08e44399
commit
9df2606139
1 changed files with 6 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOG_TAG "dumpstate_device"
|
#define LOG_TAG "dumpstate_device"
|
||||||
|
#define ATRACE_TAG ATRACE_TAG_ALWAYS
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
#include <android-base/unique_fd.h>
|
#include <android-base/unique_fd.h>
|
||||||
|
#include <cutils/trace.h>
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dump/pixel_dump.h>
|
#include <dump/pixel_dump.h>
|
||||||
|
@ -46,6 +48,7 @@ typedef std::chrono::time_point<std::chrono::steady_clock> timepoint_t;
|
||||||
const char kVerboseLoggingProperty[] = "persist.vendor.verbose_logging_enabled";
|
const char kVerboseLoggingProperty[] = "persist.vendor.verbose_logging_enabled";
|
||||||
|
|
||||||
timepoint_t startSection(int fd, const std::string §ionName) {
|
timepoint_t startSection(int fd, const std::string §ionName) {
|
||||||
|
ATRACE_BEGIN(sectionName.c_str());
|
||||||
::android::base::WriteStringToFd(
|
::android::base::WriteStringToFd(
|
||||||
"\n"
|
"\n"
|
||||||
"------ Section start: " + sectionName + " ------\n"
|
"------ Section start: " + sectionName + " ------\n"
|
||||||
|
@ -54,6 +57,7 @@ timepoint_t startSection(int fd, const std::string §ionName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void endSection(int fd, const std::string §ionName, timepoint_t startTime) {
|
void endSection(int fd, const std::string §ionName, timepoint_t startTime) {
|
||||||
|
ATRACE_END();
|
||||||
auto endTime = std::chrono::steady_clock::now();
|
auto endTime = std::chrono::steady_clock::now();
|
||||||
auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds>
|
auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds>
|
||||||
(endTime - startTime).count();
|
(endTime - startTime).count();
|
||||||
|
@ -152,6 +156,7 @@ void Dumpstate::dumpLogSection(int fd, int fd_bin)
|
||||||
ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
|
ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
|
||||||
IDumpstateDevice::DumpstateMode in_mode,
|
IDumpstateDevice::DumpstateMode in_mode,
|
||||||
int64_t in_timeoutMillis) {
|
int64_t in_timeoutMillis) {
|
||||||
|
ATRACE_BEGIN("dumpstateBoard");
|
||||||
// Unused arguments.
|
// Unused arguments.
|
||||||
(void) in_timeoutMillis;
|
(void) in_timeoutMillis;
|
||||||
|
|
||||||
|
@ -181,6 +186,7 @@ ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFile
|
||||||
dumpLogSection(fd, fd_bin);
|
dumpLogSection(fd, fd_bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ATRACE_END();
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue