v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
cppgc::internal::StatsCollector Class Referencefinal

#include <stats-collector.h>

Collaboration diagram for cppgc::internal::StatsCollector:

Classes

class  AllocationObserver
 
struct  Event
 
class  InternalScope
 

Public Types

enum  ScopeId { kNumHistogramScopeIds , kNumScopeIds }
 
enum  ConcurrentScopeId { kNumHistogramConcurrentScopeIds , kNumConcurrentScopeIds }
 
using MarkingType = GCConfig::MarkingType
 
using SweepingType = GCConfig::SweepingType
 
using DisabledScope = InternalScope<kDisabled, kMutatorThread>
 
using EnabledScope = InternalScope<kEnabled, kMutatorThread>
 
using DisabledConcurrentScope = InternalScope<kDisabled, kConcurrentThread>
 
using EnabledConcurrentScope = InternalScope<kEnabled, kConcurrentThread>
 

Public Member Functions

 StatsCollector (Platform *)
 
 StatsCollector (const StatsCollector &)=delete
 
StatsCollectoroperator= (const StatsCollector &)=delete
 
void RegisterObserver (AllocationObserver *)
 
void UnregisterObserver (AllocationObserver *)
 
void NotifyAllocation (size_t)
 
void NotifyExplicitFree (size_t)
 
void NotifySafePointForConservativeCollection ()
 
void NotifySafePointForTesting ()
 
void NotifyUnmarkingStarted (CollectionType)
 
void NotifyMarkingStarted (CollectionType, MarkingType, IsForcedGC)
 
void NotifyMarkingCompleted (size_t marked_bytes)
 
void NotifySweepingCompleted (SweepingType)
 
size_t allocated_memory_size () const
 
size_t allocated_object_size () const
 
size_t marked_bytes () const
 
size_t marked_bytes_on_current_cycle () const
 
v8::base::TimeDelta marking_time () const
 
double GetRecentAllocationSpeedInBytesPerMs () const
 
const EventGetPreviousEventForTesting () const
 
void NotifyAllocatedMemory (int64_t)
 
void NotifyFreedMemory (int64_t)
 
void IncrementDiscardedMemory (size_t)
 
void DecrementDiscardedMemory (size_t)
 
void ResetDiscardedMemory ()
 
size_t discarded_memory_size () const
 
size_t resident_memory_size () const
 
void SetMetricRecorder (std::unique_ptr< MetricRecorder > histogram_recorder)
 
MetricRecorderGetMetricRecorder () const
 

Static Public Attributes

static constexpr size_t kAllocationThresholdBytes = 1024
 

Private Types

enum  TraceCategory { kEnabled , kDisabled }
 
enum  ScopeContext { kMutatorThread , kConcurrentThread }
 
enum class  GarbageCollectionState : uint8_t { kNotRunning , kUnmarking , kMarking , kSweeping }
 
using IsForcedGC = GCConfig::IsForcedGC
 

Private Member Functions

void RecordHistogramSample (ScopeId, v8::base::TimeDelta)
 
void RecordHistogramSample (ConcurrentScopeId, v8::base::TimeDelta)
 
template<typename Callback >
void ForAllAllocationObservers (Callback callback)
 
void AllocatedObjectSizeSafepointImpl ()
 

Static Private Member Functions

static constexpr const char * GetScopeName (ScopeId id, CollectionType type)
 
static constexpr const char * GetScopeName (ConcurrentScopeId id, CollectionType type)
 

Private Attributes

int64_t allocated_bytes_since_end_of_marking_ = 0
 
v8::base::TimeTicks time_of_last_end_of_marking_ = v8::base::TimeTicks::Now()
 
int64_t allocated_bytes_since_safepoint_ = 0
 
int64_t explicitly_freed_bytes_since_safepoint_ = 0
 
size_t marked_bytes_so_far_ = 0
 
int64_t memory_allocated_bytes_ = 0
 
