Fix sampling profiler to use thread's cpu clock.

The sampling profiler was using the sampling thread's cpu clock to
measure cpu time, instead of the sampled thread's cpu clock.

Change-Id: Ief1f82e07e0353192c61521f67dec7a761905f64
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 13e2bf6..d435129 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -174,7 +174,7 @@
 
 static void MeasureClockOverhead(Trace* trace) {
   if (trace->UseThreadCpuClock()) {
-    ThreadCpuMicroTime();
+    Thread::Current()->GetCpuMicroTime();
   }
   if (trace->UseWallClock()) {
     MicroTime();
@@ -182,7 +182,8 @@
 }
 
 static uint32_t GetClockOverhead(Trace* trace) {
-  uint64_t start = ThreadCpuMicroTime();
+  Thread* self = Thread::Current();
+  uint64_t start = self->GetCpuMicroTime();
 
   for (int i = 4000; i > 0; i--) {
     MeasureClockOverhead(trace);
@@ -195,7 +196,7 @@
     MeasureClockOverhead(trace);
   }
 
-  uint64_t elapsed = ThreadCpuMicroTime() - start;
+  uint64_t elapsed = self->GetCpuMicroTime() - start;
   return uint32_t (elapsed / 32);
 }
 
@@ -582,11 +583,11 @@
     uint32_t thread_clock_diff = 0;
     if (UNLIKELY(it == thread_clock_base_map_.end())) {
       // First event, the diff is 0, record the base time in the map.
-      uint64_t time = ThreadCpuMicroTime();
+      uint64_t time = thread->GetCpuMicroTime();
       thread_clock_base_map_.Put(thread, time);
     } else {
       uint64_t thread_clock_base = it->second;
-      thread_clock_diff = ThreadCpuMicroTime() - thread_clock_base;
+      thread_clock_diff = thread->GetCpuMicroTime() - thread_clock_base;
     }
     Append4LE(ptr, thread_clock_diff);
     ptr += 4;