| 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/address_sanitizer.h" | 5 #include "platform/address_sanitizer.h" |
| 6 #include "platform/memory_sanitizer.h" | 6 #include "platform/memory_sanitizer.h" |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
| 8 | 8 |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #endif | 45 #endif |
| 46 DEFINE_FLAG(int, | 46 DEFINE_FLAG(int, |
| 47 max_profile_depth, | 47 max_profile_depth, |
| 48 kSampleSize* kMaxSamplesPerTick, | 48 kSampleSize* kMaxSamplesPerTick, |
| 49 "Maximum number stack frames walked. Minimum 1. Maximum 255."); | 49 "Maximum number stack frames walked. Minimum 1. Maximum 255."); |
| 50 #if defined(USING_SIMULATOR) | 50 #if defined(USING_SIMULATOR) |
| 51 DEFINE_FLAG(bool, profile_vm, true, "Always collect native stack traces."); | 51 DEFINE_FLAG(bool, profile_vm, true, "Always collect native stack traces."); |
| 52 #else | 52 #else |
| 53 DEFINE_FLAG(bool, profile_vm, false, "Always collect native stack traces."); | 53 DEFINE_FLAG(bool, profile_vm, false, "Always collect native stack traces."); |
| 54 #endif | 54 #endif |
| 55 DEFINE_FLAG(bool, |
| 56 profile_vm_allocation, |
| 57 false, |
| 58 "Collect native stack traces when tracing Dart allocations."); |
| 55 | 59 |
| 56 #ifndef PRODUCT | 60 #ifndef PRODUCT |
| 57 | 61 |
| 58 bool Profiler::initialized_ = false; | 62 bool Profiler::initialized_ = false; |
| 59 SampleBuffer* Profiler::sample_buffer_ = NULL; | 63 SampleBuffer* Profiler::sample_buffer_ = NULL; |
| 60 AllocationSampleBuffer* Profiler::allocation_sample_buffer_ = NULL; | 64 AllocationSampleBuffer* Profiler::allocation_sample_buffer_ = NULL; |
| 61 ProfilerCounters Profiler::counters_; | 65 ProfilerCounters Profiler::counters_; |
| 62 | 66 |
| 63 void Profiler::InitOnce() { | 67 void Profiler::InitOnce() { |
| 64 // Place some sane restrictions on user controlled flags. | 68 // Place some sane restrictions on user controlled flags. |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 | 1179 |
| 1176 if (!GetAndValidateThreadStackBounds(thread, fp, sp, &stack_lower, | 1180 if (!GetAndValidateThreadStackBounds(thread, fp, sp, &stack_lower, |
| 1177 &stack_upper)) { | 1181 &stack_upper)) { |
| 1178 // Could not get stack boundary. | 1182 // Could not get stack boundary. |
| 1179 return; | 1183 return; |
| 1180 } | 1184 } |
| 1181 | 1185 |
| 1182 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); | 1186 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); |
| 1183 sample->SetAllocationCid(cid); | 1187 sample->SetAllocationCid(cid); |
| 1184 | 1188 |
| 1185 if (FLAG_profile_vm) { | 1189 if (FLAG_profile_vm_allocation) { |
| 1186 ProfilerNativeStackWalker native_stack_walker( | 1190 ProfilerNativeStackWalker native_stack_walker( |
| 1187 (isolate != NULL) ? isolate->main_port() : ILLEGAL_PORT, sample, | 1191 (isolate != NULL) ? isolate->main_port() : ILLEGAL_PORT, sample, |
| 1188 sample_buffer, stack_lower, stack_upper, pc, fp, sp); | 1192 sample_buffer, stack_lower, stack_upper, pc, fp, sp); |
| 1189 native_stack_walker.walk(); | 1193 native_stack_walker.walk(); |
| 1190 } else if (exited_dart_code) { | 1194 } else if (exited_dart_code) { |
| 1191 ProfilerDartStackWalker dart_exit_stack_walker( | 1195 ProfilerDartStackWalker dart_exit_stack_walker( |
| 1192 thread, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp, | 1196 thread, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp, |
| 1193 exited_dart_code, true); | 1197 exited_dart_code, true); |
| 1194 dart_exit_stack_walker.walk(); | 1198 dart_exit_stack_walker.walk(); |
| 1195 } else { | 1199 } else { |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 | 1725 |
| 1722 | 1726 |
| 1723 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1727 ProcessedSampleBuffer::ProcessedSampleBuffer() |
| 1724 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1728 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
| 1725 ASSERT(code_lookup_table_ != NULL); | 1729 ASSERT(code_lookup_table_ != NULL); |
| 1726 } | 1730 } |
| 1727 | 1731 |
| 1728 #endif // !PRODUCT | 1732 #endif // !PRODUCT |
| 1729 | 1733 |
| 1730 } // namespace dart | 1734 } // namespace dart |
| OLD | NEW |