int64_t memory_freed_bytes_since_end_of_marking_ = 0
 
std::atomic< size_t > discarded_bytes_ {0}
 
std::vector< AllocationObserver * > allocation_observers_
 
bool allocation_observer_deleted_ = false
 
GarbageCollectionState gc_state_ = GarbageCollectionState::kNotRunning
 
Event current_
 
Event previous_
 
std::unique_ptr< MetricRecordermetric_recorder_
 
Platformplatform_
 

Detailed Description

Definition at line 84 of file stats-collector.h.

Member Typedef Documentation

◆ DisabledConcurrentScope

◆ DisabledScope

◆ EnabledConcurrentScope

◆ EnabledScope

◆ IsForcedGC

◆ MarkingType

◆ SweepingType

Member Enumeration Documentation

◆ ConcurrentScopeId

Enumerator
kNumHistogramConcurrentScopeIds 
kNumConcurrentScopeIds 

Definition at line 104 of file stats-collector.h.

◆ GarbageCollectionState

enum class cppgc::internal::StatsCollector::GarbageCollectionState : uint8_t
strongprivate
Enumerator
kNotRunning 
kUnmarking 
kMarking 
kSweeping 

Definition at line 341 of file stats-collector.h.

◆ ScopeContext

Enumerator
kMutatorThread 
kConcurrentThread 

Definition at line 170 of file stats-collector.h.

◆ ScopeId

Enumerator
kNumHistogramScopeIds 
kNumScopeIds 

Definition at line 95 of file stats-collector.h.

◆ TraceCategory

Enumerator
kEnabled 
kDisabled 

Definition at line 169 of file stats-collector.h.

Constructor & Destructor Documentation

◆ StatsCollector() [1/2]

cppgc::internal::StatsCollector::StatsCollector ( Platform * platform)
explicit

Definition at line 22 of file stats-collector.cc.

◆ StatsCollector() [2/2]

cppgc::internal::StatsCollector::StatsCollector ( const StatsCollector & )
delete

Member Function Documentation

◆ allocated_memory_size()

size_t cppgc::internal::StatsCollector::allocated_memory_size ( ) const

Definition at line 296 of file stats-collector.cc.

Here is the caller graph for this function:

◆ allocated_object_size()

size_t cppgc::internal::StatsCollector::allocated_object_size ( ) const

Definition at line 300 of file stats-collector.cc.

Here is the caller graph for this function:

◆ AllocatedObjectSizeSafepointImpl()

void cppgc::internal::StatsCollector::AllocatedObjectSizeSafepointImpl ( )
private

Definition at line 72 of file stats-collector.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecrementDiscardedMemory()

void cppgc::internal::StatsCollector::DecrementDiscardedMemory ( size_t value)

Definition at line 361 of file stats-collector.cc.

Here is the caller graph for this function:

◆ discarded_memory_size()

size_t cppgc::internal::StatsCollector::discarded_memory_size ( ) const

Definition at line 372 of file stats-collector.cc.

Here is the caller graph for this function:

◆ ForAllAllocationObservers()

template<typename Callback >
void cppgc::internal::StatsCollector::ForAllAllocationObservers ( Callback callback)
private

Definition at line 402 of file stats-collector.h.

Here is the caller graph for this function:

◆ GetMetricRecorder()

MetricRecorder * cppgc::internal::StatsCollector::GetMetricRecorder ( ) const
inline

Definition at line 338 of file stats-collector.h.

◆ GetPreviousEventForTesting()

const Event & cppgc::internal::StatsCollector::GetPreviousEventForTesting ( ) const
inline

Definition at line 323 of file stats-collector.h.

◆ GetRecentAllocationSpeedInBytesPerMs()

double cppgc::internal::StatsCollector::GetRecentAllocationSpeedInBytesPerMs ( ) const

Definition at line 162 of file stats-collector.cc.

Here is the call graph for this function:

◆ GetScopeName() [1/2]

