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

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

Issue 136293004: Ensure Sample instance_size is always set. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | 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/utils.h" 5 #include "platform/utils.h"
6 6
7 #include "vm/allocation.h" 7 #include "vm/allocation.h"
8 #include "vm/atomic.h" 8 #include "vm/atomic.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 22 matching lines...) Expand all
33 DEFINE_FLAG(int, profile_depth, 8, 33 DEFINE_FLAG(int, profile_depth, 8,
34 "Maximum number stack frames walked. Minimum 1. Maximum 128."); 34 "Maximum number stack frames walked. Minimum 1. Maximum 128.");
35 35
36 bool Profiler::initialized_ = false; 36 bool Profiler::initialized_ = false;
37 SampleBuffer* Profiler::sample_buffer_ = NULL; 37 SampleBuffer* Profiler::sample_buffer_ = NULL;
38 38
39 void Profiler::InitOnce() { 39 void Profiler::InitOnce() {
40 const int kMinimumProfilePeriod = 250; 40 const int kMinimumProfilePeriod = 250;
41 const int kMinimumDepth = 1; 41 const int kMinimumDepth = 1;
42 const int kMaximumDepth = 128; 42 const int kMaximumDepth = 128;
43 if (!FLAG_profile) {
44 return;
45 }
46 ASSERT(!initialized_);
47 // Place some sane restrictions on user controlled flags. 43 // Place some sane restrictions on user controlled flags.
48 if (FLAG_profile_period < kMinimumProfilePeriod) { 44 if (FLAG_profile_period < kMinimumProfilePeriod) {
49 FLAG_profile_period = kMinimumProfilePeriod; 45 FLAG_profile_period = kMinimumProfilePeriod;
50 } 46 }
51 if (FLAG_profile_depth < kMinimumDepth) { 47 if (FLAG_profile_depth < kMinimumDepth) {
52 FLAG_profile_depth = kMinimumDepth; 48 FLAG_profile_depth = kMinimumDepth;
53 } else if (FLAG_profile_depth > kMaximumDepth) { 49 } else if (FLAG_profile_depth > kMaximumDepth) {
54 FLAG_profile_depth = kMaximumDepth; 50 FLAG_profile_depth = kMaximumDepth;
55 } 51 }
56 Sample::InitOnce(); 52 Sample::InitOnce();
53 if (!FLAG_profile) {
54 return;
55 }
56 ASSERT(!initialized_);
57 sample_buffer_ = new SampleBuffer(); 57 sample_buffer_ = new SampleBuffer();
58 NativeSymbolResolver::InitOnce(); 58 NativeSymbolResolver::InitOnce();
59 ThreadInterrupter::InitOnce(); 59 ThreadInterrupter::InitOnce();
60 ThreadInterrupter::SetInterruptPeriod(FLAG_profile_period); 60 ThreadInterrupter::SetInterruptPeriod(FLAG_profile_period);
61 initialized_ = true; 61 initialized_ = true;
62 } 62 }
63 63
64 64
65 void Profiler::Shutdown() { 65 void Profiler::Shutdown() {
66 if (!FLAG_profile) { 66 if (!FLAG_profile) {
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return false; 829 return false;
830 } 830 }
831 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); 831 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp);
832 cursor += sizeof(fp); 832 cursor += sizeof(fp);
833 bool r = cursor >= lower_bound_ && cursor < stack_upper_; 833 bool r = cursor >= lower_bound_ && cursor < stack_upper_;
834 return r; 834 return r;
835 } 835 }
836 836
837 837
838 } // namespace dart 838 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698