Attach the latest .cpa file to bugreports (gs201).

* Latest is determined by alphabetical order
* To find the .cpa file, unzip the bug report and run
  `tar -xvf dumpstate_board.bin`
* The .cpa file can then be found under the `camera/` directory
* This can be disabled with the prop
  `vendor.camera.debug.camera_performance_analyzer.attach_to_bugreport`

Bug: 191169822
Test: m -j
Change-Id: Iee7fbe45dfd5bbd67af0e5ebd965884b84e531ff
This commit is contained in:
Michael Eastwood 2021-08-16 13:28:38 -07:00
parent 5710123448
commit bdd18706de
2 changed files with 18 additions and 3 deletions

View file

@ -199,6 +199,17 @@ void DumpstateDevice::dumpGpsLogs(int fd, std::string destDir) {
dumpLogs(fd, gpsLogDir, destDir, maxFileNum, GPS_LOG_PREFIX); dumpLogs(fd, gpsLogDir, destDir, maxFileNum, GPS_LOG_PREFIX);
} }
void DumpstateDevice::dumpCameraLogs(int fd, const std::string &destDir) {
static const std::string kCameraLogDir = "/data/vendor/camera/profiler";
const std::string cameraDestDir = destDir + "/camera";
RunCommandToFd(fd, "MKDIR CAMERA LOG", {"/vendor/bin/mkdir", "-p", cameraDestDir.c_str()},
CommandOptions::WithTimeout(2).Build());
// Attach multiple latest sessions (in case the user is running concurrent
// sessions or starts a new session after the one with performance issues).
dumpLogs(fd, kCameraLogDir, cameraDestDir, 10, "session-ended-");
dumpLogs(fd, kCameraLogDir, cameraDestDir, 5, "high-drop-rate-");
}
timepoint_t startSection(int fd, const std::string &sectionName) { timepoint_t startSection(int fd, const std::string &sectionName) {
android::base::WriteStringToFd( android::base::WriteStringToFd(
"\n" "\n"
@ -877,6 +888,8 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
bool modemLogEnabled = android::base::GetBoolProperty(MODEM_LOGGING_PERSIST_PROPERTY, false); bool modemLogEnabled = android::base::GetBoolProperty(MODEM_LOGGING_PERSIST_PROPERTY, false);
bool gpsLogEnabled = android::base::GetBoolProperty(GPS_LOGGING_STATUS_PROPERTY, false); bool gpsLogEnabled = android::base::GetBoolProperty(GPS_LOGGING_STATUS_PROPERTY, false);
bool tcpdumpEnabled = android::base::GetBoolProperty(TCPDUMP_PERSIST_PROPERTY, false); bool tcpdumpEnabled = android::base::GetBoolProperty(TCPDUMP_PERSIST_PROPERTY, false);
bool cameraLogsEnabled = android::base::GetBoolProperty(
"vendor.camera.debug.camera_performance_analyzer.attach_to_bugreport", true);
int maxFileNum = android::base::GetIntProperty(MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY, 100); int maxFileNum = android::base::GetIntProperty(MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY, 100);
if (tcpdumpEnabled) { if (tcpdumpEnabled) {
@ -916,6 +929,10 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
ALOGD("gps logging is not running\n"); ALOGD("gps logging is not running\n");
} }
if (cameraLogsEnabled) {
dumpCameraLogs(STDOUT_FILENO, modemLogAllDir);
}
dumpLogs(fd, extendedLogDir, modemLogAllDir, maxFileNum, EXTENDED_LOG_PREFIX); dumpLogs(fd, extendedLogDir, modemLogAllDir, maxFileNum, EXTENDED_LOG_PREFIX);
dumpRilLogs(fd, modemLogAllDir); dumpRilLogs(fd, modemLogAllDir);
dumpNetmgrLogs(modemLogAllDir); dumpNetmgrLogs(modemLogAllDir);

View file

@ -30,13 +30,10 @@ namespace implementation {
using ::android::hardware::dumpstate::V1_1::DumpstateMode; using ::android::hardware::dumpstate::V1_1::DumpstateMode;
using ::android::hardware::dumpstate::V1_1::DumpstateStatus; using ::android::hardware::dumpstate::V1_1::DumpstateStatus;
using ::android::hardware::dumpstate::V1_1::IDumpstateDevice; using ::android::hardware::dumpstate::V1_1::IDumpstateDevice;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_handle; using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string; using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec; using ::android::hardware::hidl_vec;
using ::android::hardware::Return; using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
struct DumpstateDevice : public IDumpstateDevice { struct DumpstateDevice : public IDumpstateDevice {
public: public:
@ -88,6 +85,7 @@ struct DumpstateDevice : public IDumpstateDevice {
void dumpModem(int fd, int fdModem); void dumpModem(int fd, int fdModem);
void dumpRilLogs(int fd, std::string destDir); void dumpRilLogs(int fd, std::string destDir);
void dumpGpsLogs(int fd, std::string destDir); void dumpGpsLogs(int fd, std::string destDir);
void dumpCameraLogs(int fd, const std::string &destDir);
}; };
} // namespace implementation } // namespace implementation