OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 uintptr_t stack_lower, | 21 uintptr_t stack_lower, |
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; | 31 int64_t cpu_usage = 0; |
32 Thread::GetThreadCpuUsage(profiler_data->thread_id(), &cpu_usage); | 32 // TODO(johnmccutchan): Thread::GetThreadCpuUsage on MacOS. |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 int64_t current_time = OS::GetCurrentTimeMicros(); | 126 int64_t current_time = OS::GetCurrentTimeMicros(); |
127 int64_t next_sample = SampleAndRescheduleIsolates(current_time); | 127 int64_t next_sample = SampleAndRescheduleIsolates(current_time); |
128 lock.WaitMicros(next_sample); | 128 lock.WaitMicros(next_sample); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 } // namespace dart | 133 } // namespace dart |
134 | 134 |
135 #endif // defined(TARGET_OS_MACOS) | 135 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |