| Index: runtime/platform/thread_android.cc
|
| diff --git a/runtime/platform/thread_android.cc b/runtime/platform/thread_android.cc
|
| index 20e0e9ec5a4b564e626115aca041dd20cbd2a8ed..c8bca726058aeb33d0ebf8f415e0a82561704607 100644
|
| --- a/runtime/platform/thread_android.cc
|
| +++ b/runtime/platform/thread_android.cc
|
| @@ -144,6 +144,22 @@ intptr_t Thread::GetMaxStackSize() {
|
| }
|
|
|
|
|
| +ThreadId Thread::GetCurrentThreadId() {
|
| + return pthread_self();
|
| +}
|
| +
|
| +
|
| +void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
|
| + ASSERT(thread_id == GetCurrentThreadId());
|
| + ASSERT(cpu_usage != NULL);
|
| + struct timespec ts;
|
| + int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
|
| + ASSERT(r == 0);
|
| + *cpu_usage = (ts.tv_sec * kNanosecondsPerSecond + ts.tv_nsec) /
|
| + kNanosecondsPerMicrosecond;
|
| +}
|
| +
|
| +
|
| Mutex::Mutex() {
|
| pthread_mutexattr_t attr;
|
| int result = pthread_mutexattr_init(&attr);
|
|
|