V8 Project
v8::internal::GCTracer Class Reference

#include <gc-tracer.h>

+ Collaboration diagram for v8::internal::GCTracer:

Classes

class  AllocationEvent
 
class  Event
 
class  Scope
 

Public Types

typedef RingBuffer< Event, kRingBufferMaxSizeEventBuffer
 
typedef RingBuffer< AllocationEvent, kRingBufferMaxSizeAllocationEventBuffer
 

Public Member Functions

 GCTracer (Heap *heap)
 
void Start (GarbageCollector collector, const char *gc_reason, const char *collector_reason)
 
void Stop ()
 
void AddNewSpaceAllocationTime (double duration, intptr_t allocation_in_bytes)
 
void AddIncrementalMarkingStep (double duration, intptr_t bytes)
 
void AddMarkingTime (double duration)
 
double cumulative_marking_duration () const
 
void AddSweepingTime (double duration)
 
double cumulative_sweeping_duration () const
 
double MeanScavengerDuration () const
 
double MaxScavengerDuration () const
 
double MeanMarkCompactorDuration () const
 
double MaxMarkCompactorDuration () const
 
double MeanIncrementalMarkingDuration () const
 
double MaxIncrementalMarkingDuration () const
 
intptr_t IncrementalMarkingSpeedInBytesPerMillisecond () const
 
intptr_t ScavengeSpeedInBytesPerMillisecond () const
 
intptr_t MarkCompactSpeedInBytesPerMillisecond () const
 
intptr_t NewSpaceAllocationThroughputInBytesPerMillisecond () const
 

Static Public Attributes

static const int kRingBufferMaxSize = 10
 

Private Member Functions

void PrintNVP () const
 
void Print () const
 
double MeanDuration (const EventBuffer &events) const
 
double MaxDuration (const EventBuffer &events) const
 
 DISALLOW_COPY_AND_ASSIGN (GCTracer)
 

Private Attributes

Heapheap_
 
Event current_
 
Event previous_
 
Event previous_mark_compactor_event_
 
EventBuffer scavenger_events_
 
EventBuffer mark_compactor_events_
 
AllocationEventBuffer allocation_events_
 
int cumulative_incremental_marking_steps_
 
intptr_t cumulative_incremental_marking_bytes_
 
double cumulative_incremental_marking_duration_
 
double cumulative_pure_incremental_marking_duration_
 
double longest_incremental_marking_step_
 
double cumulative_marking_duration_
 
double cumulative_sweeping_duration_
 
intptr_t new_space_top_after_gc_
 

Detailed Description

Definition at line 86 of file gc-tracer.h.

Member Typedef Documentation

◆ AllocationEventBuffer

◆ EventBuffer

Constructor & Destructor Documentation

◆ GCTracer()

v8::internal::GCTracer::GCTracer ( Heap heap)
explicit

Definition at line 82 of file gc-tracer.cc.

83  : heap_(heap),
92  current_ = Event(Event::START, NULL, NULL);
95 }
static double TimeCurrentMillis()
double longest_incremental_marking_step_
Definition: gc-tracer.h:377
int cumulative_incremental_marking_steps_
Definition: gc-tracer.h:363
double cumulative_pure_incremental_marking_duration_
Definition: gc-tracer.h:374
double cumulative_incremental_marking_duration_
Definition: gc-tracer.h:370
Event previous_mark_compactor_event_
Definition: gc-tracer.h:351
double cumulative_sweeping_duration_
Definition: gc-tracer.h:390
intptr_t new_space_top_after_gc_
Definition: gc-tracer.h:394
intptr_t cumulative_incremental_marking_bytes_
Definition: gc-tracer.h:367
double cumulative_marking_duration_
Definition: gc-tracer.h:381
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References current_, v8::internal::GCTracer::Event::end_time, NULL, previous_, previous_mark_compactor_event_, v8::internal::GCTracer::Event::START, and v8::base::OS::TimeCurrentMillis().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddIncrementalMarkingStep()

void v8::internal::GCTracer::AddIncrementalMarkingStep ( double  duration,
intptr_t  bytes 
)

Definition at line 210 of file gc-tracer.cc.

