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 RUNTIME_VM_PROFILER_H_ | 5 #ifndef RUNTIME_VM_PROFILER_H_ |
6 #define RUNTIME_VM_PROFILER_H_ | 6 #define RUNTIME_VM_PROFILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/bitfield.h" | 9 #include "vm/bitfield.h" |
10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 DISALLOW_COPY_AND_ASSIGN(CodeLookupTable); | 514 DISALLOW_COPY_AND_ASSIGN(CodeLookupTable); |
515 }; | 515 }; |
516 | 516 |
517 | 517 |
518 // Ring buffer of Samples that is (usually) shared by many isolates. | 518 // Ring buffer of Samples that is (usually) shared by many isolates. |
519 class SampleBuffer { | 519 class SampleBuffer { |
520 public: | 520 public: |
521 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz. | 521 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz. |
522 | 522 |
523 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity); | 523 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity); |
524 | 524 ~SampleBuffer(); |
525 ~SampleBuffer() { | |
526 if (samples_ != NULL) { | |
527 free(samples_); | |
528 samples_ = NULL; | |
529 cursor_ = 0; | |
530 capacity_ = 0; | |
531 } | |
532 } | |
533 | 525 |
534 intptr_t capacity() const { return capacity_; } | 526 intptr_t capacity() const { return capacity_; } |
535 | 527 |
536 Sample* At(intptr_t idx) const; | 528 Sample* At(intptr_t idx) const; |
537 intptr_t ReserveSampleSlot(); | 529 intptr_t ReserveSampleSlot(); |
538 Sample* ReserveSample(); | 530 Sample* ReserveSample(); |
539 Sample* ReserveSampleAndLink(Sample* previous); | 531 Sample* ReserveSampleAndLink(Sample* previous); |
540 | 532 |
541 void VisitSamples(SampleVisitor* visitor) { | 533 void VisitSamples(SampleVisitor* visitor) { |
542 ASSERT(visitor != NULL); | 534 ASSERT(visitor != NULL); |
(...skipping 25 matching lines...) Expand all Loading... |
568 } | 560 } |
569 } | 561 } |
570 | 562 |
571 ProcessedSampleBuffer* BuildProcessedSampleBuffer(SampleFilter* filter); | 563 ProcessedSampleBuffer* BuildProcessedSampleBuffer(SampleFilter* filter); |
572 | 564 |
573 private: | 565 private: |
574 ProcessedSample* BuildProcessedSample(Sample* sample, | 566 ProcessedSample* BuildProcessedSample(Sample* sample, |
575 const CodeLookupTable& clt); | 567 const CodeLookupTable& clt); |
576 Sample* Next(Sample* sample); | 568 Sample* Next(Sample* sample); |
577 | 569 |
| 570 VirtualMemory* memory_; |
578 Sample* samples_; | 571 Sample* samples_; |
579 intptr_t capacity_; | 572 intptr_t capacity_; |
580 uintptr_t cursor_; | 573 uintptr_t cursor_; |
581 | 574 |
582 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); | 575 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); |
583 }; | 576 }; |
584 | 577 |
585 | 578 |
586 // A |ProcessedSample| is a combination of 1 (or more) |Sample|(s) that have | 579 // A |ProcessedSample| is a combination of 1 (or more) |Sample|(s) that have |
587 // been merged into a logical sample. The raw data may have been processed to | 580 // been merged into a logical sample. The raw data may have been processed to |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 private: | 692 private: |
700 ZoneGrowableArray<ProcessedSample*> samples_; | 693 ZoneGrowableArray<ProcessedSample*> samples_; |
701 CodeLookupTable* code_lookup_table_; | 694 CodeLookupTable* code_lookup_table_; |
702 | 695 |
703 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 696 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
704 }; | 697 }; |
705 | 698 |
706 } // namespace dart | 699 } // namespace dart |
707 | 700 |
708 #endif // RUNTIME_VM_PROFILER_H_ | 701 #endif // RUNTIME_VM_PROFILER_H_ |
OLD | NEW |