Merge "Fix print-logs" into mainline-prod
This commit is contained in:
committed by
Android (Google) Code Review
commit
d4ae64b9ea
@@ -216,10 +216,6 @@ cc_binary {
|
|||||||
// address: true,
|
// address: true,
|
||||||
//},
|
//},
|
||||||
},
|
},
|
||||||
debuggable: {
|
|
||||||
// Add a flag to enable stats log printing from statsd on debug builds.
|
|
||||||
cflags: ["-DVERY_VERBOSE_PRINTING"],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
proto: {
|
proto: {
|
||||||
|
|||||||
@@ -409,11 +409,9 @@ void StatsLogProcessor::OnLogEvent(LogEvent* event, int64_t elapsedRealtimeNs) {
|
|||||||
onWatchdogRollbackOccurredLocked(event);
|
onWatchdogRollbackOccurredLocked(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VERY_VERBOSE_PRINTING
|
|
||||||
if (mPrintAllLogs) {
|
if (mPrintAllLogs) {
|
||||||
ALOGI("%s", event->ToString().c_str());
|
ALOGI("%s", event->ToString().c_str());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
resetIfConfigTtlExpiredLocked(eventElapsedTimeNs);
|
resetIfConfigTtlExpiredLocked(eventElapsedTimeNs);
|
||||||
|
|
||||||
// Hard-coded logic to update the isolated uid's in the uid-map.
|
// Hard-coded logic to update the isolated uid's in the uid-map.
|
||||||
|
|||||||
@@ -139,10 +139,8 @@ public:
|
|||||||
int64_t getLastReportTimeNs(const ConfigKey& key);
|
int64_t getLastReportTimeNs(const ConfigKey& key);
|
||||||
|
|
||||||
inline void setPrintLogs(bool enabled) {
|
inline void setPrintLogs(bool enabled) {
|
||||||
#ifdef VERY_VERBOSE_PRINTING
|
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
||||||
mPrintAllLogs = enabled;
|
mPrintAllLogs = enabled;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a specific config key to the possible configs to dump ASAP.
|
// Add a specific config key to the possible configs to dump ASAP.
|
||||||
@@ -276,9 +274,7 @@ private:
|
|||||||
//Last time we wrote metadata to disk.
|
//Last time we wrote metadata to disk.
|
||||||
int64_t mLastMetadataWriteNs = 0;
|
int64_t mLastMetadataWriteNs = 0;
|
||||||
|
|
||||||
#ifdef VERY_VERBOSE_PRINTING
|
|
||||||
bool mPrintAllLogs = false;
|
bool mPrintAllLogs = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
FRIEND_TEST(StatsLogProcessorTest, TestOutOfOrderLogs);
|
FRIEND_TEST(StatsLogProcessorTest, TestOutOfOrderLogs);
|
||||||
FRIEND_TEST(StatsLogProcessorTest, TestRateLimitByteSize);
|
FRIEND_TEST(StatsLogProcessorTest, TestRateLimitByteSize);
|
||||||
|
|||||||
@@ -484,7 +484,8 @@ void StatsService::print_cmd_help(int out) {
|
|||||||
dprintf(out, " Clear cached puller data.\n");
|
dprintf(out, " Clear cached puller data.\n");
|
||||||
dprintf(out, "\n");
|
dprintf(out, "\n");
|
||||||
dprintf(out, "usage: adb shell cmd stats print-logs\n");
|
dprintf(out, "usage: adb shell cmd stats print-logs\n");
|
||||||
dprintf(out, " Only works on eng build\n");
|
dprintf(out, " Requires root privileges.\n");
|
||||||
|
dprintf(out, " Can be disabled by calling adb shell cmd stats print-logs 0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t StatsService::cmd_trigger_broadcast(int out, Vector<String8>& args) {
|
status_t StatsService::cmd_trigger_broadcast(int out, Vector<String8>& args) {
|
||||||
@@ -865,18 +866,19 @@ status_t StatsService::cmd_clear_puller_cache(int out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t StatsService::cmd_print_logs(int out, const Vector<String8>& args) {
|
status_t StatsService::cmd_print_logs(int out, const Vector<String8>& args) {
|
||||||
VLOG("StatsService::cmd_print_logs with Pid %i, Uid %i", AIBinder_getCallingPid(),
|
Status status = checkUid(AID_ROOT);
|
||||||
|
if (!status.isOk()) {
|
||||||
|
return PERMISSION_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
VLOG("StatsService::cmd_print_logs with pid %i, uid %i", AIBinder_getCallingPid(),
|
||||||
AIBinder_getCallingUid());
|
AIBinder_getCallingUid());
|
||||||
if (checkPermission(kPermissionDump)) {
|
|
||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
if (args.size() >= 2) {
|
if (args.size() >= 2) {
|
||||||
enabled = atoi(args[1].c_str()) != 0;
|
enabled = atoi(args[1].c_str()) != 0;
|
||||||
}
|
}
|
||||||
mProcessor->setPrintLogs(enabled);
|
mProcessor->setPrintLogs(enabled);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} else {
|
|
||||||
return PERMISSION_DENIED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatsService::getUidFromArgs(const Vector<String8>& args, size_t uidArgIndex, int32_t& uid) {
|
bool StatsService::getUidFromArgs(const Vector<String8>& args, size_t uidArgIndex, int32_t& uid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user