static constexpr const char * cppgc::internal::StatsCollector::GetScopeName ( ConcurrentScopeId id,
CollectionType type )
inlinestaticconstexprprivate

Definition at line 154 of file stats-collector.h.

◆ GetScopeName() [2/2]

static constexpr const char * cppgc::internal::StatsCollector::GetScopeName ( ScopeId id,
CollectionType type )
inlinestaticconstexprprivate

Definition at line 140 of file stats-collector.h.

◆ IncrementDiscardedMemory()

void cppgc::internal::StatsCollector::IncrementDiscardedMemory ( size_t value)

Definition at line 354 of file stats-collector.cc.

◆ marked_bytes()

size_t cppgc::internal::StatsCollector::marked_bytes ( ) const

Definition at line 304 of file stats-collector.cc.

Here is the caller graph for this function:

◆ marked_bytes_on_current_cycle()

size_t cppgc::internal::StatsCollector::marked_bytes_on_current_cycle ( ) const

Definition at line 309 of file stats-collector.cc.

◆ marking_time()

v8::base::TimeDelta cppgc::internal::StatsCollector::marking_time ( ) const

Definition at line 314 of file stats-collector.cc.

Here is the call graph for this function:

◆ NotifyAllocatedMemory()

void cppgc::internal::StatsCollector::NotifyAllocatedMemory ( int64_t size)

Definition at line 326 of file stats-collector.cc.

Here is the call graph for this function:

◆ NotifyAllocation()

void cppgc::internal::StatsCollector::NotifyAllocation ( size_t bytes)

Definition at line 41 of file stats-collector.cc.

◆ NotifyExplicitFree()

void cppgc::internal::StatsCollector::NotifyExplicitFree ( size_t bytes)

Definition at line 51 of file stats-collector.cc.

Here is the caller graph for this function:

◆ NotifyFreedMemory()

void cppgc::internal::StatsCollector::NotifyFreedMemory ( int64_t size)

Definition at line 340 of file stats-collector.cc.

Here is the call graph for this function:

◆ NotifyMarkingCompleted()

void cppgc::internal::StatsCollector::NotifyMarkingCompleted ( size_t marked_bytes)

Definition at line 128 of file stats-collector.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyMarkingStarted()

void cppgc::internal::StatsCollector::NotifyMarkingStarted ( CollectionType collection_type,
MarkingType marking_type,
IsForcedGC is_forced_gc )

Definition at line 116 of file stats-collector.cc.

Here is the caller graph for this function:

◆ NotifySafePointForConservativeCollection()

void cppgc::internal::StatsCollector::NotifySafePointForConservativeCollection ( )

Definition at line 60 of file stats-collector.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifySafePointForTesting()

void cppgc::internal::StatsCollector::NotifySafePointForTesting ( )

Definition at line 68 of file stats-collector.cc.

Here is the call graph for this function:

◆ NotifySweepingCompleted()

void cppgc::internal::StatsCollector::NotifySweepingCompleted ( SweepingType sweeping_type)

Definition at line 261 of file stats-collector.cc.

Here is the call graph for this function:

◆ NotifyUnmarkingStarted()

void cppgc::internal::StatsCollector::NotifyUnmarkingStarted ( CollectionType collection_type)

Definition at line 110 of file stats-collector.cc.

Here is the caller graph for this function:

◆ operator=()

StatsCollector & cppgc::internal::StatsCollector::operator= ( const StatsCollector & )
delete

◆ RecordHistogramSample() [1/2]

void cppgc::internal::StatsCollector::RecordHistogramSample ( ConcurrentScopeId ,
v8::base::TimeDelta  )
inlineprivate

Definition at line 349 of file stats-collector.h.

◆ RecordHistogramSample() [2/2]

void cppgc::internal::StatsCollector::RecordHistogramSample ( ScopeId scope_id_,
v8::base::TimeDelta time )
private

Definition at line 384 of file stats-collector.cc.