210  {
216  cumulative_marking_duration_ += duration;
217  if (bytes > 0) {
219  }
220 }
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)

References cumulative_incremental_marking_bytes_, cumulative_incremental_marking_duration_, cumulative_incremental_marking_steps_, cumulative_marking_duration_, cumulative_pure_incremental_marking_duration_, longest_incremental_marking_step_, and v8::internal::Max().

Referenced by v8::internal::IncrementalMarking::Step().

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

◆ AddMarkingTime()

void v8::internal::GCTracer::AddMarkingTime ( double  duration)
inline

Definition at line 260 of file gc-tracer.h.

260  {
261  cumulative_marking_duration_ += duration;
262  }

References cumulative_marking_duration_.

Referenced by v8::internal::IncrementalMarking::Hurry(), and v8::internal::MarkCompactCollector::MarkLiveObjects().

+ Here is the caller graph for this function:

◆ AddNewSpaceAllocationTime()

void v8::internal::GCTracer::AddNewSpaceAllocationTime ( double  duration,
intptr_t  allocation_in_bytes 
)

Definition at line 204 of file gc-tracer.cc.

205  {
206  allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes));
207 }
AllocationEventBuffer allocation_events_
Definition: gc-tracer.h:360
void push_front(const T &element)
Definition: gc-tracer.h:68

References allocation_events_, and v8::internal::RingBuffer< T, MAX_SIZE >::push_front().

Referenced by Start().

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

◆ AddSweepingTime()

void v8::internal::GCTracer::AddSweepingTime ( double  duration)
inline

Definition at line 270 of file gc-tracer.h.

270  {
271  cumulative_sweeping_duration_ += duration;
272  }

References cumulative_sweeping_duration_.

Referenced by v8::internal::MarkCompactCollector::SweepSpaces().

+ Here is the caller graph for this function:

◆ cumulative_marking_duration()

double v8::internal::GCTracer::cumulative_marking_duration ( ) const
inline

Definition at line 265 of file gc-tracer.h.

265  {
267  }

References cumulative_marking_duration_.

◆ cumulative_sweeping_duration()

double v8::internal::GCTracer::cumulative_sweeping_duration ( ) const
inline

Definition at line 275 of file gc-tracer.h.

275  {
277  }

References cumulative_sweeping_duration_.

Referenced by v8::internal::Heap::TearDown().

+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::GCTracer::DISALLOW_COPY_AND_ASSIGN ( GCTracer  )
private

◆ IncrementalMarkingSpeedInBytesPerMillisecond()

intptr_t v8::internal::GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond ( ) const

Definition at line 407 of file gc-tracer.cc.

407  {
408  if (cumulative_incremental_marking_duration_ == 0.0) return 0;
409 
410  // We haven't completed an entire round of incremental marking, yet.
411  // Use data from GCTracer instead of data from event buffers.
413  return static_cast<intptr_t>(cumulative_incremental_marking_bytes_ /
415  }
416 
417  intptr_t bytes = 0;
418  double durations = 0.0;
419  EventBuffer::const_iterator iter = mark_compactor_events_.begin();
420  while (iter != mark_compactor_events_.end()) {
421  bytes += iter->incremental_marking_bytes;
422  durations += iter->pure_incremental_marking_duration;
423  ++iter;
424  }
425 
426  if (durations == 0.0) return 0;
427 
428  return static_cast<intptr_t>(bytes / durations);
429 }
EventBuffer mark_compactor_events_
Definition: gc-tracer.h:357
bool empty() const
Definition: gc-tracer.h:56
const_iterator begin() const
Definition: gc-tracer.h:60
const_iterator end() const
Definition: gc-tracer.h:61

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), cumulative_incremental_marking_bytes_, cumulative_incremental_marking_duration_, cumulative_pure_incremental_marking_duration_, v8::internal::RingBuffer< T, MAX_SIZE >::empty(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), and mark_compactor_events_.

Referenced by v8::internal::Heap::IdleNotification(), and PrintNVP().

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

◆ MarkCompactSpeedInBytesPerMillisecond()

intptr_t v8::internal::GCTracer::MarkCompactSpeedInBytesPerMillisecond ( ) const

