summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorAnwar Ghuloum <anwarg@google.com>2014-09-04 07:49:39 -0700
committerAnwar Ghuloum <anwarg@google.com>2014-09-05 07:13:57 -0700
commit6d688b8bb051942cd3cdd5fc1e19f42c3049f8a1 (patch)
treedf7c61d6f83ab312d722a5b06851c849720d5158 /dalvik
parentae45925d3a59ae3eb72d70e305d2c1dab5ef6d17 (diff)
downloadlibcore-6d688b8bb051942cd3cdd5fc1e19f42c3049f8a1.zip
libcore-6d688b8bb051942cd3cdd5fc1e19f42c3049f8a1.tar.gz
libcore-6d688b8bb051942cd3cdd5fc1e19f42c3049f8a1.tar.bz2
Timing hacks DO NOT MERGE
Let's submit to see if any issues remain Bug: 17310019 Change-Id: Ifef1b1645033adcf192d6ec9248456cae28cd09f
Diffstat (limited to 'dalvik')
-rw-r--r--dalvik/src/main/java/dalvik/system/ZygoteHooks.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
index fa4f392..1f8f28a 100644
--- a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
+++ b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
@@ -28,6 +28,19 @@ public final class ZygoteHooks {
private long token;
/**
+ * Temporary hack: check time since start time and log if over a fixed threshold.
+ *
+ */
+ private static void checkTime(long startTime, String where) {
+ long now = System.nanoTime();
+ long msDuration = (now - startTime) / (1000 * 1000);
+ if (msDuration > 1000) {
+ // If we are taking more than a second, log about it.
+ System.logW("Slow operation: " + msDuration + "ms so far, now at " + where);
+ }
+ }
+
+ /**
* Called by the zygote prior to every fork. Each call to {@code preFork}
* is followed by a matching call to {@link #postForkChild(int)} on the child
* process and {@link #postForkCommon()} on both the parent and the child
@@ -35,9 +48,13 @@ public final class ZygoteHooks {
* the child process.
*/
public void preFork() {
+ long startTime = System.nanoTime();
Daemons.stop();
+ checkTime(startTime, "ZygoteHooks.Daemons.stop");
waitUntilAllThreadsStopped();
+ checkTime(startTime, "ZygoteHooks.waituntilallthreadsstopped");
token = nativePreFork();
+ checkTime(startTime, "ZygoteHooks.Daemons.nativePreFork");
}
/**