Loading cmds/statsd/src/StatsLogProcessor.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ void StatsLogProcessor::flushIfNecessaryLocked( StatsdStats::kMaxMetricsBytesPerConfig) { // Too late. We need to start clearing data. // TODO(b/70571383): By 12/15/2017 add API to drop data directly ProtoOutputStream proto; metricsManager.onDumpReport(time(nullptr) * NS_PER_SEC, &proto); metricsManager.onDumpReport(timestampNs, &proto); StatsdStats::getInstance().noteDataDropped(key); VLOG("StatsD had to toss out metrics for %s", key.ToString().c_str()); } else if (totalBytes > .9 * StatsdStats::kMaxMetricsBytesPerConfig) { Loading @@ -340,7 +340,7 @@ void StatsLogProcessor::WriteDataToDisk() { for (auto& pair : mMetricsManagers) { const ConfigKey& key = pair.first; vector<uint8_t> data; onDumpReportLocked(key, time(nullptr) * NS_PER_SEC, &data); onDumpReportLocked(key, getElapsedRealtimeNs(), &data); // TODO: Add a guardrail to prevent accumulation of file on disk. string file_name = StringPrintf("%s/%ld_%d_%lld", STATS_DATA_DIR, (long)getWallClockSec(), key.GetUid(), (long long)key.GetId()); Loading cmds/statsd/src/StatsService.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -493,7 +493,7 @@ status_t StatsService::cmd_dump_report(FILE* out, FILE* err, const Vector<String } if (good) { vector<uint8_t> data; mProcessor->onDumpReport(ConfigKey(uid, StrToInt64(name)), time(nullptr) * NS_PER_SEC, mProcessor->onDumpReport(ConfigKey(uid, StrToInt64(name)), getElapsedRealtimeNs(), &data); // TODO: print the returned StatsLogReport to file instead of printing to logcat. if (proto) { Loading Loading @@ -786,7 +786,7 @@ Status StatsService::getData(int64_t key, vector<uint8_t>* output) { VLOG("StatsService::getData with Pid %i, Uid %i", ipc->getCallingPid(), ipc->getCallingUid()); if (checkCallingPermission(String16(kPermissionDump))) { ConfigKey configKey(ipc->getCallingUid(), key); mProcessor->onDumpReport(configKey, time(nullptr) * NS_PER_SEC, output); mProcessor->onDumpReport(configKey, getElapsedRealtimeNs(), output); return Status::ok(); } else { return Status::fromExceptionCode(binder::Status::EX_SECURITY); Loading Loading
cmds/statsd/src/StatsLogProcessor.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ void StatsLogProcessor::flushIfNecessaryLocked( StatsdStats::kMaxMetricsBytesPerConfig) { // Too late. We need to start clearing data. // TODO(b/70571383): By 12/15/2017 add API to drop data directly ProtoOutputStream proto; metricsManager.onDumpReport(time(nullptr) * NS_PER_SEC, &proto); metricsManager.onDumpReport(timestampNs, &proto); StatsdStats::getInstance().noteDataDropped(key); VLOG("StatsD had to toss out metrics for %s", key.ToString().c_str()); } else if (totalBytes > .9 * StatsdStats::kMaxMetricsBytesPerConfig) { Loading @@ -340,7 +340,7 @@ void StatsLogProcessor::WriteDataToDisk() { for (auto& pair : mMetricsManagers) { const ConfigKey& key = pair.first; vector<uint8_t> data; onDumpReportLocked(key, time(nullptr) * NS_PER_SEC, &data); onDumpReportLocked(key, getElapsedRealtimeNs(), &data); // TODO: Add a guardrail to prevent accumulation of file on disk. string file_name = StringPrintf("%s/%ld_%d_%lld", STATS_DATA_DIR, (long)getWallClockSec(), key.GetUid(), (long long)key.GetId()); Loading
cmds/statsd/src/StatsService.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -493,7 +493,7 @@ status_t StatsService::cmd_dump_report(FILE* out, FILE* err, const Vector<String } if (good) { vector<uint8_t> data; mProcessor->onDumpReport(ConfigKey(uid, StrToInt64(name)), time(nullptr) * NS_PER_SEC, mProcessor->onDumpReport(ConfigKey(uid, StrToInt64(name)), getElapsedRealtimeNs(), &data); // TODO: print the returned StatsLogReport to file instead of printing to logcat. if (proto) { Loading Loading @@ -786,7 +786,7 @@ Status StatsService::getData(int64_t key, vector<uint8_t>* output) { VLOG("StatsService::getData with Pid %i, Uid %i", ipc->getCallingPid(), ipc->getCallingUid()); if (checkCallingPermission(String16(kPermissionDump))) { ConfigKey configKey(ipc->getCallingUid(), key); mProcessor->onDumpReport(configKey, time(nullptr) * NS_PER_SEC, output); mProcessor->onDumpReport(configKey, getElapsedRealtimeNs(), output); return Status::ok(); } else { return Status::fromExceptionCode(binder::Status::EX_SECURITY); Loading