Skip to content

Commit d9137ca

Browse files
author
Dianne Hackborn
committed
Add time stamp to content provider connection.
For help in tracking down memory use issues, seeing how long a connection has been held that is keeping other processes around. Let's call this for issue #6577613: Unbelievably sluggish nexus-S Change-Id: Ia3d016c5ed9d2155eea18ec884047e1e1d8a0ad5
1 parent 3c144c3 commit d9137ca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

services/java/com/android/server/am/ContentProviderConnection.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
package com.android.server.am;
1818

1919
import android.os.Binder;
20+
import android.os.SystemClock;
21+
import android.util.TimeUtils;
2022

2123
/**
2224
* Represents a link between a content provider and client.
2325
*/
2426
public class ContentProviderConnection extends Binder {
2527
public final ContentProviderRecord provider;
2628
public final ProcessRecord client;
29+
public final long createTime;
2730
public int stableCount;
2831
public int unstableCount;
2932
// The client of this connection is currently waiting for the provider to appear.
@@ -39,6 +42,7 @@ public class ContentProviderConnection extends Binder {
3942
public ContentProviderConnection(ContentProviderRecord _provider, ProcessRecord _client) {
4043
provider = _provider;
4144
client = _client;
45+
createTime = SystemClock.elapsedRealtime();
4246
}
4347

4448
public String toString() {
@@ -83,5 +87,8 @@ public void toClientString(StringBuilder sb) {
8387
if (dead) {
8488
sb.append(" DEAD");
8589
}
90+
long nowReal = SystemClock.elapsedRealtime();
91+
sb.append(" ");
92+
TimeUtils.formatDuration(nowReal-createTime, sb);
8693
}
8794
}

0 commit comments

Comments
 (0)