summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-07-20 18:47:17 -0700
committerRomain Guy <romainguy@google.com>2011-07-20 18:47:17 -0700
commit648bee18a1ccd362445d562729250ff5910f16a0 (patch)
tree51fcdf0725beb8789d344e0ed85a5355674f6ddc /core/java/android/os
parentcf4cfc6fc88f204e2e496e37337f7e70809bbf6f (diff)
downloadframeworks_base-648bee18a1ccd362445d562729250ff5910f16a0.zip
frameworks_base-648bee18a1ccd362445d562729250ff5910f16a0.tar.gz
frameworks_base-648bee18a1ccd362445d562729250ff5910f16a0.tar.bz2
Convert looper traces to traceview traces
Change-Id: If9238e8b00744118c1c4d2182727569f94deb638
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/Looper.java14
-rw-r--r--core/java/android/os/SystemClock.java18
2 files changed, 26 insertions, 6 deletions
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index 720e802b..c61f28a 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -130,19 +130,20 @@ public class Looper {
if (logging != null) {
logging.println(">>>>> Dispatching to " + msg.target + " " +
msg.callback + ": " + msg.what);
- wallStart = System.currentTimeMillis();
- threadStart = SystemClock.currentThreadTimeMillis();
+ wallStart = SystemClock.currentTimeMicro();
+ threadStart = SystemClock.currentThreadTimeMicro();
}
msg.target.dispatchMessage(msg);
if (logging != null) {
- long wallTime = System.currentTimeMillis() - wallStart;
- long threadTime = SystemClock.currentThreadTimeMillis() - threadStart;
+ long wallTime = SystemClock.currentTimeMicro() - wallStart;
+ long threadTime = SystemClock.currentThreadTimeMicro() - threadStart;
logging.println("<<<<< Finished to " + msg.target + " " + msg.callback);
if (logging instanceof Profiler) {
- ((Profiler) logging).profile(msg, wallStart, wallTime, threadTime);
+ ((Profiler) logging).profile(msg, wallStart, wallTime,
+ threadStart, threadTime);
}
}
@@ -247,6 +248,7 @@ public class Looper {
* @hide
*/
public static interface Profiler {
- void profile(Message message, long wallStart, long wallTime, long threadTime);
+ void profile(Message message, long wallStart, long wallTime,
+ long threadStart, long threadTime);
}
}
diff --git a/core/java/android/os/SystemClock.java b/core/java/android/os/SystemClock.java
index 2dd6749..7291739 100644
--- a/core/java/android/os/SystemClock.java
+++ b/core/java/android/os/SystemClock.java
@@ -157,4 +157,22 @@ public final class SystemClock {
* @return elapsed milliseconds in the thread
*/
public static native long currentThreadTimeMillis();
+
+ /**
+ * Returns microseconds running in the current thread.
+ *
+ * @return elapsed microseconds in the thread
+ *
+ * @hide
+ */
+ public static native long currentThreadTimeMicro();
+
+ /**
+ * Returns current wall time in microseconds.
+ *
+ * @return elapsed microseconds in wall time
+ *
+ * @hide
+ */
+ public static native long currentTimeMicro();
}