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

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

Issue 1411703004: Pass Thread into StackFrameIterator (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | runtime/vm/stack_frame.h » ('j') | runtime/vm/stack_frame.h » ('J')
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 Sample* sample_; 462 Sample* sample_;
463 SampleBuffer* sample_buffer_; 463 SampleBuffer* sample_buffer_;
464 intptr_t frame_index_; 464 intptr_t frame_index_;
465 intptr_t total_frames_; 465 intptr_t total_frames_;
466 }; 466 };
467 467
468 468
469 // Given an exit frame, walk the Dart stack. 469 // Given an exit frame, walk the Dart stack.
470 class ProfilerDartExitStackWalker : public ProfilerStackWalker { 470 class ProfilerDartExitStackWalker : public ProfilerStackWalker {
471 public: 471 public:
472 ProfilerDartExitStackWalker(Isolate* isolate, 472 ProfilerDartExitStackWalker(Thread* thread,
473 Isolate* isolate,
473 Sample* sample, 474 Sample* sample,
474 SampleBuffer* sample_buffer) 475 SampleBuffer* sample_buffer)
475 : ProfilerStackWalker(isolate, sample, sample_buffer), 476 : ProfilerStackWalker(isolate, sample, sample_buffer),
476 frame_iterator_(isolate) { 477 frame_iterator_(isolate, thread) {
477 } 478 }
478 479
479 void walk() { 480 void walk() {
480 // Mark that this sample was collected from an exit frame. 481 // Mark that this sample was collected from an exit frame.
481 sample_->set_exit_frame_sample(true); 482 sample_->set_exit_frame_sample(true);
482 483
483 StackFrame* frame = frame_iterator_.NextFrame(); 484 StackFrame* frame = frame_iterator_.NextFrame();
484 while (frame != NULL) { 485 while (frame != NULL) {
485 if (!Append(frame->pc())) { 486 if (!Append(frame->pc())) {
486 return; 487 return;
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 stack_upper, 1046 stack_upper,
1046 pc, 1047 pc,
1047 fp, 1048 fp,
1048 sp); 1049 sp);
1049 native_stack_walker.walk(); 1050 native_stack_walker.walk();
1050 } else if (exited_dart_code) { 1051 } else if (exited_dart_code) {
1051 Sample* sample = SetupSample(thread, 1052 Sample* sample = SetupSample(thread,
1052 sample_buffer, 1053 sample_buffer,
1053 OSThread::GetCurrentThreadId()); 1054 OSThread::GetCurrentThreadId());
1054 sample->SetAllocationCid(cid); 1055 sample->SetAllocationCid(cid);
1055 ProfilerDartExitStackWalker dart_exit_stack_walker(isolate, 1056 ProfilerDartExitStackWalker dart_exit_stack_walker(thread,
1057 isolate,
1056 sample, 1058 sample,
1057 sample_buffer); 1059 sample_buffer);
1058 dart_exit_stack_walker.walk(); 1060 dart_exit_stack_walker.walk();
1059 } else { 1061 } else {
1060 // Fall back. 1062 // Fall back.
1061 uintptr_t pc = GetProgramCounter(); 1063 uintptr_t pc = GetProgramCounter();
1062 Sample* sample = SetupSample(thread, 1064 Sample* sample = SetupSample(thread,
1063 sample_buffer, 1065 sample_buffer,
1064 OSThread::GetCurrentThreadId()); 1066 OSThread::GetCurrentThreadId());
1065 sample->SetAllocationCid(cid); 1067 sample->SetAllocationCid(cid);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1149
1148 ProfilerNativeStackWalker native_stack_walker(isolate, 1150 ProfilerNativeStackWalker native_stack_walker(isolate,
1149 sample, 1151 sample,
1150 sample_buffer, 1152 sample_buffer,
1151 stack_lower, 1153 stack_lower,
1152 stack_upper, 1154 stack_upper,
1153 pc, 1155 pc,
1154 fp, 1156 fp,
1155 sp); 1157 sp);
1156 1158
1157 ProfilerDartExitStackWalker dart_exit_stack_walker(isolate, 1159 ProfilerDartExitStackWalker dart_exit_stack_walker(thread,
1160 isolate,
1158 sample, 1161 sample,
1159 sample_buffer); 1162 sample_buffer);
1160 1163
1161 ProfilerDartStackWalker dart_stack_walker(isolate, 1164 ProfilerDartStackWalker dart_stack_walker(isolate,
1162 sample, 1165 sample,
1163 sample_buffer, 1166 sample_buffer,
1164 stack_lower, 1167 stack_lower,
1165 stack_upper, 1168 stack_upper,
1166 pc, 1169 pc,
1167 fp, 1170 fp,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 uword pc) { 1394 uword pc) {
1392 return vm_isolate->heap()->CodeContains(pc) 1395 return vm_isolate->heap()->CodeContains(pc)
1393 || isolate->heap()->CodeContains(pc); 1396 || isolate->heap()->CodeContains(pc);
1394 } 1397 }
1395 1398
1396 1399
1397 ProcessedSampleBuffer::ProcessedSampleBuffer() { 1400 ProcessedSampleBuffer::ProcessedSampleBuffer() {
1398 } 1401 }
1399 1402
1400 } // namespace dart 1403 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/stack_frame.h » ('j') | runtime/vm/stack_frame.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698