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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/code_observers.h" | 9 #include "vm/code_observers.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 | 235 |
236 bool ignore_sample() const { | 236 bool ignore_sample() const { |
237 return IgnoreBit::decode(state_); | 237 return IgnoreBit::decode(state_); |
238 } | 238 } |
239 | 239 |
240 void set_ignore_sample(bool ignore_sample) { | 240 void set_ignore_sample(bool ignore_sample) { |
241 state_ = IgnoreBit::update(ignore_sample, state_); | 241 state_ = IgnoreBit::update(ignore_sample, state_); |
242 } | 242 } |
243 | 243 |
| 244 bool exit_frame_sample() const { |
| 245 return ExitFrameBit::decode(state_); |
| 246 } |
| 247 |
| 248 void set_exit_frame_sample(bool exit_frame_sample) { |
| 249 state_ = ExitFrameBit::update(exit_frame_sample, state_); |
| 250 } |
| 251 |
244 static void InitOnce(); | 252 static void InitOnce(); |
245 | 253 |
246 static intptr_t instance_size() { | 254 static intptr_t instance_size() { |
247 return instance_size_; | 255 return instance_size_; |
248 } | 256 } |
249 | 257 |
250 uword* GetPCArray() const; | 258 uword* GetPCArray() const; |
251 | 259 |
252 private: | 260 private: |
253 static intptr_t instance_size_; | 261 static intptr_t instance_size_; |
254 static intptr_t pcs_length_; | 262 static intptr_t pcs_length_; |
255 enum StateBits { | 263 enum StateBits { |
256 kProcessedBit = 0, | 264 kProcessedBit = 0, |
257 kLeafFrameIsDartBit = 1, | 265 kLeafFrameIsDartBit = 1, |
258 kIgnoreBit = 2, | 266 kIgnoreBit = 2, |
| 267 kExitFrameBit = 3, |
259 }; | 268 }; |
260 class ProcessedBit : public BitField<bool, kProcessedBit, 1> {}; | 269 class ProcessedBit : public BitField<bool, kProcessedBit, 1> {}; |
261 class LeafFrameIsDart : public BitField<bool, kLeafFrameIsDartBit, 1> {}; | 270 class LeafFrameIsDart : public BitField<bool, kLeafFrameIsDartBit, 1> {}; |
262 class IgnoreBit : public BitField<bool, kIgnoreBit, 1> {}; | 271 class IgnoreBit : public BitField<bool, kIgnoreBit, 1> {}; |
| 272 class ExitFrameBit : public BitField<bool, kExitFrameBit, 1> {}; |
263 | 273 |
264 int64_t timestamp_; | 274 int64_t timestamp_; |
265 ThreadId tid_; | 275 ThreadId tid_; |
266 Isolate* isolate_; | 276 Isolate* isolate_; |
267 uword pc_marker_; | 277 uword pc_marker_; |
268 uword vm_tag_; | 278 uword vm_tag_; |
269 uword user_tag_; | 279 uword user_tag_; |
270 uword sp_; | 280 uword sp_; |
271 uword fp_; | 281 uword fp_; |
272 uword state_; | 282 uword state_; |
(...skipping 24 matching lines...) Expand all Loading... |
297 intptr_t capacity() const { return capacity_; } | 307 intptr_t capacity() const { return capacity_; } |
298 | 308 |
299 Sample* At(intptr_t idx) const; | 309 Sample* At(intptr_t idx) const; |
300 Sample* ReserveSample(); | 310 Sample* ReserveSample(); |
301 | 311 |
302 void VisitSamples(SampleVisitor* visitor) { | 312 void VisitSamples(SampleVisitor* visitor) { |
303 ASSERT(visitor != NULL); | 313 ASSERT(visitor != NULL); |
304 const intptr_t length = capacity(); | 314 const intptr_t length = capacity(); |
305 for (intptr_t i = 0; i < length; i++) { | 315 for (intptr_t i = 0; i < length; i++) { |
306 Sample* sample = At(i); | 316 Sample* sample = At(i); |
| 317 if (sample->ignore_sample()) { |
| 318 // Bad sample. |
| 319 continue; |
| 320 } |
307 if (sample->isolate() != visitor->isolate()) { | 321 if (sample->isolate() != visitor->isolate()) { |
308 // Another isolate. | 322 // Another isolate. |
309 continue; | 323 continue; |
310 } | 324 } |
311 if (sample->timestamp() == 0) { | 325 if (sample->timestamp() == 0) { |
312 // Empty. | 326 // Empty. |
313 continue; | 327 continue; |
314 } | 328 } |
315 if (sample->At(0) == 0) { | 329 if (sample->At(0) == 0) { |
316 // No frames. | 330 // No frames. |
317 continue; | 331 continue; |
318 } | 332 } |
319 visitor->IncrementVisited(); | 333 visitor->IncrementVisited(); |
320 visitor->VisitSample(sample); | 334 visitor->VisitSample(sample); |
321 } | 335 } |
322 } | 336 } |
323 | 337 |
324 private: | 338 private: |
325 Sample* samples_; | 339 Sample* samples_; |
326 intptr_t capacity_; | 340 intptr_t capacity_; |
327 uintptr_t cursor_; | 341 uintptr_t cursor_; |
328 | 342 |
329 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); | 343 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); |
330 }; | 344 }; |
331 | 345 |
332 | 346 |
333 } // namespace dart | 347 } // namespace dart |
334 | 348 |
335 #endif // VM_PROFILER_H_ | 349 #endif // VM_PROFILER_H_ |
OLD | NEW |