am 93f00def: Merge change 24509 into eclair
Merge commit '93f00def4b63511be91057b2bc69f1dda6f038e9' into eclair-plus-aosp * commit '93f00def4b63511be91057b2bc69f1dda6f038e9': Addressed reviewer comments.
This commit is contained in:
@@ -4246,12 +4246,9 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
thread.detach();
|
thread.detach();
|
||||||
String name;
|
String name = (thread.mInitialApplication != null)
|
||||||
if (thread.mInitialApplication != null) {
|
? thread.mInitialApplication.getPackageName()
|
||||||
name = thread.mInitialApplication.getPackageName();
|
: "<unknown>";
|
||||||
} else {
|
|
||||||
name = "<unknown>";
|
|
||||||
}
|
|
||||||
Log.i(TAG, "Main thread of " + name + " is now exiting");
|
Log.i(TAG, "Main thread of " + name + " is now exiting");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import java.util.concurrent.Executors;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.os.*;
|
import android.os.*;
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integrates the framework with Dalvik's sampling profiler.
|
* Integrates the framework with Dalvik's sampling profiler.
|
||||||
@@ -60,14 +59,25 @@ public class SamplingProfilerIntegration {
|
|||||||
public static void writeSnapshot(final String name) {
|
public static void writeSnapshot(final String name) {
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we're already writing a snapshot, don't bother enqueing another
|
||||||
|
* request right now. This will reduce the number of individual
|
||||||
|
* snapshots and in turn the total amount of memory consumed (one big
|
||||||
|
* snapshot is smaller than N subset snapshots).
|
||||||
|
*/
|
||||||
if (!pending) {
|
if (!pending) {
|
||||||
pending = true;
|
pending = true;
|
||||||
snapshotWriter.execute(new Runnable() {
|
snapshotWriter.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String dir = "/sdcard/snapshots";
|
String dir = "/sdcard/snapshots";
|
||||||
if (!dirMade) {
|
if (!dirMade) {
|
||||||
makeDirectory(dir);
|
new File(dir).mkdirs();
|
||||||
dirMade = true;
|
if (new File(dir).isDirectory()) {
|
||||||
|
dirMade = true;
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Creation of " + dir + " failed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
writeSnapshot(dir, name);
|
writeSnapshot(dir, name);
|
||||||
@@ -86,7 +96,7 @@ public class SamplingProfilerIntegration {
|
|||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
|
|
||||||
String dir = "/data/zygote/snapshots";
|
String dir = "/data/zygote/snapshots";
|
||||||
makeDirectory(dir);
|
new File(dir).mkdirs();
|
||||||
writeSnapshot(dir, "zygote");
|
writeSnapshot(dir, "zygote");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +112,7 @@ public class SamplingProfilerIntegration {
|
|||||||
* we capture two snapshots in rapid succession.
|
* we capture two snapshots in rapid succession.
|
||||||
*/
|
*/
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
String path = dir + "/" + name.replace(':', '.') + "-"
|
String path = dir + "/" + name.replace(':', '.') + "-" +
|
||||||
+ System.currentTimeMillis() + ".snapshot";
|
+ System.currentTimeMillis() + ".snapshot";
|
||||||
try {
|
try {
|
||||||
// Try to open the file a few times. The SD card may not be mounted.
|
// Try to open the file a few times. The SD card may not be mounted.
|
||||||
@@ -137,8 +147,4 @@ public class SamplingProfilerIntegration {
|
|||||||
Log.e(TAG, "Error writing snapshot.", e);
|
Log.e(TAG, "Error writing snapshot.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void makeDirectory(String dir) {
|
|
||||||
new File(dir).mkdirs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user