Index: src/heap/gc-tracer.cc |
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc |
index 695a259884804b2bcea347e164b43ec1f3517a48..323bd963d0f879b2c74027c1986a7415873e83e0 100644 |
--- a/src/heap/gc-tracer.cc |
+++ b/src/heap/gc-tracer.cc |
@@ -228,9 +228,10 @@ void GCTracer::MergeBaseline(const Event& baseline) { |
void GCTracer::Stop(GarbageCollector collector) { |
start_counter_--; |
if (start_counter_ != 0) { |
- PrintIsolate(heap_->isolate(), "[Finished reentrant %s during %s.]\n", |
- collector == SCAVENGER ? "Scavenge" : "Mark-sweep", |
- current_.TypeName(false)); |
+ heap_->isolate()->PrintWithTimestamp( |
+ "[Finished reentrant %s during %s.]\n", |
+ collector == SCAVENGER ? "Scavenge" : "Mark-sweep", |
+ current_.TypeName(false)); |
return; |
} |
@@ -408,23 +409,15 @@ void GCTracer::Print() const { |
const size_t kIncrementalStatsSize = 128; |
char incremental_buffer[kIncrementalStatsSize] = {0}; |
- if (current_.incremental_marking_scopes[Scope::MC_INCREMENTAL].steps > 0) { |
- if (current_.type == Event::SCAVENGER) { |
- base::OS::SNPrintF( |
- incremental_buffer, kIncrementalStatsSize, |
- " (+ %.1f ms in %d steps since last GC)", |
- current_.scopes[Scope::MC_INCREMENTAL], |
- current_.incremental_marking_scopes[Scope::MC_INCREMENTAL].steps); |
- } else { |
- base::OS::SNPrintF( |
- incremental_buffer, kIncrementalStatsSize, |
- " (+ %.1f ms in %d steps since start of marking, " |
- "biggest step %.1f ms)", |
- current_.scopes[Scope::MC_INCREMENTAL], |
- current_.incremental_marking_scopes[Scope::MC_INCREMENTAL].steps, |
- current_.incremental_marking_scopes[Scope::MC_INCREMENTAL] |
- .longest_step); |
- } |
+ if (current_.type == Event::INCREMENTAL_MARK_COMPACTOR) { |
+ base::OS::SNPrintF( |
+ incremental_buffer, kIncrementalStatsSize, |
+ " (+ %.1f ms in %d steps since start of marking, " |
+ "biggest step %.1f ms, walltime since start of marking %.f ms)", |
+ current_.scopes[Scope::MC_INCREMENTAL], |
+ current_.incremental_marking_scopes[Scope::MC_INCREMENTAL].steps, |
+ current_.incremental_marking_scopes[Scope::MC_INCREMENTAL].longest_step, |
+ current_.end_time - incremental_marking_start_time_); |
} |
// Avoid PrintF as Output also appends the string to the tracing ring buffer |
@@ -453,11 +446,16 @@ void GCTracer::PrintNVP() const { |
intptr_t allocated_since_last_gc = |
current_.start_object_size - previous_.end_object_size; |
+ double incremental_walltime_duration = 0; |
+ |
+ if (current_.type == Event::INCREMENTAL_MARK_COMPACTOR) { |
+ incremental_walltime_duration = |
+ current_.end_time - incremental_marking_start_time_; |
+ } |
+ |
switch (current_.type) { |
case Event::SCAVENGER: |
- PrintIsolate( |
- heap_->isolate(), |
- "%8.0f ms: " |
+ heap_->isolate()->PrintWithTimestamp( |
"pause=%.1f " |
"mutator=%.1f " |
"gc=%s " |
@@ -498,9 +496,8 @@ void GCTracer::PrintNVP() const { |
"semi_space_copy_rate=%.1f%% " |
"new_space_allocation_throughput=%.1f " |
"context_disposal_rate=%.1f\n", |
- heap_->isolate()->time_millis_since_init(), duration, |
- spent_in_mutator, current_.TypeName(true), current_.reduce_memory, |
- current_.scopes[Scope::SCAVENGER_SCAVENGE], |
+ duration, spent_in_mutator, current_.TypeName(true), |
+ current_.reduce_memory, current_.scopes[Scope::SCAVENGER_SCAVENGE], |
current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS], |
current_.scopes[Scope::SCAVENGER_WEAK], |
current_.scopes[Scope::SCAVENGER_ROOTS], |
@@ -527,9 +524,7 @@ void GCTracer::PrintNVP() const { |
break; |
case Event::MARK_COMPACTOR: |
case Event::INCREMENTAL_MARK_COMPACTOR: |
- PrintIsolate( |
- heap_->isolate(), |
- "%8.0f ms: " |
+ heap_->isolate()->PrintWithTimestamp( |
"pause=%.1f " |
"mutator=%.1f " |
"gc=%s " |
@@ -588,6 +583,7 @@ void GCTracer::PrintNVP() const { |
"incremental_longest_step=%.1f " |
"incremental_steps_count=%d " |
"incremental_marking_throughput=%.f " |
+ "incremental_walltime_duration=%.f " |
"total_size_before=%" V8PRIdPTR |
" " |
"total_size_after=%" V8PRIdPTR |
@@ -612,9 +608,8 @@ void GCTracer::PrintNVP() const { |
"new_space_allocation_throughput=%.1f " |
"context_disposal_rate=%.1f " |
"compaction_speed=%.f\n", |
- heap_->isolate()->time_millis_since_init(), duration, |
- spent_in_mutator, current_.TypeName(true), current_.reduce_memory, |
- current_.scopes[Scope::MC_CLEAR], |
+ duration, spent_in_mutator, current_.TypeName(true), |
+ current_.reduce_memory, current_.scopes[Scope::MC_CLEAR], |
current_.scopes[Scope::MC_CLEAR_CODE_FLUSH], |
current_.scopes[Scope::MC_CLEAR_DEPENDENT_CODE], |
current_.scopes[Scope::MC_CLEAR_GLOBAL_HANDLES], |
@@ -674,9 +669,10 @@ void GCTracer::PrintNVP() const { |
.longest_step, |
current_.incremental_marking_scopes[Scope::MC_INCREMENTAL].steps, |
IncrementalMarkingSpeedInBytesPerMillisecond(), |
- current_.start_object_size, current_.end_object_size, |
- current_.start_holes_size, current_.end_holes_size, |
- allocated_since_last_gc, heap_->promoted_objects_size(), |
+ incremental_walltime_duration, current_.start_object_size, |
+ current_.end_object_size, current_.start_holes_size, |
+ current_.end_holes_size, allocated_since_last_gc, |
+ heap_->promoted_objects_size(), |
heap_->semi_space_copied_object_size(), |
heap_->nodes_died_in_new_space_, heap_->nodes_copied_in_new_space_, |
heap_->nodes_promoted_, heap_->promotion_ratio_, |
@@ -821,5 +817,10 @@ bool GCTracer::SurvivalEventsRecorded() const { |
} |
void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } |
+ |
+void GCTracer::NotifyIncrementalMarkingStart() { |
+ incremental_marking_start_time_ = heap_->MonotonicallyIncreasingTimeInMs(); |
+} |
+ |
} // namespace internal |
} // namespace v8 |