Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Friends | List of all members
dart::SampleBlockBuffer Class Reference

#include <profiler.h>

Public Member Functions

 SampleBlockBuffer (intptr_t blocks=kDefaultBlockCount, intptr_t samples_per_block=SampleBlock::kSamplesPerBlock)
 
virtual ~SampleBlockBuffer ()
 
void VisitSamples (SampleVisitor *visitor)
 
void FreeCompletedBlocks ()
 
SampleReserveCPUSample (Isolate *isolate)
 
SampleReserveAllocationSample (Isolate *isolate)
 
intptr_t Size () const
 
ProcessedSampleBufferBuildProcessedSampleBuffer (Isolate *isolate, SampleFilter *filter, ProcessedSampleBuffer *buffer=nullptr)
 

Static Public Attributes

static constexpr intptr_t kDefaultBlockCount = 600
 

Friends

class Isolate
 

Detailed Description

Definition at line 735 of file profiler.h.

Constructor & Destructor Documentation

◆ SampleBlockBuffer()

dart::SampleBlockBuffer::SampleBlockBuffer ( intptr_t  blocks = kDefaultBlockCount,
intptr_t  samples_per_block = SampleBlock::kSamplesPerBlock 
)
explicit

Definition at line 664 of file profiler.cc.

665 {
666 const intptr_t size = Utils::RoundUp(
667 blocks * samples_per_block * sizeof(Sample), VirtualMemory::PageSize());
668 const bool executable = false;
669 const bool compressed = false;
670 memory_ =
671 VirtualMemory::Allocate(size, executable, compressed, "dart-profiler");
672 if (memory_ == nullptr) {
674 }
675 sample_buffer_ = reinterpret_cast<Sample*>(memory_->address());
676 blocks_ = new SampleBlock[blocks];
677 for (intptr_t i = 0; i < blocks; ++i) {
678 blocks_[i].Init(&sample_buffer_[i * samples_per_block], samples_per_block);
679 }
680 capacity_ = blocks;
681 cursor_ = 0;
682}
#define OUT_OF_MEMORY()
Definition assert.h:250
virtual void Init(Sample *samples, intptr_t capacity)
Definition profiler.h:577
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition utils.h:105
static intptr_t PageSize()
static VirtualMemory * Allocate(intptr_t size, bool is_executable, bool is_compressed, const char *name)
void * address() const
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

◆ ~SampleBlockBuffer()

dart::SampleBlockBuffer::~SampleBlockBuffer ( )
virtual

Definition at line 684 of file profiler.cc.

684 {
685 delete[] blocks_;
686 blocks_ = nullptr;
687 delete memory_;
688 memory_ = nullptr;
689 capacity_ = 0;
690 cursor_ = 0;
691}

Member Function Documentation

◆ BuildProcessedSampleBuffer()

ProcessedSampleBuffer * dart::SampleBlockBuffer::BuildProcessedSampleBuffer ( Isolate isolate,
SampleFilter filter,
ProcessedSampleBuffer buffer = nullptr 
)

Definition at line 755 of file profiler.cc.

758 {
759 ASSERT(isolate != nullptr);
760
761 Thread* thread = Thread::Current();
762 Zone* zone = thread->zone();
763
764 if (buffer == nullptr) {
765 buffer = new (zone) ProcessedSampleBuffer();
766 }
767
768 FlushSampleBlocks(isolate);
769
770 for (intptr_t i = 0; i < capacity_; ++i) {
771 SampleBlock* block = &blocks_[i];
772 if (block->TryAcquireStreaming(isolate)) {
773 block->BuildProcessedSampleBuffer(filter, buffer);
774 if (filter->take_samples()) {
775 block->StreamingToFree();
776 } else {
777 block->StreamingToCompleted();
778 }
779 }
780 }
781
782 return buffer;
783}
ProcessedSampleBuffer * BuildProcessedSampleBuffer(SampleFilter *filter, ProcessedSampleBuffer *buffer=nullptr)
Definition profiler.cc:1574
static Thread * Current()
Definition thread.h:361
#define ASSERT(E)
static const uint8_t buffer[]
static void FlushSampleBlocks(Isolate *isolate)
Definition profiler.cc:739

◆ FreeCompletedBlocks()

void dart::SampleBlockBuffer::FreeCompletedBlocks ( )

Definition at line 718 of file profiler.cc.

718 {
719 for (intptr_t i = 0; i < capacity_; i++) {
720 blocks_[i].FreeCompleted();
721 }
722}
void FreeCompleted()
Definition profiler.h:704

◆ ReserveAllocationSample()

Sample * dart::SampleBlockBuffer::ReserveAllocationSample ( Isolate isolate)

Definition at line 815 of file profiler.cc.

815 {
816 return ReserveSampleImpl(isolate, true);
817}

◆ ReserveCPUSample()

Sample * dart::SampleBlockBuffer::ReserveCPUSample ( Isolate isolate)

Definition at line 811 of file profiler.cc.

811 {
812 return ReserveSampleImpl(isolate, false);
813}

◆ Size()

intptr_t dart::SampleBlockBuffer::Size ( ) const
inline

Definition at line 768 of file profiler.h.

768{ return memory_->size(); }
intptr_t size() const

◆ VisitSamples()

void dart::SampleBlockBuffer::VisitSamples ( SampleVisitor visitor)
inline

Definition at line 749 of file profiler.h.

749 {
750 ASSERT(visitor != nullptr);
751 for (intptr_t i = 0; i < capacity_; ++i) {
752 blocks_[i].VisitSamples(visitor);
753 }
754 }
void VisitSamples(SampleVisitor *visitor)
Definition profiler.h:584

Friends And Related Symbol Documentation

◆ Isolate

friend class Isolate
friend

Definition at line 790 of file profiler.h.

Member Data Documentation

◆ kDefaultBlockCount

constexpr intptr_t dart::SampleBlockBuffer::kDefaultBlockCount = 600
staticconstexpr

Definition at line 737 of file profiler.h.


The documentation for this class was generated from the following files: