Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Unified Diff: runtime/vm/os_android.cc

Issue 1960483002: Include thread CPU time in Timeline (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/os_android.cc
diff --git a/runtime/vm/os_android.cc b/runtime/vm/os_android.cc
index 3269b128e760d23a79422e04d7df2368e9af7339..1c22b7c0f0a3f921bac585d8d35872f14010b2a9 100644
--- a/runtime/vm/os_android.cc
+++ b/runtime/vm/os_android.cc
@@ -168,6 +168,19 @@ int64_t OS::GetCurrentMonotonicMicros() {
}
+int64_t OS::GetCurrentThreadCPUMicros() {
+ struct timespec ts;
+ if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) {
+ UNREACHABLE();
+ return -1;
+ }
+ int64_t result = ts.tv_sec;
+ result *= kMicrosecondsPerSecond;
+ result += (ts.tv_nsec / kNanosecondsPerMicrosecond);
+ return result;
+}
+
+
void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
const int kMinimumAlignment = 16;
ASSERT(Utils::IsPowerOfTwo(alignment));
« no previous file with comments | « runtime/vm/os.h ('k') | runtime/vm/os_linux.cc » ('j') | runtime/vm/os_macos.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698