diff options
| author | 2025-02-11 04:24:54 -0800 | |
|---|---|---|
| committer | 2025-02-11 04:24:54 -0800 | |
| commit | 560c2ebb95f34a2761ea847df55bf07512e2b17f (patch) | |
| tree | da5d0fc603b4acc8743fe8f15b8a3fb5c0092c81 /runtime/thread.cc | |
| parent | b6fa18bb34a1b0b9e48a8e888603f23e34c272aa (diff) | |
| parent | 84c60905008131ff35b93b9f8b64923e267f92a6 (diff) | |
Revert^2 "Use nanoseconds for v2 method tracing" am: 84c6090500
Original change: https://android-review.googlesource.com/c/platform/art/+/3463510
Change-Id: Iae6f3c1d588a0744091ca781c058bd43d69a145b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'runtime/thread.cc')
| -rw-r--r-- | runtime/thread.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc index 50f6bfc499..89465979da 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1485,12 +1485,21 @@ 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(1000000) + - static_cast<uint64_t>(now.tv_nsec) / UINT64_C(1000); + return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + + static_cast<uint64_t>(now.tv_nsec); #else // __APPLE__ UNIMPLEMENTED(WARNING); return -1; |