Reviewers: Michael Starzinger,
Message:
Please take a look.
Description:
Adjust GC tracing: add a flag to ignore scavenger traces and print total GC
time
in verbose mode.
[email protected]
Please review this at https://chromiumcodereview.appspot.com/10536147/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/flag-definitions.h
M src/heap.h
M src/heap.cc
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
2b4c53cd2defbcd1acfc6fc3212ca47a0e8dab7f..3ae6923d89b9cd4596f4ded58b02d5b7ed092d95
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -343,6 +343,8 @@ DEFINE_int(max_old_space_size, 0, "max size of the old
generation (in Mbytes)")
DEFINE_int(max_executable_size, 0, "max size of executable memory (in
Mbytes)")
DEFINE_bool(gc_global, false, "always perform global GCs")
DEFINE_int(gc_interval, -1, "garbage collect after <n> allocations")
+DEFINE_bool(ignore_scavenger_trace, false,
+ "do not print trace line after scavenger collection")
DEFINE_bool(trace_gc, false,
"print one trace line following each garbage collection")
DEFINE_bool(trace_gc_nvp, false,
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
172405b72ccd767f35e300142119b11b6f9233cc..2d9321555747da12d57efa80009551168f1839aa
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -139,6 +139,7 @@ Heap::Heap()
previous_survival_rate_trend_(Heap::STABLE),
survival_rate_trend_(Heap::STABLE),
max_gc_pause_(0),
+ total_gc_time_ms_(0),
max_alive_after_gc_(0),
min_in_mutator_(kMaxInt),
alive_after_last_gc_(0),
@@ -362,6 +363,7 @@ void Heap::PrintShortHeapStatistics() {
", available: %8" V8_PTR_PREFIX "d\n",
lo_space_->Size(),
lo_space_->Available());
+ PrintF("Total time spent in GC : %d ms\n", total_gc_time_ms_);
}
@@ -505,7 +507,7 @@ bool Heap::CollectGarbage(AllocationSpace space,
#endif
if (collector == SCAVENGER && !incremental_marking()->IsStopped()) {
- if (FLAG_trace_incremental_marking) {
+ if (FLAG_trace_incremental_marking && !FLAG_ignore_scavenger_trace) {
PrintF("[IncrementalMarking] Scavenge during marking.\n");
}
}
@@ -6165,6 +6167,7 @@ void Heap::TearDown() {
PrintF("gc_count=%d ", gc_count_);
PrintF("mark_sweep_count=%d ", ms_count_);
PrintF("max_gc_pause=%d ", get_max_gc_pause());
+ PrintF("total_gc_time=%d ", total_gc_time_ms_);
PrintF("min_in_mutator=%d ", get_min_in_mutator());
PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ",
get_max_alive_after_gc());
@@ -6839,6 +6842,7 @@ GCTracer::~GCTracer() {
// Update cumulative GC statistics if required.
if (FLAG_print_cumulative_gc_stat) {
+ heap_->total_gc_time_ms_ += time;
heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time);
heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_,
heap_->alive_after_last_gc_);
@@ -6846,8 +6850,12 @@ GCTracer::~GCTracer() {
heap_->min_in_mutator_ = Min(heap_->min_in_mutator_,
static_cast<int>(spent_in_mutator_));
}
+ } else if (FLAG_trace_gc_verbose) {
+ heap_->total_gc_time_ms_ += time;
}
+ if (collector_ == SCAVENGER && FLAG_ignore_scavenger_trace) return;
+
PrintF("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
if (!FLAG_trace_gc_nvp) {
@@ -6890,9 +6898,7 @@ GCTracer::~GCTracer() {
PrintF(".\n");
} else {
PrintF("pause=%d ", time);
- PrintF("mutator=%d ",
- static_cast<int>(spent_in_mutator_));
-
+ PrintF("mutator=%d ", static_cast<int>(spent_in_mutator_));
PrintF("gc=");
switch (collector_) {
case SCAVENGER:
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
dd1f710b25224a9521636d12cb221871a39e4f59..3718eefd6343ba13d37672370693841ef3cb206e
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -2001,6 +2001,9 @@ class Heap {
// Maximum GC pause.
int max_gc_pause_;
+ // Total time spent in GC.
+ int total_gc_time_ms_;
+
// Maximum size of objects alive after GC.
intptr_t max_alive_after_gc_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev