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

Side by Side Diff: runtime/vm/profiler.cc

Issue 965593002: Improved profiler view and inclusive profile tree (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // Attempt to find a better return address. 526 // Attempt to find a better return address.
527 ReturnAddressLocator ral(sample, code); 527 ReturnAddressLocator ral(sample, code);
528 528
529 if (!ral.LocateReturnAddress(&return_address)) { 529 if (!ral.LocateReturnAddress(&return_address)) {
530 ASSERT(return_address == sample->pc_marker()); 530 ASSERT(return_address == sample->pc_marker());
531 // Could not find a better return address than the pc_marker. 531 // Could not find a better return address than the pc_marker.
532 if (code.ContainsInstructionAt(return_address)) { 532 if (code.ContainsInstructionAt(return_address)) {
533 // PC marker is in the same code as pc, no missing frame. 533 // PC marker is in the same code as pc, no missing frame.
534 return; 534 return;
535 } 535 }
536 if (!ContainedInDartCodeHeaps(return_address)) {
537 // PC marker is not from the Dart heap. Do not insert.
538 return;
539 }
540 } 536 }
541 537
538 if (!ContainedInDartCodeHeaps(return_address)) {
539 // return address is not from the Dart heap. Do not insert.
540 return;
541 }
542
542 if (return_address != 0) { 543 if (return_address != 0) {
543 sample->InsertCallerForTopFrame(return_address); 544 sample->InsertCallerForTopFrame(return_address);
544 } 545 }
545 } 546 }
546 547
547 548
548 bool PreprocessVisitor::ContainedInDartCodeHeaps(uword pc) const { 549 bool PreprocessVisitor::ContainedInDartCodeHeaps(uword pc) const {
549 return isolate()->heap()->CodeContains(pc) || 550 return isolate()->heap()->CodeContains(pc) ||
550 vm_isolate()->heap()->CodeContains(pc); 551 vm_isolate()->heap()->CodeContains(pc);
551 } 552 }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 const InterruptedThreadState& state, 927 const InterruptedThreadState& state,
927 void* data) { 928 void* data) {
928 Isolate* isolate = reinterpret_cast<Isolate*>(data); 929 Isolate* isolate = reinterpret_cast<Isolate*>(data);
929 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) { 930 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) {
930 // No isolate. 931 // No isolate.
931 return; 932 return;
932 } 933 }
933 934
934 ASSERT(isolate != Dart::vm_isolate()); 935 ASSERT(isolate != Dart::vm_isolate());
935 936
937 const bool exited_dart_code = (isolate->stub_code() != NULL) &&
938 (isolate->top_exit_frame_info() != 0) &&
939 (isolate->vm_tag() != VMTag::kDartTagId);
940 const bool in_dart_code = (isolate->stub_code() != NULL) &&
941 (isolate->top_exit_frame_info() == 0) &&
942 (isolate->vm_tag() == VMTag::kDartTagId);
943
936 uintptr_t sp = 0; 944 uintptr_t sp = 0;
937 if ((isolate->stub_code() != NULL) && 945
938 (isolate->top_exit_frame_info() == 0) && 946 if (in_dart_code) {
939 (isolate->vm_tag() == VMTag::kDartTagId)) {
940 // If we're in Dart code, use the Dart stack pointer. 947 // If we're in Dart code, use the Dart stack pointer.
941 sp = state.dsp; 948 sp = state.dsp;
942 } else { 949 } else {
943 // If we're in runtime code, use the C stack pointer. 950 // If we're in runtime code, use the C stack pointer.
944 sp = state.csp; 951 sp = state.csp;
945 } 952 }
946 953
947 IsolateProfilerData* profiler_data = isolate->profiler_data(); 954 IsolateProfilerData* profiler_data = isolate->profiler_data();
948 if (profiler_data == NULL) { 955 if (profiler_data == NULL) {
949 // Profiler not initialized. 956 // Profiler not initialized.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 ASSERT(counters != NULL); 1030 ASSERT(counters != NULL);
1024 counters->Increment(vm_tag); 1031 counters->Increment(vm_tag);
1025 sample->set_vm_tag(vm_tag); 1032 sample->set_vm_tag(vm_tag);
1026 sample->set_user_tag(isolate->user_tag()); 1033 sample->set_user_tag(isolate->user_tag());
1027 sample->set_sp(sp); 1034 sample->set_sp(sp);
1028 sample->set_fp(state.fp); 1035 sample->set_fp(state.fp);
1029 sample->set_lr(state.lr); 1036 sample->set_lr(state.lr);
1030 CopyStackBuffer(sample); 1037 CopyStackBuffer(sample);
1031 CopyPCMarkerIfSafe(sample); 1038 CopyPCMarkerIfSafe(sample);
1032 1039
1033 // Walk the call stack.
1034 if (FLAG_profile_vm) { 1040 if (FLAG_profile_vm) {
1035 // Always walk the native stack collecting both native and Dart frames. 1041 // Always walk the native stack collecting both native and Dart frames.
1036 ProfilerNativeStackWalker stackWalker(sample, 1042 ProfilerNativeStackWalker stackWalker(sample,
1037 stack_lower, 1043 stack_lower,
1038 stack_upper, 1044 stack_upper,
1039 state.pc, 1045 state.pc,
1040 state.fp, 1046 state.fp,
1041 sp); 1047 sp);
1042 stackWalker.walk(); 1048 stackWalker.walk();
1049 } else if (exited_dart_code) {
1050 // We have a valid exit frame info, use the Dart stack walker.
1051 ProfilerDartExitStackWalker stackWalker(isolate, sample);
1052 stackWalker.walk();
1053 } else if (in_dart_code) {
1054 // We are executing Dart code. We have frame pointers.
1055 ProfilerDartStackWalker stackWalker(isolate,
1056 sample,
1057 stack_lower,
1058 stack_upper,
1059 state.pc,
1060 state.fp,
1061 sp);
1062 stackWalker.walk();
1043 } else { 1063 } else {
1044 // Attempt to walk only the Dart call stack, falling back to walking 1064 sample->set_vm_tag(VMTag::kEmbedderTagId);
1045 // the native stack. 1065 sample->SetAt(0, state.pc);
1046 if ((isolate->stub_code() != NULL) &&
1047 (isolate->top_exit_frame_info() != 0) &&
1048 (isolate->vm_tag() != VMTag::kDartTagId)) {
1049 // We have a valid exit frame info, use the Dart stack walker.
1050 ProfilerDartExitStackWalker stackWalker(isolate, sample);
1051 stackWalker.walk();
1052 } else if ((isolate->stub_code() != NULL) &&
1053 (isolate->top_exit_frame_info() == 0) &&
1054 (isolate->vm_tag() == VMTag::kDartTagId)) {
1055 // We are executing Dart code. We have frame pointers.
1056 ProfilerDartStackWalker stackWalker(isolate,
1057 sample,
1058 stack_lower,
1059 stack_upper,
1060 state.pc,
1061 state.fp,
1062 sp);
1063 stackWalker.walk();
1064 } else {
1065 #if defined(TARGET_OS_WINDOWS) && defined(TARGET_ARCH_X64)
1066 // ProfilerNativeStackWalker is known to cause crashes on Win64.
1067 // BUG=20423.
1068 sample->set_ignore_sample(true);
1069 #else
1070 // Fall back to an extremely conservative stack walker.
1071 ProfilerNativeStackWalker stackWalker(sample,
1072 stack_lower,
1073 stack_upper,
1074 state.pc,
1075 state.fp,
1076 sp);
1077 stackWalker.walk();
1078 #endif
1079 }
1080 } 1066 }
1081 } 1067 }
1082 1068
1083 } // namespace dart 1069 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698