Updates to tracer to log events.

The tracer can now generates traces for ddms or output to a logfile.
Also includes bugfixes to allow stack walking to work properly when
tracing.

Change-Id: I8894272d9a678eeb1d376734f7822daf2ab298e4
diff --git a/src/utils.cc b/src/utils.cc
index 0d6aff9..ced68de 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -56,12 +56,24 @@
   return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_nsec / 1000000LL;
 }
 
+uint64_t MicroTime() {
+  struct timespec now;
+  clock_gettime(CLOCK_MONOTONIC, &now);
+  return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL;
+}
+
 uint64_t NanoTime() {
   struct timespec now;
   clock_gettime(CLOCK_MONOTONIC, &now);
   return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec;
 }
 
+uint64_t ThreadCpuMicroTime() {
+  struct timespec now;
+  clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now);
+  return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL;
+}
+
 std::string PrettyDescriptor(const String* java_descriptor) {
   if (java_descriptor == NULL) {
     return "null";