Definition at line 448 of file gc-tracer.cc.

448  {
449  intptr_t bytes = 0;
450  double durations = 0.0;
451  EventBuffer::const_iterator iter = mark_compactor_events_.begin();
452  while (iter != mark_compactor_events_.end()) {
453  bytes += iter->start_object_size;
454  durations += iter->end_time - iter->start_time +
455  iter->pure_incremental_marking_duration;
456  ++iter;
457  }
458 
459  if (durations == 0.0) return 0;
460 
461  return static_cast<intptr_t>(bytes / durations);
462 }

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), and mark_compactor_events_.

Referenced by v8::internal::Heap::IdleNotification().

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

◆ MaxDuration()

double v8::internal::GCTracer::MaxDuration ( const EventBuffer events) const
private

Definition at line 354 of file gc-tracer.cc.

354  {
355  if (events.empty()) return 0.0;
356 
357  double maximum = 0.0f;
358  EventBuffer::const_iterator iter = events.begin();
359  while (iter != events.end()) {
360  maximum = Max(iter->end_time - iter->start_time, maximum);
361  ++iter;
362  }
363 
364  return maximum;
365 }

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), v8::internal::RingBuffer< T, MAX_SIZE >::empty(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), and v8::internal::Max().

Referenced by MaxMarkCompactorDuration(), and MaxScavengerDuration().

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

◆ MaxIncrementalMarkingDuration()

double v8::internal::GCTracer::MaxIncrementalMarkingDuration ( ) const

Definition at line 393 of file gc-tracer.cc.

393  {
394  // We haven't completed an entire round of incremental marking, yet.
395  // Use data from GCTracer instead of data from event buffers.
397 
398  double max_duration = 0.0;
399  EventBuffer::const_iterator iter = mark_compactor_events_.begin();
400  while (iter != mark_compactor_events_.end())
401  max_duration = Max(iter->longest_incremental_marking_step, max_duration);
402 
403  return max_duration;
404 }

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), v8::internal::RingBuffer< T, MAX_SIZE >::empty(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), longest_incremental_marking_step_, mark_compactor_events_, and v8::internal::Max().

+ Here is the call graph for this function:

◆ MaxMarkCompactorDuration()

double v8::internal::GCTracer::MaxMarkCompactorDuration ( ) const
inline

Definition at line 297 of file gc-tracer.h.

297  {
299  }
double MaxDuration(const EventBuffer &events) const
Definition: gc-tracer.cc:354

References mark_compactor_events_, and MaxDuration().

+ Here is the call graph for this function:

◆ MaxScavengerDuration()

double v8::internal::GCTracer::MaxScavengerDuration ( ) const
inline

Definition at line 287 of file gc-tracer.h.

287 { return MaxDuration(scavenger_events_); }
EventBuffer scavenger_events_
Definition: gc-tracer.h:354

References MaxDuration(), and scavenger_events_.

+ Here is the call graph for this function:

◆ MeanDuration()

double v8::internal::GCTracer::MeanDuration ( const EventBuffer events) const
private

Definition at line 340 of file gc-tracer.cc.

340  {
341  if (events.empty()) return 0.0;
342 
343  double mean = 0.0;
344  EventBuffer::const_iterator iter = events.begin();
345  while (iter != events.end()) {
346  mean += iter->end_time - iter->start_time;
347  ++iter;
348  }
349 
350  return mean / events.size();
351 }

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), v8::internal::RingBuffer< T, MAX_SIZE >::empty(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), and v8::internal::RingBuffer< T, MAX_SIZE >::size().

Referenced by MeanMarkCompactorDuration(), and MeanScavengerDuration().

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

◆ MeanIncrementalMarkingDuration()

double v8::internal::GCTracer::MeanIncrementalMarkingDuration ( ) const

Definition at line 368 of file gc-tracer.cc.