Here is the caller graph for this function:

◆ RegisterObserver()

void cppgc::internal::StatsCollector::RegisterObserver ( AllocationObserver * observer)

Definition at line 26 of file stats-collector.cc.

Here is the caller graph for this function:

◆ ResetDiscardedMemory()

void cppgc::internal::StatsCollector::ResetDiscardedMemory ( )

Definition at line 368 of file stats-collector.cc.

◆ resident_memory_size()

size_t cppgc::internal::StatsCollector::resident_memory_size ( ) const

Definition at line 376 of file stats-collector.cc.

Here is the call graph for this function:

◆ SetMetricRecorder()

void cppgc::internal::StatsCollector::SetMetricRecorder ( std::unique_ptr< MetricRecorder > histogram_recorder)
inline

Definition at line 334 of file stats-collector.h.

◆ UnregisterObserver()

void cppgc::internal::StatsCollector::UnregisterObserver ( AllocationObserver * observer)

Definition at line 33 of file stats-collector.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ allocated_bytes_since_end_of_marking_

int64_t cppgc::internal::StatsCollector::allocated_bytes_since_end_of_marking_ = 0
private

Definition at line 361 of file stats-collector.h.

◆ allocated_bytes_since_safepoint_

int64_t cppgc::internal::StatsCollector::allocated_bytes_since_safepoint_ = 0
private

Definition at line 367 of file stats-collector.h.

◆ allocation_observer_deleted_

bool cppgc::internal::StatsCollector::allocation_observer_deleted_ = false
private

Definition at line 385 of file stats-collector.h.

◆ allocation_observers_

std::vector<AllocationObserver*> cppgc::internal::StatsCollector::allocation_observers_
private

Definition at line 384 of file stats-collector.h.

◆ current_

Event cppgc::internal::StatsCollector::current_
private

Definition at line 391 of file stats-collector.h.

◆ discarded_bytes_

std::atomic<size_t> cppgc::internal::StatsCollector::discarded_bytes_ {0}
private

Definition at line 380 of file stats-collector.h.

◆ explicitly_freed_bytes_since_safepoint_

int64_t cppgc::internal::StatsCollector::explicitly_freed_bytes_since_safepoint_ = 0
private

Definition at line 368 of file stats-collector.h.

◆ gc_state_

GarbageCollectionState cppgc::internal::StatsCollector::gc_state_ = GarbageCollectionState::kNotRunning
private

Definition at line 387 of file stats-collector.h.

◆ kAllocationThresholdBytes

size_t cppgc::internal::StatsCollector::kAllocationThresholdBytes = 1024
staticconstexpr

Definition at line 272 of file stats-collector.h.

◆ marked_bytes_so_far_

size_t cppgc::internal::StatsCollector::marked_bytes_so_far_ = 0
private

Definition at line 376 of file stats-collector.h.

◆ memory_allocated_bytes_

int64_t cppgc::internal::StatsCollector::memory_allocated_bytes_ = 0
private

Definition at line 378 of file stats-collector.h.

◆ memory_freed_bytes_since_end_of_marking_

int64_t cppgc::internal::StatsCollector::memory_freed_bytes_since_end_of_marking_ = 0
private

Definition at line 379 of file stats-collector.h.

◆ metric_recorder_

std::unique_ptr<MetricRecorder> cppgc::internal::StatsCollector::metric_recorder_
private

Definition at line 395 of file stats-collector.h.

◆ platform_

Platform* cppgc::internal::StatsCollector::platform_
private

Definition at line 398 of file stats-collector.h.

◆ previous_

Event cppgc::internal::StatsCollector::previous_
private

Definition at line 393 of file stats-collector.h.

◆ time_of_last_end_of_marking_

v8::base::TimeTicks cppgc::internal::StatsCollector::time_of_last_end_of_marking_ = v8::base::TimeTicks::Now()
private

Definition at line 362 of file stats-collector.h.


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