Flutter Engine
The Flutter Engine
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 728 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 670 of file profiler.cc.

671 {
672 const intptr_t size = Utils::RoundUp(
673 blocks * samples_per_block * sizeof(Sample), VirtualMemory::PageSize());
674 const bool executable = false;
675 const bool compressed = false;
676 memory_ =
677 VirtualMemory::Allocate(size, executable, compressed, "dart-profiler");
678 if (memory_ == nullptr) {
680 }
681 sample_buffer_ = reinterpret_cast<Sample*>(memory_->address());
682 blocks_ = new SampleBlock[blocks];
683 for (intptr_t i = 0; i < blocks; ++i) {
684 blocks_[i].Init(&sample_buffer_[i * samples_per_block], samples_per_block);
685 }
686 capacity_ = blocks;
687 cursor_ = 0;
688}
#define OUT_OF_MEMORY()
Definition: assert.h:250
virtual void Init(Sample *samples, intptr_t capacity)
Definition: profiler.h:570
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition: utils.h:120
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 690 of file profiler.cc.

690 {
691 delete[] blocks_;
692 blocks_ = nullptr;
693 delete memory_;
694 memory_ = nullptr;
695 capacity_ = 0;
696 cursor_ = 0;
697}

Member Function Documentation

◆ BuildProcessedSampleBuffer()

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

Definition at line 761 of file profiler.cc.

764 {
765 ASSERT(isolate != nullptr);
766
767 Thread* thread = Thread::Current();
768 Zone* zone = thread->zone();
769
770 if (buffer == nullptr) {
771 buffer = new (zone) ProcessedSampleBuffer();
772 }
773
774 FlushSampleBlocks(isolate);
775
776 for (intptr_t i = 0; i < capacity_; ++i) {
777 SampleBlock* block = &blocks_[i];
778 if (block->TryAcquireStreaming(isolate)) {
779 block->BuildProcessedSampleBuffer(filter, buffer);
780 if (filter->take_samples()) {
781 block->StreamingToFree();
782 } else {
783 block->StreamingToCompleted();
784 }
785 }
786 }
787
788 return buffer;
789}
ProcessedSampleBuffer * BuildProcessedSampleBuffer(SampleFilter *filter, ProcessedSampleBuffer *buffer=nullptr)
Definition: profiler.cc:1580
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)
static void FlushSampleBlocks(Isolate *isolate)
Definition: profiler.cc:745
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ FreeCompletedBlocks()

void dart::SampleBlockBuffer::FreeCompletedBlocks ( )

Definition at line 724 of file profiler.cc.

724 {
725 for (intptr_t i = 0; i < capacity_; i++) {
726 blocks_[i].FreeCompleted();
727 }
728}
void FreeCompleted()
Definition: profiler.h:697

◆ ReserveAllocationSample()

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

Definition at line 821 of file profiler.cc.

821 {
822 return ReserveSampleImpl(isolate, true);
823}

◆ ReserveCPUSample()

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

Definition at line 817 of file profiler.cc.

817 {
818 return ReserveSampleImpl(isolate, false);
819}

◆ Size()

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

Definition at line 761 of file profiler.h.

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

◆ VisitSamples()

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

Definition at line 742 of file profiler.h.

742 {
743 ASSERT(visitor != nullptr);
744 for (intptr_t i = 0; i < capacity_; ++i) {
745 blocks_[i].VisitSamples(visitor);
746 }
747 }
void VisitSamples(SampleVisitor *visitor)
Definition: profiler.h:577

Friends And Related Function Documentation

◆ Isolate

friend class Isolate
friend

Definition at line 783 of file profiler.h.

Member Data Documentation

◆ kDefaultBlockCount

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

Definition at line 730 of file profiler.h.


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