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 VM_PROFILER_H_ | 5 #ifndef VM_PROFILER_H_ |
6 #define VM_PROFILER_H_ | 6 #define VM_PROFILER_H_ |
7 | 7 |
8 #include "platform/hashmap.h" | 8 #include "platform/hashmap.h" |
9 #include "platform/thread.h" | 9 #include "platform/thread.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 set_cpu_usage(cpu_usage); | 102 set_cpu_usage(cpu_usage); |
103 return delta; | 103 return delta; |
104 } | 104 } |
105 | 105 |
106 ThreadId thread_id() const { return thread_id_; } | 106 ThreadId thread_id() const { return thread_id_; } |
107 | 107 |
108 Isolate* isolate() const { return isolate_; } | 108 Isolate* isolate() const { return isolate_; } |
109 | 109 |
110 SampleBuffer* sample_buffer() const { return sample_buffer_; } | 110 SampleBuffer* sample_buffer() const { return sample_buffer_; } |
111 | 111 |
| 112 void set_sample_buffer(SampleBuffer* sample_buffer) { |
| 113 sample_buffer_ = sample_buffer; |
| 114 } |
| 115 |
112 private: | 116 private: |
113 int64_t last_sampled_micros_; | 117 int64_t last_sampled_micros_; |
114 int64_t timer_expiration_micros_; | 118 int64_t timer_expiration_micros_; |
115 int64_t sample_interval_micros_; | 119 int64_t sample_interval_micros_; |
116 int64_t cpu_usage_; | 120 int64_t cpu_usage_; |
117 ThreadId thread_id_; | 121 ThreadId thread_id_; |
118 Isolate* isolate_; | 122 Isolate* isolate_; |
119 SampleBuffer* sample_buffer_; | 123 SampleBuffer* sample_buffer_; |
120 DISALLOW_COPY_AND_ASSIGN(IsolateProfilerData); | 124 DISALLOW_COPY_AND_ASSIGN(IsolateProfilerData); |
121 }; | 125 }; |
(...skipping 14 matching lines...) Expand all Loading... |
136 uintptr_t pcs[kNumStackFrames]; | 140 uintptr_t pcs[kNumStackFrames]; |
137 uint16_t vm_tags; | 141 uint16_t vm_tags; |
138 uint16_t runtime_tags; | 142 uint16_t runtime_tags; |
139 Sample(); | 143 Sample(); |
140 }; | 144 }; |
141 | 145 |
142 | 146 |
143 // Ring buffer of samples. One per isolate. | 147 // Ring buffer of samples. One per isolate. |
144 class SampleBuffer { | 148 class SampleBuffer { |
145 public: | 149 public: |
146 static const intptr_t kDefaultBufferCapacity = 1000000; | 150 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz. |
147 | 151 |
148 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity); | 152 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity); |
149 ~SampleBuffer(); | 153 ~SampleBuffer(); |
150 | 154 |
151 intptr_t capacity() const { return capacity_; } | 155 intptr_t capacity() const { return capacity_; } |
152 | 156 |
153 Sample* ReserveSample(); | 157 Sample* ReserveSample(); |
154 | 158 |
155 Sample* FirstSample() const; | 159 Sample* FirstSample() const; |
156 Sample* NextSample(Sample* sample) const; | 160 Sample* NextSample(Sample* sample) const; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 const uintptr_t original_pc_; | 195 const uintptr_t original_pc_; |
192 const uintptr_t original_fp_; | 196 const uintptr_t original_fp_; |
193 const uintptr_t original_sp_; | 197 const uintptr_t original_sp_; |
194 uintptr_t lower_bound_; | 198 uintptr_t lower_bound_; |
195 }; | 199 }; |
196 | 200 |
197 | 201 |
198 } // namespace dart | 202 } // namespace dart |
199 | 203 |
200 #endif // VM_PROFILER_H_ | 204 #endif // VM_PROFILER_H_ |
OLD | NEW |