diff options
author | Christian Sonntag <cxs@dhcp-172-31-153-155.sfo.corp.google.com> | 2009-08-13 11:51:13 -0700 |
---|---|---|
committer | Christian Sonntag <cxs@google.com> | 2009-08-13 12:02:14 -0700 |
commit | 6639bb65c5ebb9493afba6d701a22223ac45ba04 (patch) | |
tree | 9fd41cb21c1f417d445063da97b2ed36494aa0a9 /services | |
parent | 0867e69176858e258b620a1b3acff2363c95b87d (diff) | |
download | frameworks_base-6639bb65c5ebb9493afba6d701a22223ac45ba04.zip frameworks_base-6639bb65c5ebb9493afba6d701a22223ac45ba04.tar.gz frameworks_base-6639bb65c5ebb9493afba6d701a22223ac45ba04.tar.bz2 |
Add a more compact representation of usage stats.
We are replaceing the package name in the activity name with a * iff the activity is in the
same package, otherwise the activity name is pritned out in full.
This small change will remove a lot of bytes (in the order of kilobytes for a real log) from the logged data on the network and downstream processing,
since the package name is repeated in almost all cases.
An exampe of the new format is here:
DUMP OF SERVICE usagestats:
D:4,20090813
P:com.android.launcher,4,155456
A:*.Launcher,4,0,0,0,0,0,0,0,0,0,2
P:com.android.browser,1,6724
A:*.BrowserActivity,1,0,0,0,0,0,0,0,0,0,0
A:*.CombinedBookmarkHistoryActivity,1,0,0,0,0,0,0,0,0,0,1
P:com.google.android.apps.maps,1,2219
A:com.google.android.maps.MapsActivity,1,0,0,0,0,0,0,0,0,0,0
P:com.android.contacts,1,0
A:*.DialtactsActivity,1,0,0,0,0,0,0,0,0,0,1
Diffstat (limited to 'services')
-rw-r--r--[-rwxr-xr-x] | services/java/com/android/server/am/UsageStatsService.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/java/com/android/server/am/UsageStatsService.java b/services/java/com/android/server/am/UsageStatsService.java index d458911..66868a3 100755..100644 --- a/services/java/com/android/server/am/UsageStatsService.java +++ b/services/java/com/android/server/am/UsageStatsService.java @@ -695,7 +695,14 @@ public final class UsageStatsService extends IUsageStats.Stub { if (NC > 0) { for (Map.Entry<String, TimeStats> ent : pus.mLaunchTimes.entrySet()) { sb.append("A:"); - sb.append(ent.getKey()); + String activity = ent.getKey(); + if (activity.startsWith(pkgName)) { + sb.append('*'); + sb.append(activity.substring( + pkgName.length(), activity.length())); + } else { + sb.append(activity); + } TimeStats times = ent.getValue(); sb.append(','); sb.append(times.count); |