Adjust GC tracing: add a flag to ignore scavenger traces and print total GC time in verbose mode.

R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10536147

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12267 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2012-08-07 08:19:11 +00:00
parent 23a270c6e7
commit b4fd9de1f0
3 changed files with 14 additions and 3 deletions

View File

@ -362,6 +362,8 @@ DEFINE_bool(trace_gc, false,
DEFINE_bool(trace_gc_nvp, false,
"print one detailed trace line in name=value format "
"after each garbage collection")
DEFINE_bool(trace_gc_ignore_scavenger, false,
"do not print trace line after scavenger collection")
DEFINE_bool(print_cumulative_gc_stat, false,
"print cumulative GC statistics in name=value format on exit")
DEFINE_bool(trace_gc_verbose, false,

View File

@ -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),
@ -369,6 +370,7 @@ void Heap::PrintShortHeapStatistics() {
lo_space_->SizeOfObjects() / KB,
lo_space_->Available() / KB,
lo_space_->CommittedMemory() / KB);
PrintPID("Total time spent in GC : %d ms\n", total_gc_time_ms_);
}
@ -6188,6 +6190,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());
@ -6869,6 +6872,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_);
@ -6876,8 +6880,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_trace_gc_ignore_scavenger) return;
PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
if (!FLAG_trace_gc_nvp) {
@ -6920,9 +6928,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:

View File

@ -2055,6 +2055,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_;