Reviewers: Erik Corry,
Description:
Make --trace-gc output more comprehensible.
Please review this at http://codereview.chromium.org/7245005/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/gc
Affected files:
M src/heap.h
M src/heap.cc
M src/incremental-marking.h
M src/incremental-marking.cc
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
dad755e511c1ffb4ca185b4a29d0b5d6e03b89af..6e0bb5556e975e6367939a1fbd30a7aefea59c5a
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -5618,6 +5618,10 @@ GCTracer::GCTracer(Heap* heap)
steps_count_ = heap_->incremental_marking()->steps_count();
steps_took_ = heap_->incremental_marking()->steps_took();
+ steps_count_since_last_gc_ =
+ heap_->incremental_marking()->steps_count_since_last_gc();
+ steps_took_since_last_gc_ =
+ heap_->incremental_marking()->steps_took_since_last_gc();
}
@@ -5654,9 +5658,15 @@ GCTracer::~GCTracer() {
if (external_time > 0) PrintF("%d / ", external_time);
PrintF("%d ms", time);
if (steps_count_ > 0) {
- PrintF(" (+ %d ms in %d steps)",
- static_cast<int>(steps_took_),
- steps_count_);
+ if (collector_ == SCAVENGER) {
+ PrintF(" (+ %d ms in %d steps since last GC)",
+ static_cast<int>(steps_took_since_last_gc_),
+ steps_count_since_last_gc_);
+ } else {
+ PrintF(" (+ %d ms in %d steps since start of marking)",
+ static_cast<int>(steps_took_),
+ steps_count_);
+ }
}
PrintF(".\n");
} else {
@@ -5691,8 +5701,14 @@ GCTracer::~GCTracer() {
PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_);
- PrintF("stepscount=%d ", steps_count_);
- PrintF("stepstook=%d ", static_cast<int>(steps_took_));
+
+ if (collector_ == SCAVENGER) {
+ PrintF("stepscount=%d ", steps_count_since_last_gc_);
+ PrintF("stepstook=%d ", static_cast<int>(steps_took_since_last_gc_));
+ } else {
+ PrintF("stepscount=%d ", steps_count_);
+ PrintF("stepstook=%d ", static_cast<int>(steps_took_));
+ }
PrintF("\n");
}
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
832073c8fcc1c0db9deb86786033e7fcbd57b67a..cb58a33df15761edff2756550098b833bb9a826e
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -2152,8 +2152,9 @@ class GCTracer BASE_EMBEDDED {
// Incremental marking steps counters.
int steps_count_;
-
double steps_took_;
+ int steps_count_since_last_gc_;
+ double steps_took_since_last_gc_;
Heap* heap_;
};
Index: src/incremental-marking.cc
diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc
index
d2408af82387e86d1b76050b716e6c7a60e5c99c..2cee9810d21227f48202d5056036ca6559e4f389
100644
--- a/src/incremental-marking.cc
+++ b/src/incremental-marking.cc
@@ -41,6 +41,8 @@ IncrementalMarking::IncrementalMarking(Heap* heap)
marking_deque_memory_(NULL),
steps_count_(0),
steps_took_(0),
+ steps_count_since_last_gc_(0),
+ steps_took_since_last_gc_(0),
should_hurry_(false),
allocation_marking_factor_(0),
allocated_(0) {
@@ -416,6 +418,9 @@ void
IncrementalMarking::UpdateMarkingDequeAfterScavenge() {
}
}
marking_deque_.set_top(new_top);
+
+ steps_took_since_last_gc_ = 0;
+ steps_count_since_last_gc_ = 0;
}
@@ -548,6 +553,7 @@ void IncrementalMarking::Step(intptr_t allocated_bytes)
{
allocated_ = 0;
steps_count_++;
+ steps_count_since_last_gc_++;
if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) {
allocation_marking_factor_ += kAllocationMarkingFactorSpeedup;
@@ -559,7 +565,9 @@ void IncrementalMarking::Step(intptr_t allocated_bytes)
{
if (FLAG_trace_incremental_marking || FLAG_trace_gc) {
double end = OS::TimeCurrentMillis();
- steps_took_ += (end - start);
+ double delta = (end - start);
+ steps_took_ += delta;
+ steps_took_since_last_gc_ += delta;
}
}
Index: src/incremental-marking.h
diff --git a/src/incremental-marking.h b/src/incremental-marking.h
index
55fe7e7eba532acc0d48813eacc32c1a3639dc3e..ff0bae1f7b541ed752e1aec6ccbdfdeb1daf07c9
100644
--- a/src/incremental-marking.h
+++ b/src/incremental-marking.h
@@ -137,6 +137,14 @@ class IncrementalMarking {
return steps_took_;
}
+ inline int steps_count_since_last_gc() {
+ return steps_count_since_last_gc_;
+ }
+
+ inline double steps_took_since_last_gc() {
+ return steps_took_since_last_gc_;
+ }
+
inline void SetOldSpacePageFlags(MemoryChunk* chunk) {
SetOldSpacePageFlags(chunk, IsMarking());
}
@@ -155,6 +163,8 @@ class IncrementalMarking {
void ResetStepCounters() {
steps_count_ = 0;
steps_took_ = 0;
+ steps_count_since_last_gc_ = 0;
+ steps_took_since_last_gc_ = 0;
allocation_marking_factor_ = kInitialAllocationMarkingFactor;
}
@@ -188,6 +198,8 @@ class IncrementalMarking {
int steps_count_;
double steps_took_;
+ int steps_count_since_last_gc_;
+ double steps_took_since_last_gc_;
bool should_hurry_;
int allocation_marking_factor_;
intptr_t allocated_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev