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

Side by Side Diff: runtime/vm/profiler_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 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/json_stream.h" 9 #include "vm/json_stream.h"
10 #include "vm/profiler.h" 10 #include "vm/profiler.h"
(...skipping 11 matching lines...) Expand all
22 uintptr_t stack_upper) { 22 uintptr_t stack_upper) {
23 SampleBuffer* sample_buffer = profiler_data->sample_buffer(); 23 SampleBuffer* sample_buffer = profiler_data->sample_buffer();
24 Sample* sample = sample_buffer->ReserveSample(); 24 Sample* sample = sample_buffer->ReserveSample();
25 ASSERT(sample != NULL); 25 ASSERT(sample != NULL);
26 sample->timestamp = OS::GetCurrentTimeMicros(); 26 sample->timestamp = OS::GetCurrentTimeMicros();
27 // TODO(johnmccutchan): Make real use of vm_tags and runtime_tags. 27 // TODO(johnmccutchan): Make real use of vm_tags and runtime_tags.
28 // Issue # 14777 28 // Issue # 14777
29 sample->vm_tags = Sample::kExecuting; 29 sample->vm_tags = Sample::kExecuting;
30 sample->runtime_tags = 0; 30 sample->runtime_tags = 0;
31 int64_t cpu_usage = 0; 31 int64_t cpu_usage = 0;
32 // TODO(johnmccutchan): Thread::GetThreadCpuUsage on MacOS. 32 Thread::GetThreadCpuUsage(profiler_data->thread_id(), &cpu_usage);
33 sample->cpu_usage = profiler_data->ComputeDeltaAndSetCpuUsage(cpu_usage); 33 sample->cpu_usage = profiler_data->ComputeDeltaAndSetCpuUsage(cpu_usage);
34 ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper, 34 ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper,
35 pc, fp, sp); 35 pc, fp, sp);
36 stackWalker.walk(); 36 stackWalker.walk();
37 } 37 }
38 38
39 39
40 static void ProfileSignalAction(int signal, siginfo_t* info, void* context_) { 40 static void ProfileSignalAction(int signal, siginfo_t* info, void* context_) {
41 if (signal != SIGPROF) { 41 if (signal != SIGPROF) {
42 return; 42 return;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 int64_t current_time = OS::GetCurrentTimeMicros(); 124 int64_t current_time = OS::GetCurrentTimeMicros();
125 int64_t next_sample = SampleAndRescheduleIsolates(current_time); 125 int64_t next_sample = SampleAndRescheduleIsolates(current_time);
126 lock.WaitMicros(next_sample); 126 lock.WaitMicros(next_sample);
127 } 127 }
128 } 128 }
129 129
130 130
131 } // namespace dart 131 } // namespace dart
132 132
133 #endif // defined(TARGET_OS_MACOS) 133 #endif // defined(TARGET_OS_MACOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698