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

Unified Diff: runtime/platform/thread_macos.cc

Issue 78713003: Attempt at enabling 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
« no previous file with comments | « no previous file | runtime/vm/profiler.cc » ('j') | tools/gyp/configurations_make.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/thread_macos.cc
diff --git a/runtime/platform/thread_macos.cc b/runtime/platform/thread_macos.cc
index 8d4445d15c5e4baee3347e7d1a33fa60b6b1f3df..c4167d43c4cacb843ef653195cb4e4fe25db18e5 100644
--- a/runtime/platform/thread_macos.cc
+++ b/runtime/platform/thread_macos.cc
@@ -145,17 +145,22 @@ ThreadId Thread::GetCurrentThreadId() {
void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
ASSERT(thread_id == GetCurrentThreadId());
ASSERT(cpu_usage != NULL);
- mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
- thread_basic_info_data_t info_data;
- thread_basic_info_t info = &info_data;
- mach_port_t thread_port = mach_thread_self();
- kern_return_t r = thread_info(thread_port, THREAD_BASIC_INFO,
- (thread_info_t)info, &count);
- mach_port_deallocate(mach_task_self(), thread_port);
- if (r == KERN_SUCCESS) {
- *cpu_usage = (info->user_time.seconds * kMicrosecondsPerSecond) +
- info->user_time.microseconds;
- return;
+ // TODO(johnmccutchan): Enable this after fixing issue with macos directory
+ // watcher.
+ const bool get_cpu_usage = false;
+ if (get_cpu_usage) {
+ mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
+ thread_basic_info_data_t info_data;
+ thread_basic_info_t info = &info_data;
+ mach_port_t thread_port = mach_thread_self();
+ kern_return_t r = thread_info(thread_port, THREAD_BASIC_INFO,
+ (thread_info_t)info, &count);
+ mach_port_deallocate(mach_task_self(), thread_port);
+ if (r == KERN_SUCCESS) {
+ *cpu_usage = (info->user_time.seconds * kMicrosecondsPerSecond) +
+ info->user_time.microseconds;
+ return;
+ }
}
*cpu_usage = 0;
}
« no previous file with comments | « no previous file | runtime/vm/profiler.cc » ('j') | tools/gyp/configurations_make.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698