Update dumpsys output

After using the new format for a few days, I decided it's better to ahve the auth & acct
info on every row because we will sometimes grep the data and won't see it if the auth/acct
is ommited.

Also added the "time since last sync" to every row. This is also very useful.

Detailed Statistics (Recent history):  31 (# of times) 119s (sync time)
-------------------------------------------------------------------------------------
  subscribedfeeds                                             : 8/25%      17s/14%
    aagmtest2@gmail.com/com.google                            :   5/16%      16s/13%
    aagmtest1@gmail.com/com.google                            :   3/9%       1s/0%
-------------------------------------------------------------------------------------
  com.android.calendar                                        : 5/16%      10s/8%
    aagmtest2@gmail.com/com.google                            :   3/9%       0s/0%
    aagmtest1@gmail.com/com.google                            :   2/6%       9s/8%
-------------------------------------------------------------------------------------
  com.google.android.apps.books                               : 3/9%       26s/22%
-------------------------------------------------------------------------------------
  com.android.contacts                                        : 3/9%       14s/11%
    aagmtest1@gmail.com/com.google                            :   2/6%       9s/7%
    aagmtest2@gmail.com/com.google                            :   1/3%       5s/4%
-------------------------------------------------------------------------------------
  com.android.browser                                         : 3/9%       12s/10%
-------------------------------------------------------------------------------------
  com.google.android.music.MusicContent                       : 3/9%       7s/6%
-------------------------------------------------------------------------------------
  gmail-ls                                                    : 2/6%       12s/10%
-------------------------------------------------------------------------------------
  com.google.android.apps.plus.content.EsGooglePhotoProvider  : 2/6%       1s/0%
    aagmtest2@gmail.com/com.google                            :   1/3%       1s/0%
    aagmtest1@gmail.com/com.google                            :   1/3%       0s/0%
-------------------------------------------------------------------------------------
  com.google.android.apps.plus.content.EsProvider             : 1/3%       10s/9%
-------------------------------------------------------------------------------------
  com.google.android.gallery3d.GooglePhotoProvider            : 1/3%       5s/5%
-------------------------------------------------------------------------------------

Recent Sync History
  #1  : 2011-10-03 13:26:41   SERVER    0.0s            aagmtest2@gmail.com/com.google  com.android.calendar
  #2  : 2011-10-03 13:26:40    LOCAL    1.8s            aagmtest2@gmail.com/com.google  subscribedfeeds
  #3  : 2011-10-03 13:26:40    LOCAL    0.1s            aagmtest1@gmail.com/com.google  subscribedfeeds
  #4  : 2011-10-03 13:26:37   SERVER    0.1s         4  aagmtest2@gmail.com/com.google  com.android.calendar
  #5  : 2011-10-03 13:26:37    LOCAL    0.1s            aagmtest2@gmail.com/com.google  com.google.android.apps.books
  #6  : 2011-10-03 13:26:30   SERVER    0.9s         7  aagmtest2@gmail.com/com.google  com.google.android.apps.books
  #7  : 2011-10-03 13:26:25   SERVER    1.1s            aagmtest2@gmail.com/com.google  gmail-ls
  #8  : 2011-10-03 13:26:13   SERVER   11.8s        11  aagmtest2@gmail.com/com.google  gmail-ls
  #9  : 2011-10-03 13:26:08   SERVER    5.0s            aagmtest2@gmail.com/com.google  com.android.contacts
  #10 : 2011-10-03 13:26:08   SERVER    0.7s        29  aagmtest2@gmail.com/com.google  com.android.calendar
  #11 : 2011-10-03 13:26:07   SERVER    0.7s            aagmtest2@gmail.com/com.google  com.android.browser
  #12 : 2011-10-03 13:26:04   SERVER    3.0s         2  aagmtest2@gmail.com/com.google  com.android.browser
  #13 : 2011-10-03 13:26:04   SERVER   25.9s        25  aagmtest2@gmail.com/com.google  com.google.android.apps.books

Change-Id: I8da004f469d136fd9a86310b262eba61197fd0e7
This commit is contained in:
Alon Albert
2011-10-03 13:06:43 -07:00
parent 8ebf1efd66
commit bf976ba657

View File

@@ -1301,7 +1301,7 @@ public class SyncManager implements OnAccountsUpdateListener {
elapsedTime = authoritySyncStats.elapsedTime;
times = authoritySyncStats.times;
timeStr = String.format("%d/%d%%",
timeStr = String.format("%ds/%d%%",
elapsedTime / 1000,
elapsedTime * 100 / totalElapsedTime);
timesStr = String.format("%d/%d%%",
@@ -1309,32 +1309,30 @@ public class SyncManager implements OnAccountsUpdateListener {
times * 100 / totalTimes);
pw.printf(authorityFormat, name, timesStr, timeStr);
if (authoritySyncStats.accountMap.size() > 1) {
final List<AccountSyncStats> sortedAccounts =
new ArrayList<AccountSyncStats>(
authoritySyncStats.accountMap.values());
Collections.sort(sortedAccounts, new Comparator<AccountSyncStats>() {
@Override
public int compare(AccountSyncStats lhs, AccountSyncStats rhs) {
// reverse order
int compare = Integer.compare(rhs.times, lhs.times);
if (compare == 0) {
compare = Long.compare(rhs.elapsedTime, lhs.elapsedTime);
}
return compare;
final List<AccountSyncStats> sortedAccounts =
new ArrayList<AccountSyncStats>(
authoritySyncStats.accountMap.values());
Collections.sort(sortedAccounts, new Comparator<AccountSyncStats>() {
@Override
public int compare(AccountSyncStats lhs, AccountSyncStats rhs) {
// reverse order
int compare = Integer.compare(rhs.times, lhs.times);
if (compare == 0) {
compare = Long.compare(rhs.elapsedTime, lhs.elapsedTime);
}
});
for (AccountSyncStats stats: sortedAccounts) {
elapsedTime = stats.elapsedTime;
times = stats.times;
timeStr = String.format("%d/%d%%",
elapsedTime / 1000,
elapsedTime * 100 / totalElapsedTime);
timesStr = String.format("%d/%d%%",
times,
times * 100 / totalTimes);
pw.printf(accountFormat, stats.name, timesStr, timeStr);
return compare;
}
});
for (AccountSyncStats stats: sortedAccounts) {
elapsedTime = stats.elapsedTime;
times = stats.times;
timeStr = String.format("%ds/%d%%",
elapsedTime / 1000,
elapsedTime * 100 / totalElapsedTime);
timesStr = String.format("%d/%d%%",
times,
times * 100 / totalTimes);
pw.printf(accountFormat, stats.name, timesStr, timeStr);
}
pw.println(separator);
}
@@ -1342,9 +1340,8 @@ public class SyncManager implements OnAccountsUpdateListener {
pw.println();
pw.println("Recent Sync History");
final String format = " %-" + maxAccount + "s %s\n";
String lastAuthorityName = null;
String lastAccountKey = null;
long lastEventTime = 0;
final Map<String, Long> lastTimeMap = Maps.newHashMap();
for (int i = 0; i < N; i++) {
SyncStorageEngine.SyncHistoryItem item = items.get(i);
SyncStorageEngine.AuthorityInfo authority
@@ -1363,21 +1360,32 @@ public class SyncManager implements OnAccountsUpdateListener {
final long eventTime = item.eventTime;
time.set(eventTime);
pw.printf(" #%-3d: %s %8s %5.1fs",
final String key = authorityName + "/" + accountKey;
final Long lastEventTime = lastTimeMap.get(key);
final String diffString;
if (lastEventTime == null) {
diffString = "";
} else {
final long diff = (lastEventTime - eventTime) / 1000;
if (diff < 60) {
diffString = String.valueOf(diff);
} else if (diff < 3600) {
diffString = String.format("%02d:%02d", diff / 60, diff % 60);
} else {
final long sec = diff % 3600;
diffString = String.format("%02d:%02d:%02d",
diff / 3600, sec / 60, sec % 60);
}
}
lastTimeMap.put(key, eventTime);
pw.printf(" #%-3d: %s %8s %5.1fs %8s",
i + 1,
formatTime(eventTime),
SyncStorageEngine.SOURCES[item.source],
((float) elapsedTime) / 1000);
if (authorityName.equals(lastAuthorityName) && accountKey.equals(lastAccountKey)) {
final long span = (lastEventTime - eventTime) / 1000;
pw.printf(" %02d:%02d\n", span / 60, span % 60);
} else {
pw.printf(format, accountKey, authorityName);
}
lastAuthorityName = authorityName;
lastAccountKey = accountKey;
lastEventTime = eventTime;
((float) elapsedTime) / 1000,
diffString);
pw.printf(format, accountKey, authorityName);
if (item.event != SyncStorageEngine.EVENT_STOP
|| item.upstreamActivity != 0