368  {
369  if (cumulative_incremental_marking_steps_ == 0) return 0.0;
370 
371  // We haven't completed an entire round of incremental marking, yet.
372  // Use data from GCTracer instead of data from event buffers.
376  }
377 
378  int steps = 0;
379  double durations = 0.0;
380  EventBuffer::const_iterator iter = mark_compactor_events_.begin();
381  while (iter != mark_compactor_events_.end()) {
382  steps += iter->incremental_marking_steps;
383  durations += iter->incremental_marking_duration;
384  ++iter;
385  }
386 
387  if (steps == 0) return 0.0;
388 
389  return durations / steps;
390 }

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), cumulative_incremental_marking_duration_, cumulative_incremental_marking_steps_, v8::internal::RingBuffer< T, MAX_SIZE >::empty(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), and mark_compactor_events_.

+ Here is the call graph for this function:

◆ MeanMarkCompactorDuration()

double v8::internal::GCTracer::MeanMarkCompactorDuration ( ) const
inline

Definition at line 291 of file gc-tracer.h.

291  {
293  }
double MeanDuration(const EventBuffer &events) const
Definition: gc-tracer.cc:340

References mark_compactor_events_, and MeanDuration().

+ Here is the call graph for this function:

◆ MeanScavengerDuration()

double v8::internal::GCTracer::MeanScavengerDuration ( ) const
inline

Definition at line 281 of file gc-tracer.h.

281  {
283  }

References MeanDuration(), and scavenger_events_.

+ Here is the call graph for this function:

◆ NewSpaceAllocationThroughputInBytesPerMillisecond()

intptr_t v8::internal::GCTracer::NewSpaceAllocationThroughputInBytesPerMillisecond ( ) const

Definition at line 465 of file gc-tracer.cc.

465  {
466  intptr_t bytes = 0;
467  double durations = 0.0;
468  AllocationEventBuffer::const_iterator iter = allocation_events_.begin();
469  while (iter != allocation_events_.end()) {
470  bytes += iter->allocation_in_bytes_;
471  durations += iter->duration_;
472  ++iter;
473  }
474 
475  if (durations == 0.0) return 0;
476 
477  return static_cast<intptr_t>(bytes / durations);
478 }

References allocation_events_, v8::internal::RingBuffer< T, MAX_SIZE >::begin(), and v8::internal::RingBuffer< T, MAX_SIZE >::end().

Referenced by v8::internal::Heap::IdleNotification(), and PrintNVP().

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

◆ Print()

void v8::internal::GCTracer::Print ( ) const
private

Definition at line 223 of file gc-tracer.cc.

223  {
224  PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
225 
226  PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", current_.TypeName(false),
227  static_cast<double>(current_.start_object_size) / MB,
228  static_cast<double>(current_.start_memory_size) / MB,
229  static_cast<double>(current_.end_object_size) / MB,
230  static_cast<double>(current_.end_memory_size) / MB);
231 
232  int external_time = static_cast<int>(current_.scopes[Scope::EXTERNAL]);
233  if (external_time > 0) PrintF("%d / ", external_time);
234 
235  double duration = current_.end_time - current_.start_time;
236  PrintF("%.1f ms", duration);
237  if (current_.type == Event::SCAVENGER) {
239  PrintF(" (+ %.1f ms in %d steps since last GC)",
242  }
243  } else {
245  PrintF(
246  " (+ %.1f ms in %d steps since start of marking, "
247  "biggest step %.1f ms)",
251  }
252  }
253 
254  if (current_.gc_reason != NULL) {
255  PrintF(" [%s]", current_.gc_reason);
256  }
257 
258  if (current_.collector_reason != NULL) {
259  PrintF(" [%s]", current_.collector_reason);
260  }
261 
262  PrintF(".\n");
263 }
const char * TypeName(bool short_name) const
Definition: gc-tracer.cc:57
double scopes[Scope::NUMBER_OF_SCOPES]
Definition: gc-tracer.h:235
Isolate * isolate()
Definition: heap-inl.h:589
double time_millis_since_init()
Definition: isolate.h:1016
void PrintPID(const char *format,...)
Definition: utils.cc:96
void PrintF(const char *format,...)
Definition: utils.cc:80
const int MB
Definition: globals.h:107

