Loading cmds/statsd/.clang-format 0 → 100644 +14 −0 Original line number Diff line number Diff line BasedOnStyle: Google AllowShortIfStatementsOnASingleLine: true AllowShortFunctionsOnASingleLine: false AllowShortLoopsOnASingleLine: true BinPackArguments: true BinPackParameters: true ColumnLimit: 100 CommentPragmas: NOLINT:.* ContinuationIndentWidth: 8 DerivePointerAlignment: false IndentWidth: 4 PointerAlignment: Left TabWidth: 4 AccessModifierOffset: -4 cmds/statsd/src/AnomalyMonitor.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -26,8 +26,7 @@ namespace os { namespace statsd { AnomalyMonitor::AnomalyMonitor(uint32_t minDiffToUpdateRegisteredAlarmTimeSec) : mRegisteredAlarmTimeSec(0), mMinUpdateTimeSec(minDiffToUpdateRegisteredAlarmTimeSec) { : mRegisteredAlarmTimeSec(0), mMinUpdateTimeSec(minDiffToUpdateRegisteredAlarmTimeSec) { } AnomalyMonitor::~AnomalyMonitor() { Loading cmds/statsd/src/AnomalyMonitor.h +7 −7 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ #ifndef ANOMALY_MONITOR_H #define ANOMALY_MONITOR_H #include <indexed_priority_queue.h> #include <android/os/IStatsCompanionService.h> #include <indexed_priority_queue.h> #include <utils/RefBase.h> #include <queue> Loading cmds/statsd/src/DropboxReader.cpp +13 −15 Original line number Diff line number Diff line Loading @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #include <android/os/DropBoxManager.h> #include <android-base/file.h> #include <android/os/DropBoxManager.h> #include <androidfw/ZipUtils.h> #include "DropboxReader.h" using android::sp; using android::String16; using android::binder::Status; using android::ZipUtils; using android::base::unique_fd; using android::binder::Status; using android::os::DropBoxManager; using android::ZipUtils; using android::sp; using std::vector; namespace android { Loading @@ -39,8 +39,7 @@ status_t DropboxReader::readStatsLogs(FILE* out, const string& tag, long msec) { // instead of while(true), put a hard limit 1000. Dropbox won't have more than 1000 files. for (int i = 0; i < 1000; i++) { DropBoxManager::Entry entry; Status status = dropbox->getNextEntry(String16(tag.c_str()), timestamp, &entry); Status status = dropbox->getNextEntry(String16(tag.c_str()), timestamp, &entry); if (!status.isOk()) { ALOGD("No more entries, or failed to read. We can't tell unfortunately."); return android::OK; Loading Loading @@ -76,8 +75,7 @@ bool DropboxReader::parseFromGzipFile(const unique_fd& fd, StatsLogReport& logRe long compressedLen; long uncompressedLen; unsigned long crc32; scanResult = ZipUtils::examineGzip(file, &method, &uncompressedLen, &compressedLen, &crc32); scanResult = ZipUtils::examineGzip(file, &method, &uncompressedLen, &compressedLen, &crc32); if (scanResult && method == kCompressDeflated) { vector<uint8_t> buf(uncompressedLen); if (ZipUtils::inflateToBuffer(file, &buf[0], uncompressedLen, compressedLen)) { Loading Loading @@ -107,8 +105,8 @@ bool DropboxReader::parseFromFile(const unique_fd& fd, StatsLogReport& logReport } void DropboxReader::printLog(FILE* out, const StatsLogReport& logReport) { fprintf(out, "start_time_msec=%lld, end_time_msec=%lld, ", logReport.start_report_millis(), logReport.end_report_millis()); fprintf(out, "start_time_msec=%lld, end_time_msec=%lld, ", logReport.start_report_millis(), logReport.end_report_millis()); for (int i = 0; i < logReport.event_metrics().data_size(); i++) { EventMetricData eventMetricData = logReport.event_metrics().data(i); for (int j = 0; j < eventMetricData.key_value_pair_size(); j++) { Loading cmds/statsd/src/DropboxWriter.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -18,18 +18,17 @@ #include "DropboxWriter.h" using android::String16; using android::binder::Status; using android::os::DropBoxManager; using android::sp; using android::String16; using std::vector; namespace android { namespace os { namespace statsd { DropboxWriter::DropboxWriter(const string& tag) : mTag(tag), mLogReport(), mBufferSize(0) { DropboxWriter::DropboxWriter(const string& tag) : mTag(tag), mLogReport(), mBufferSize(0) { } void DropboxWriter::addStatsLogReport(const StatsLogReport& log) { Loading @@ -52,8 +51,7 @@ void DropboxWriter::flush() { vector<uint8_t> buffer(numBytes); sp<DropBoxManager> dropbox = new DropBoxManager(); mLogReport.SerializeToArray(&buffer[0], numBytes); Status status = dropbox->addData(String16(mTag.c_str()), &buffer[0], numBytes, 0 /* no flag */); Status status = dropbox->addData(String16(mTag.c_str()), &buffer[0], numBytes, 0 /* no flag */); if (!status.isOk()) { ALOGE("failed to write to dropbox"); // TODO: What to do if flush fails?? Loading Loading
cmds/statsd/.clang-format 0 → 100644 +14 −0 Original line number Diff line number Diff line BasedOnStyle: Google AllowShortIfStatementsOnASingleLine: true AllowShortFunctionsOnASingleLine: false AllowShortLoopsOnASingleLine: true BinPackArguments: true BinPackParameters: true ColumnLimit: 100 CommentPragmas: NOLINT:.* ContinuationIndentWidth: 8 DerivePointerAlignment: false IndentWidth: 4 PointerAlignment: Left TabWidth: 4 AccessModifierOffset: -4
cmds/statsd/src/AnomalyMonitor.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -26,8 +26,7 @@ namespace os { namespace statsd { AnomalyMonitor::AnomalyMonitor(uint32_t minDiffToUpdateRegisteredAlarmTimeSec) : mRegisteredAlarmTimeSec(0), mMinUpdateTimeSec(minDiffToUpdateRegisteredAlarmTimeSec) { : mRegisteredAlarmTimeSec(0), mMinUpdateTimeSec(minDiffToUpdateRegisteredAlarmTimeSec) { } AnomalyMonitor::~AnomalyMonitor() { Loading
cmds/statsd/src/AnomalyMonitor.h +7 −7 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ #ifndef ANOMALY_MONITOR_H #define ANOMALY_MONITOR_H #include <indexed_priority_queue.h> #include <android/os/IStatsCompanionService.h> #include <indexed_priority_queue.h> #include <utils/RefBase.h> #include <queue> Loading
cmds/statsd/src/DropboxReader.cpp +13 −15 Original line number Diff line number Diff line Loading @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #include <android/os/DropBoxManager.h> #include <android-base/file.h> #include <android/os/DropBoxManager.h> #include <androidfw/ZipUtils.h> #include "DropboxReader.h" using android::sp; using android::String16; using android::binder::Status; using android::ZipUtils; using android::base::unique_fd; using android::binder::Status; using android::os::DropBoxManager; using android::ZipUtils; using android::sp; using std::vector; namespace android { Loading @@ -39,8 +39,7 @@ status_t DropboxReader::readStatsLogs(FILE* out, const string& tag, long msec) { // instead of while(true), put a hard limit 1000. Dropbox won't have more than 1000 files. for (int i = 0; i < 1000; i++) { DropBoxManager::Entry entry; Status status = dropbox->getNextEntry(String16(tag.c_str()), timestamp, &entry); Status status = dropbox->getNextEntry(String16(tag.c_str()), timestamp, &entry); if (!status.isOk()) { ALOGD("No more entries, or failed to read. We can't tell unfortunately."); return android::OK; Loading Loading @@ -76,8 +75,7 @@ bool DropboxReader::parseFromGzipFile(const unique_fd& fd, StatsLogReport& logRe long compressedLen; long uncompressedLen; unsigned long crc32; scanResult = ZipUtils::examineGzip(file, &method, &uncompressedLen, &compressedLen, &crc32); scanResult = ZipUtils::examineGzip(file, &method, &uncompressedLen, &compressedLen, &crc32); if (scanResult && method == kCompressDeflated) { vector<uint8_t> buf(uncompressedLen); if (ZipUtils::inflateToBuffer(file, &buf[0], uncompressedLen, compressedLen)) { Loading Loading @@ -107,8 +105,8 @@ bool DropboxReader::parseFromFile(const unique_fd& fd, StatsLogReport& logReport } void DropboxReader::printLog(FILE* out, const StatsLogReport& logReport) { fprintf(out, "start_time_msec=%lld, end_time_msec=%lld, ", logReport.start_report_millis(), logReport.end_report_millis()); fprintf(out, "start_time_msec=%lld, end_time_msec=%lld, ", logReport.start_report_millis(), logReport.end_report_millis()); for (int i = 0; i < logReport.event_metrics().data_size(); i++) { EventMetricData eventMetricData = logReport.event_metrics().data(i); for (int j = 0; j < eventMetricData.key_value_pair_size(); j++) { Loading
cmds/statsd/src/DropboxWriter.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -18,18 +18,17 @@ #include "DropboxWriter.h" using android::String16; using android::binder::Status; using android::os::DropBoxManager; using android::sp; using android::String16; using std::vector; namespace android { namespace os { namespace statsd { DropboxWriter::DropboxWriter(const string& tag) : mTag(tag), mLogReport(), mBufferSize(0) { DropboxWriter::DropboxWriter(const string& tag) : mTag(tag), mLogReport(), mBufferSize(0) { } void DropboxWriter::addStatsLogReport(const StatsLogReport& log) { Loading @@ -52,8 +51,7 @@ void DropboxWriter::flush() { vector<uint8_t> buffer(numBytes); sp<DropBoxManager> dropbox = new DropBoxManager(); mLogReport.SerializeToArray(&buffer[0], numBytes); Status status = dropbox->addData(String16(mTag.c_str()), &buffer[0], numBytes, 0 /* no flag */); Status status = dropbox->addData(String16(mTag.c_str()), &buffer[0], numBytes, 0 /* no flag */); if (!status.isOk()) { ALOGE("failed to write to dropbox"); // TODO: What to do if flush fails?? Loading