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

Unified Diff: runtime/platform/thread_android.cc

Issue 25909002: Sampling profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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/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);

Powered by Google App Engine
This is Rietveld 408576698