| 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 #ifndef RUNTIME_VM_PROFILER_H_ | 5 #ifndef RUNTIME_VM_PROFILER_H_ |
| 6 #define RUNTIME_VM_PROFILER_H_ | 6 #define RUNTIME_VM_PROFILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/bitfield.h" | 9 #include "vm/bitfield.h" |
| 10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| 11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 12 #include "vm/growable_array.h" | 12 #include "vm/growable_array.h" |
| 13 #include "vm/malloc_hooks.h" | 13 #include "vm/malloc_hooks.h" |
| 14 #include "vm/native_symbol.h" |
| 14 #include "vm/object.h" | 15 #include "vm/object.h" |
| 15 #include "vm/tags.h" | 16 #include "vm/tags.h" |
| 16 #include "vm/thread_interrupter.h" | 17 #include "vm/thread_interrupter.h" |
| 17 | 18 |
| 18 // Profiler sampling and stack walking support. | 19 // Profiler sampling and stack walking support. |
| 19 // NOTE: For service related code, see profile_service.h. | 20 // NOTE: For service related code, see profile_service.h. |
| 20 | 21 |
| 21 namespace dart { | 22 namespace dart { |
| 22 | 23 |
| 23 // Forward declarations. | 24 // Forward declarations. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 214 } |
| 214 | 215 |
| 215 // Set stack trace entry. | 216 // Set stack trace entry. |
| 216 void SetAt(intptr_t i, uword pc) { | 217 void SetAt(intptr_t i, uword pc) { |
| 217 ASSERT(i >= 0); | 218 ASSERT(i >= 0); |
| 218 ASSERT(i < pcs_length_); | 219 ASSERT(i < pcs_length_); |
| 219 uword* pcs = GetPCArray(); | 220 uword* pcs = GetPCArray(); |
| 220 pcs[i] = pc; | 221 pcs[i] = pc; |
| 221 } | 222 } |
| 222 | 223 |
| 224 void DumpStackTrace() { |
| 225 for (intptr_t i = 0; i < pcs_length_; ++i) { |
| 226 uintptr_t start = 0; |
| 227 uword pc = At(i); |
| 228 char* native_symbol_name = |
| 229 NativeSymbolResolver::LookupSymbolName(pc, &start); |
| 230 if (native_symbol_name == NULL) { |
| 231 OS::PrintErr(" [0x%" Pp "] Unknown symbol\n", pc); |
| 232 } else { |
| 233 OS::PrintErr(" [0x%" Pp "] %s\n", pc, native_symbol_name); |
| 234 NativeSymbolResolver::FreeSymbolName(native_symbol_name); |
| 235 } |
| 236 } |
| 237 } |
| 238 |
| 223 uword vm_tag() const { return vm_tag_; } | 239 uword vm_tag() const { return vm_tag_; } |
| 224 void set_vm_tag(uword tag) { | 240 void set_vm_tag(uword tag) { |
| 225 ASSERT(tag != VMTag::kInvalidTagId); | 241 ASSERT(tag != VMTag::kInvalidTagId); |
| 226 vm_tag_ = tag; | 242 vm_tag_ = tag; |
| 227 } | 243 } |
| 228 | 244 |
| 229 uword user_tag() const { return user_tag_; } | 245 uword user_tag() const { return user_tag_; } |
| 230 void set_user_tag(uword tag) { user_tag_ = tag; } | 246 void set_user_tag(uword tag) { user_tag_ = tag; } |
| 231 | 247 |
| 232 uword pc_marker() const { return pc_marker_; } | 248 uword pc_marker() const { return pc_marker_; } |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 private: | 699 private: |
| 684 ZoneGrowableArray<ProcessedSample*> samples_; | 700 ZoneGrowableArray<ProcessedSample*> samples_; |
| 685 CodeLookupTable* code_lookup_table_; | 701 CodeLookupTable* code_lookup_table_; |
| 686 | 702 |
| 687 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 703 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
| 688 }; | 704 }; |
| 689 | 705 |
| 690 } // namespace dart | 706 } // namespace dart |
| 691 | 707 |
| 692 #endif // RUNTIME_VM_PROFILER_H_ | 708 #endif // RUNTIME_VM_PROFILER_H_ |
| OLD | NEW |