Loading cmds/statsd/src/StatsLogProcessor.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ void StatsLogProcessor::onDumpReport(const ConfigKey& key, const int64_t dumpTim // Then, check stats-data directory to see there's any file containing // ConfigMetricsReport from previous shutdowns to concatenate to reports. StorageManager::appendConfigMetricsReport(key, proto); StorageManager::appendConfigMetricsReport(key, proto, erase_data); auto it = mMetricsManagers.find(key); if (it != mMetricsManagers.end()) { Loading cmds/statsd/src/StatsService.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,7 @@ void StatsService::dumpIncidentSection(int out) { ADB_DUMP, &proto); proto.end(reportsListToken); proto.flush(out); proto.clear(); } } Loading cmds/statsd/src/storage/StorageManager.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -188,7 +188,9 @@ bool StorageManager::hasConfigMetricsReport(const ConfigKey& key) { return false; } void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto) { void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto, bool erasa_data) { unique_ptr<DIR, decltype(&closedir)> dir(opendir(STATS_DATA_DIR), closedir); if (dir == NULL) { VLOG("Path %s does not exist", STATS_DATA_DIR); Loading Loading @@ -224,11 +226,12 @@ void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutput close(fd); } // Remove file from disk after reading. if (erasa_data) { remove(file_name.c_str()); } } } } bool StorageManager::readFileToString(const char* file, string* content) { int fd = open(file, O_RDONLY | O_CLOEXEC); Loading cmds/statsd/src/storage/StorageManager.h +5 −3 Original line number Diff line number Diff line Loading @@ -68,10 +68,12 @@ public: static bool hasConfigMetricsReport(const ConfigKey& key); /** * Appends ConfigMetricsReport found on disk to the specific proto and * delete it. * Appends the ConfigMetricsReport found on disk to the specifid proto * and, if erase_data, deletes it from disk. */ static void appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto); static void appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto, bool erase_data); /** * Call to load the saved configs from disk. Loading Loading
cmds/statsd/src/StatsLogProcessor.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ void StatsLogProcessor::onDumpReport(const ConfigKey& key, const int64_t dumpTim // Then, check stats-data directory to see there's any file containing // ConfigMetricsReport from previous shutdowns to concatenate to reports. StorageManager::appendConfigMetricsReport(key, proto); StorageManager::appendConfigMetricsReport(key, proto, erase_data); auto it = mMetricsManagers.find(key); if (it != mMetricsManagers.end()) { Loading
cmds/statsd/src/StatsService.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,7 @@ void StatsService::dumpIncidentSection(int out) { ADB_DUMP, &proto); proto.end(reportsListToken); proto.flush(out); proto.clear(); } } Loading
cmds/statsd/src/storage/StorageManager.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -188,7 +188,9 @@ bool StorageManager::hasConfigMetricsReport(const ConfigKey& key) { return false; } void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto) { void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto, bool erasa_data) { unique_ptr<DIR, decltype(&closedir)> dir(opendir(STATS_DATA_DIR), closedir); if (dir == NULL) { VLOG("Path %s does not exist", STATS_DATA_DIR); Loading Loading @@ -224,11 +226,12 @@ void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutput close(fd); } // Remove file from disk after reading. if (erasa_data) { remove(file_name.c_str()); } } } } bool StorageManager::readFileToString(const char* file, string* content) { int fd = open(file, O_RDONLY | O_CLOEXEC); Loading
cmds/statsd/src/storage/StorageManager.h +5 −3 Original line number Diff line number Diff line Loading @@ -68,10 +68,12 @@ public: static bool hasConfigMetricsReport(const ConfigKey& key); /** * Appends ConfigMetricsReport found on disk to the specific proto and * delete it. * Appends the ConfigMetricsReport found on disk to the specifid proto * and, if erase_data, deletes it from disk. */ static void appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto); static void appendConfigMetricsReport(const ConfigKey& key, ProtoOutputStream* proto, bool erase_data); /** * Call to load the saved configs from disk. Loading