Merge "Add System Tracing capability to Sync Manager" into jb-dev

This commit is contained in:
Andy Stadler
2012-05-04 14:46:00 -07:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
import android.os.Trace;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -233,9 +234,15 @@ public abstract class AbstractThreadedSyncAdapter {
mThreadsKey = toSyncKey(account);
}
@Override
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
// Trace this sync instance. Note, conceptually this should be in
// SyncStorageEngine.insertStartSyncEvent(), but the trace functions require unique
// threads in order to track overlapping operations, so we'll do it here for now.
Trace.traceBegin(Trace.TRACE_TAG_SYNC_MANAGER, mAuthority);
SyncResult syncResult = new SyncResult();
ContentProviderClient provider = null;
try {
@@ -250,6 +257,8 @@ public abstract class AbstractThreadedSyncAdapter {
syncResult.databaseError = true;
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_SYNC_MANAGER);
if (provider != null) {
provider.release();
}

View File

@@ -36,6 +36,7 @@ public final class Trace {
public static final long TRACE_TAG_WEBVIEW = 1L << 4;
public static final long TRACE_TAG_WINDOW_MANAGER = 1L << 5;
public static final long TRACE_TAG_ACTIVITY_MANAGER = 1L << 6;
public static final long TRACE_TAG_SYNC_MANAGER = 1L << 7;
private static final long sEnabledTags = nativeGetEnabledTags();