diff options
Diffstat (limited to 'runtime/thread.cc')
| -rw-r--r-- | runtime/thread.cc | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc index 89465979da..50f6bfc499 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1485,21 +1485,12 @@ void Thread::GetThreadName(std::string& name) const { uint64_t Thread::GetCpuMicroTime() const { #if defined(__linux__) - return Thread::GetCpuNanoTime() / 1000; -#else // __APPLE__ - UNIMPLEMENTED(WARNING); - return -1; -#endif -} - -uint64_t Thread::GetCpuNanoTime() const { -#if defined(__linux__) clockid_t cpu_clock_id; pthread_getcpuclockid(tlsPtr_.pthread_self, &cpu_clock_id); timespec now; clock_gettime(cpu_clock_id, &now); - return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + - static_cast<uint64_t>(now.tv_nsec); + return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000) + + static_cast<uint64_t>(now.tv_nsec) / UINT64_C(1000); #else // __APPLE__ UNIMPLEMENTED(WARNING); return -1; |