References v8::internal::GCTracer::Event::collector_reason, current_, v8::internal::GCTracer::Event::end_memory_size, v8::internal::GCTracer::Event::end_object_size, v8::internal::GCTracer::Event::end_time, v8::internal::GCTracer::Scope::EXTERNAL, v8::internal::GCTracer::Event::gc_reason, heap_, v8::internal::GCTracer::Event::incremental_marking_duration, v8::internal::GCTracer::Event::incremental_marking_steps, v8::internal::Heap::isolate(), v8::internal::GCTracer::Event::longest_incremental_marking_step, v8::internal::MB, NULL, v8::internal::PrintF(), v8::internal::PrintPID(), v8::internal::GCTracer::Event::SCAVENGER, v8::internal::GCTracer::Event::scopes, v8::internal::GCTracer::Event::start_memory_size, v8::internal::GCTracer::Event::start_object_size, v8::internal::GCTracer::Event::start_time, v8::internal::Isolate::time_millis_since_init(), v8::internal::GCTracer::Event::type, and v8::internal::GCTracer::Event::TypeName().

Referenced by Stop().

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

◆ PrintNVP()

void v8::internal::GCTracer::PrintNVP ( ) const
private

Definition at line 266 of file gc-tracer.cc.

266  {
267  PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
268 
269  double duration = current_.end_time - current_.start_time;
270  double spent_in_mutator = current_.start_time - previous_.end_time;
271 
272  PrintF("pause=%.1f ", duration);
273  PrintF("mutator=%.1f ", spent_in_mutator);
274  PrintF("gc=%s ", current_.TypeName(true));
275 
276  PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]);
277  PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]);
278  PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]);
279  PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]);
280  PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]);
281  PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]);
282  PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]);
283  PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]);
284  PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]);
285  PrintF("new_new=%.1f ",
287  PrintF("root_new=%.1f ",
289  PrintF("old_new=%.1f ",
291  PrintF("compaction_ptrs=%.1f ",
293  PrintF("intracompaction_ptrs=%.1f ",
295  PrintF("misc_compaction=%.1f ",
297  PrintF("weakcollection_process=%.1f ",
299  PrintF("weakcollection_clear=%.1f ",
301  PrintF("weakcollection_abort=%.1f ",
303 
304  PrintF("total_size_before=%" V8_PTR_PREFIX "d ", current_.start_object_size);
305  PrintF("total_size_after=%" V8_PTR_PREFIX "d ", current_.end_object_size);
306  PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", current_.start_holes_size);
307  PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", current_.end_holes_size);
308 
309  intptr_t allocated_since_last_gc =
311  PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc);
312  PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_);
313  PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
315  PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_);
316  PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
317  PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
318  PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
319  PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
320  PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
322 
323  if (current_.type == Event::SCAVENGER) {
324  PrintF("steps_count=%d ", current_.incremental_marking_steps);
325  PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
326  PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ",
328  } else {
329  PrintF("steps_count=%d ", current_.incremental_marking_steps);
330  PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
331  PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step);
332  PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ",
334  }
335 
336  PrintF("\n");
337 }
intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const
Definition: gc-tracer.cc:407
intptr_t ScavengeSpeedInBytesPerMillisecond() const
Definition: gc-tracer.cc:432
intptr_t NewSpaceAllocationThroughputInBytesPerMillisecond() const
Definition: gc-tracer.cc:465
int nodes_copied_in_new_space_
Definition: heap.h:1914
int nodes_died_in_new_space_
Definition: heap.h:1913
int nodes_promoted_
Definition: heap.h:1915
double semi_space_copied_rate_
Definition: heap.h:1912
intptr_t promoted_objects_size_
Definition: heap.h:1909
double promotion_rate_
Definition: heap.h:1910
intptr_t semi_space_copied_object_size_
Definition: heap.h:1911
#define V8_PTR_PREFIX
Definition: macros.h:360

References current_, v8::internal::GCTracer::Event::end_holes_size, v8::internal::GCTracer::Event::end_object_size, v8::internal::GCTracer::Event::end_time, v8::internal::GCTracer::Scope::EXTERNAL, heap_, v8::internal::GCTracer::Event::incremental_marking_duration, v8::internal::GCTracer::Event::incremental_marking_steps, IncrementalMarkingSpeedInBytesPerMillisecond(), v8::internal::Heap::isolate(), v8::internal::GCTracer::Event::longest_incremental_marking_step, v8::internal::GCTracer::Scope::MC_EVACUATE_PAGES, v8::internal::GCTracer::Scope::MC_MARK, v8::internal::GCTracer::Scope::MC_SWEEP, v8::internal::GCTracer::Scope::MC_SWEEP_CELL, v8::internal::GCTracer::Scope::MC_SWEEP_CODE, v8::internal::GCTracer::Scope::MC_SWEEP_MAP, v8::internal::GCTracer::Scope::MC_SWEEP_NEWSPACE, v8::internal::GCTracer::Scope::MC_SWEEP_OLDSPACE, v8::internal::GCTracer::Scope::MC_UPDATE_MISC_POINTERS, v8::internal::GCTracer::Scope::MC_UPDATE_NEW_TO_NEW_POINTERS, v8::internal::GCTracer::Scope::MC_UPDATE_OLD_TO_NEW_POINTERS, v8::internal::GCTracer::Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED, v8::internal::GCTracer::Scope::MC_UPDATE_POINTERS_TO_EVACUATED, v8::internal::GCTracer::Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS, v8::internal::GCTracer::Scope::MC_WEAKCOLLECTION_ABORT, v8::internal::GCTracer::Scope::MC_WEAKCOLLECTION_CLEAR, v8::internal::GCTracer::Scope::MC_WEAKCOLLECTION_PROCESS, NewSpaceAllocationThroughputInBytesPerMillisecond(), v8::internal::Heap::nodes_copied_in_new_space_, v8::internal::Heap::nodes_died_in_new_space_, v8::internal::Heap::nodes_promoted_, previous_, v8::internal::PrintF(), v8::internal::PrintPID(), v8::internal::Heap::promoted_objects_size_, v8::internal::Heap::promotion_rate_, v8::internal::GCTracer::Event::SCAVENGER, ScavengeSpeedInBytesPerMillisecond(), v8::internal::GCTracer::Event::scopes, v8::internal::Heap::semi_space_copied_object_size_, v8::internal::Heap::semi_space_copied_rate_, v8::internal::GCTracer::Event::start_holes_size, v8::internal::GCTracer::Event::start_object_size, v8::internal::GCTracer::Event::start_time, v8::internal::Isolate::time_millis_since_init(), v8::internal::GCTracer::Event::type, v8::internal::GCTracer::Event::TypeName(), and V8_PTR_PREFIX.

Referenced by Stop().

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

◆ ScavengeSpeedInBytesPerMillisecond()

intptr_t v8::internal::GCTracer::ScavengeSpeedInBytesPerMillisecond ( ) const

Definition at line 432 of file gc-tracer.cc.

432  {
433  intptr_t bytes = 0;
434  double durations = 0.0;
435  EventBuffer::const_iterator iter = scavenger_events_.begin();
436  while (iter != scavenger_events_.end()) {
437  bytes += iter->new_space_object_size;
438  durations += iter->end_time - iter->start_time;
439  ++iter;
440  }
441 
442  if (durations == 0.0) return 0;
443 
444  return static_cast<intptr_t>(bytes / durations);
445 }

References v8::internal::RingBuffer< T, MAX_SIZE >::begin(), v8::internal::RingBuffer< T, MAX_SIZE >::end(), and scavenger_events_.

Referenced by v8::internal::Heap::IdleNotification(), and PrintNVP().

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

◆ Start()

void v8::internal::GCTracer::Start ( GarbageCollector  collector,
const char *  gc_reason,
const char *  collector_reason 
)

Definition at line 98 of file gc-tracer.cc.

99  {
101  double start_time = base::OS::TimeCurrentMillis();
102  if (new_space_top_after_gc_ != 0) {
104  start_time - previous_.end_time,
105  reinterpret_cast<intptr_t>((heap_->new_space()->top()) -
107  }
110 
111  if (collector == SCAVENGER) {
112  current_ = Event(Event::SCAVENGER, gc_reason, collector_reason);
113  } else {
114  current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason);
115  }
116 
117  current_.start_time = start_time;
122  heap_->new_space()->top() - heap_->new_space()->bottom();
123 
133 
134  for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) {
135  current_.scopes[i] = 0;
136  }
137 }
double cumulative_pure_incremental_marking_duration
Definition: gc-tracer.h:223
double cumulative_incremental_marking_duration
Definition: gc-tracer.h:214
intptr_t cumulative_incremental_marking_bytes
Definition: gc-tracer.h:205
void AddNewSpaceAllocationTime(double duration, intptr_t allocation_in_bytes)
Definition: gc-tracer.cc:204
NewSpace * new_space()
Definition: heap.h:593
intptr_t SizeOfObjects()
Definition: heap.cc:460
MemoryAllocator * memory_allocator()
Definition: isolate.h:883
static intptr_t CountTotalHolesSize(Heap *heap)
Definition: gc-tracer.cc:12

References AddNewSpaceAllocationTime(), v8::internal::NewSpace::bottom(), v8::internal::CountTotalHolesSize(), v8::internal::GCTracer::Event::cumulative_incremental_marking_bytes, cumulative_incremental_marking_bytes_, v8::internal::GCTracer::Event::cumulative_incremental_marking_duration, cumulative_incremental_marking_duration_, v8::internal::GCTracer::Event::cumulative_incremental_marking_steps, cumulative_incremental_marking_steps_, v8::internal::GCTracer::Event::cumulative_pure_incremental_marking_duration, cumulative_pure_incremental_marking_duration_, current_, v8::internal::GCTracer::Event::end_time, heap_, v8::internal::Heap::isolate(), v8::internal::GCTracer::Event::longest_incremental_marking_step, longest_incremental_marking_step_, v8::internal::GCTracer::Event::MARK_COMPACTOR, v8::internal::Isolate::memory_allocator(), v8::internal::Heap::new_space(), v8::internal::GCTracer::Event::new_space_object_size, new_space_top_after_gc_, v8::internal::GCTracer::Scope::NUMBER_OF_SCOPES, previous_, previous_mark_compactor_event_, v8::internal::SCAVENGER, v8::internal::GCTracer::Event::SCAVENGER, v8::internal::GCTracer::Event::scopes, v8::internal::MemoryAllocator::Size(), v8::internal::Heap::SizeOfObjects(), v8::internal::GCTracer::Event::start_holes_size, v8::internal::GCTracer::Event::start_memory_size, v8::internal::GCTracer::Event::start_object_size, v8::internal::GCTracer::Event::start_time, v8::base::OS::TimeCurrentMillis(), v8::internal::NewSpace::top(), and v8::internal::GCTracer::Event::type.

Referenced by v8::internal::Heap::CollectGarbage().

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

◆ Stop()

void v8::internal::GCTracer::Stop ( )

Definition at line 140 of file gc-tracer.cc.

140  {
146  reinterpret_cast<intptr_t>(heap_->new_space()->top());
147 
148  if (current_.type == Event::SCAVENGER) {
162  } else {
178  }
179 
180  // TODO(ernstm): move the code below out of GCTracer.
181 
182  if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
183 
184  double duration = current_.end_time - current_.start_time;
185  double spent_in_mutator = Max(current_.start_time - previous_.end_time, 0.0);
186 
187  heap_->UpdateCumulativeGCStatistics(duration, spent_in_mutator,
189 
190  if (current_.type == Event::SCAVENGER && FLAG_trace_gc_ignore_scavenger)
191  return;
192 
193  if (FLAG_trace_gc) {
194  if (FLAG_trace_gc_nvp)
195  PrintNVP();
196  else
197  Print();
198 
200  }
201 }
void Print() const
Definition: gc-tracer.cc:223
void PrintNVP() const
Definition: gc-tracer.cc:266
void UpdateCumulativeGCStatistics(double duration, double spent_in_mutator, double marking_time)
Definition: heap.cc:5881
void PrintShortHeapStatistics()
Definition: heap.cc:313

References v8::internal::CountTotalHolesSize(), v8::internal::GCTracer::Event::cumulative_incremental_marking_bytes, v8::internal::GCTracer::Event::cumulative_incremental_marking_duration, v8::internal::GCTracer::Event::cumulative_incremental_marking_steps, v8::internal::GCTracer::Event::cumulative_pure_incremental_marking_duration, current_, v8::internal::GCTracer::Event::end_holes_size, v8::internal::GCTracer::Event::end_memory_size, v8::internal::GCTracer::Event::end_object_size, v8::internal::GCTracer::Event::end_time, heap_, v8::internal::GCTracer::Event::incremental_marking_bytes, v8::internal::GCTracer::Event::incremental_marking_duration, v8::internal::GCTracer::Event::incremental_marking_steps, v8::internal::Heap::isolate(), longest_incremental_marking_step_, mark_compactor_events_, v8::internal::Max(), v8::internal::GCTracer::Scope::MC_MARK, v8::internal::Isolate::memory_allocator(), v8::internal::Heap::new_space(), new_space_top_after_gc_, previous_, previous_mark_compactor_event_, Print(), PrintNVP(), v8::internal::Heap::PrintShortHeapStatistics(), v8::internal::GCTracer::Event::pure_incremental_marking_duration, v8::internal::RingBuffer< T, MAX_SIZE >::push_front(), v8::internal::GCTracer::Event::SCAVENGER, scavenger_events_, v8::internal::GCTracer::Event::scopes, v8::internal::MemoryAllocator::Size(), v8::internal::Heap::SizeOfObjects(), v8::internal::GCTracer::Event::start_time, v8::base::OS::TimeCurrentMillis(), v8::internal::NewSpace::top(), v8::internal::GCTracer::Event::type, and v8::internal::Heap::UpdateCumulativeGCStatistics().

Referenced by v8::internal::Heap::CollectGarbage().

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

Member Data Documentation

◆ allocation_events_

AllocationEventBuffer v8::internal::GCTracer::allocation_events_
private

◆ cumulative_incremental_marking_bytes_

intptr_t v8::internal::GCTracer::cumulative_incremental_marking_bytes_
private

◆ cumulative_incremental_marking_duration_

double v8::internal::GCTracer::cumulative_incremental_marking_duration_
private

◆ cumulative_incremental_marking_steps_

int v8::internal::GCTracer::cumulative_incremental_marking_steps_
private

Definition at line 363 of file gc-tracer.h.

Referenced by AddIncrementalMarkingStep(), MeanIncrementalMarkingDuration(), and Start().

◆ cumulative_marking_duration_

double v8::internal::GCTracer::cumulative_marking_duration_
private

◆ cumulative_pure_incremental_marking_duration_

double v8::internal::GCTracer::cumulative_pure_incremental_marking_duration_
private

◆ cumulative_sweeping_duration_

double v8::internal::GCTracer::cumulative_sweeping_duration_
private

Definition at line 390 of file gc-tracer.h.

Referenced by AddSweepingTime(), and cumulative_sweeping_duration().

◆ current_

Event v8::internal::GCTracer::current_
private

◆ heap_

Heap* v8::internal::GCTracer::heap_
private

Definition at line 341 of file gc-tracer.h.

Referenced by Print(), PrintNVP(), Start(), and Stop().

◆ kRingBufferMaxSize

const int v8::internal::GCTracer::kRingBufferMaxSize = 10
static

Definition at line 238 of file gc-tracer.h.

◆ longest_incremental_marking_step_

double v8::internal::GCTracer::longest_incremental_marking_step_
private

Definition at line 377 of file gc-tracer.h.

Referenced by AddIncrementalMarkingStep(), MaxIncrementalMarkingDuration(), Start(), and Stop().

◆ mark_compactor_events_

◆ new_space_top_after_gc_

intptr_t v8::internal::GCTracer::new_space_top_after_gc_
private

Definition at line 394 of file gc-tracer.h.

Referenced by Start(), and Stop().

◆ previous_

Event v8::internal::GCTracer::previous_
private

Definition at line 348 of file gc-tracer.h.

Referenced by GCTracer(), PrintNVP(), Start(), and Stop().

◆ previous_mark_compactor_event_

Event v8::internal::GCTracer::previous_mark_compactor_event_
private

Definition at line 351 of file gc-tracer.h.

Referenced by GCTracer(), Start(), and Stop().

◆ scavenger_events_

EventBuffer v8::internal::GCTracer::scavenger_events_
private

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