Add tracepoints to gs101 dumpstateBoard
This change adds tracepoints for the gs101 implementation of dumpstateBoard. This is intended to help identify long-running sections. Test: Build+flash, check that traces of 'adb bugreportz' show the expected trace sections. Bug: 258228821 Change-Id: I8efea28278b4507a7e2a448c96281113331cbd02
This commit is contained in:
parent
1041499cb9
commit
9257a5f2dc
1 changed files with 8 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 <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -215,6 +217,7 @@ void dumpCameraLogs(int fd, const std::string &destDir) {
|
||||||
}
|
}
|
||||||
|
|
||||||
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"
|
||||||
|
@ -223,6 +226,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();
|
||||||
|
@ -946,6 +950,7 @@ void Dumpstate::dumpCameraSection(int fd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *dumpModemThread(void *data) {
|
static void *dumpModemThread(void *data) {
|
||||||
|
ATRACE_ASYNC_BEGIN("dumpModemThread", 0);
|
||||||
std::string modemLogDir = MODEM_LOG_DIRECTORY;
|
std::string modemLogDir = MODEM_LOG_DIRECTORY;
|
||||||
std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY;
|
std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY;
|
||||||
std::string tcpdumpLogDir = TCPDUMP_LOG_DIRECTORY;
|
std::string tcpdumpLogDir = TCPDUMP_LOG_DIRECTORY;
|
||||||
|
@ -1051,12 +1056,14 @@ static void *dumpModemThread(void *data) {
|
||||||
|
|
||||||
ALOGD("dumpModemThread finished\n");
|
ALOGD("dumpModemThread finished\n");
|
||||||
|
|
||||||
|
ATRACE_ASYNC_END("dumpModemThread", 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -1103,6 +1110,7 @@ ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFile
|
||||||
pthread_join(modemThreadHandle, NULL);
|
pthread_join(modemThreadHandle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ATRACE_END();
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue