From 15c4e31b0f7226987267656926c98d2c5d53585a Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Mon, 2 May 2016 21:42:49 -0700 Subject: [PATCH] Change low power stats format to make it easier for parsing New format: PlatformIdleStat state_1 name=XO_shutdown time=0 count=0 voter_1 name=APSS time=48264099 count=484 voter_2 name=MPSS time=48573849 count=39857 voter_3 name=LPASS time=49584723 count=2082 state_2 name=VMIN time=47171000 count=38222 Old format: PlatformIdleStat XO_shutdown_time=0 XO_shutdown_count=0 APSS_time=9467486 APSS_count=583 MPSS_time=10835070 MPSS_count=9131 LPASS_time=10624719 LPASS_count=595 VMIN_time=9231000 VMIN_count=7878 In the old format it was hard to differentiate between the various low power states and the voters for each state. Bug:26564574 Change-Id: I3930aaf1c8c6e17066ef043552096ba61373f9f4 --- .../jni/com_android_server_am_BatteryStatsService.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/core/jni/com_android_server_am_BatteryStatsService.cpp b/services/core/jni/com_android_server_am_BatteryStatsService.cpp index 183a370bac0d7..ecdc71e612702 100644 --- a/services/core/jni/com_android_server_am_BatteryStatsService.cpp +++ b/services/core/jni/com_android_server_am_BatteryStatsService.cpp @@ -234,8 +234,9 @@ static jint getPlatformLowPowerStats(JNIEnv* env, jobject /* clazz */, jobject o for (int i = 0; i < num_modes; i++) { int added; - added = snprintf(offset, remaining, "%s_time=%" PRIu64 " %s_count=%" PRIu64 " ", - list[i].name, list[i].residency_in_msec_since_boot, list[i].name, + added = snprintf(offset, remaining, + "state_%d name=%s time=%" PRIu64 " count=%" PRIu64 " ", + i + 1, list[i].name, list[i].residency_in_msec_since_boot, list[i].total_transitions); if (added < 0) { break; @@ -248,10 +249,10 @@ static jint getPlatformLowPowerStats(JNIEnv* env, jobject /* clazz */, jobject o total_added += added; for (unsigned int j = 0; j < list[i].number_of_voters; j++) { - added = snprintf(offset, remaining, "%s_time=%" PRIu64 " %s_count=%" PRIu64 " ", - list[i].voters[j].name, + added = snprintf(offset, remaining, + "voter_%d name=%s time=%" PRIu64 " count=%" PRIu64 " ", + j + 1, list[i].voters[j].name, list[i].voters[j].total_time_in_msec_voted_for_since_boot, - list[i].voters[j].name, list[i].voters[j].total_number_of_times_voted_since_boot); if (added < 0) { break;