Commit ae2b08f4 authored by ulan@chromium.org's avatar ulan@chromium.org

Trace idle notification.

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/521873006

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23559 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9a57c544
......@@ -495,6 +495,8 @@ DEFINE_BOOL(trace_gc_nvp, false,
"after each garbage collection")
DEFINE_BOOL(trace_gc_ignore_scavenger, false,
"do not print trace line after scavenger collection")
DEFINE_BOOL(trace_idle_notification, false,
"print one trace line following each idle notification")
DEFINE_BOOL(print_cumulative_gc_stat, false,
"print cumulative GC statistics in name=value format on exit")
DEFINE_BOOL(print_max_heap_committed, false,
......
......@@ -16,6 +16,27 @@ const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7;
const int GCIdleTimeHandler::kIdleScavengeThreshold = 5;
void GCIdleTimeAction::Print() {
switch (type) {
case DO_NOTHING:
PrintF("no action");
break;
case DO_INCREMENTAL_MARKING:
PrintF("incremental marking with step %" V8_PTR_PREFIX "d", parameter);
break;
case DO_SCAVENGE:
PrintF("scavenge");
break;
case DO_FULL_GC:
PrintF("full GC");
break;
case DO_FINALIZE_SWEEPING:
PrintF("finalize sweeping");
break;
}
}
size_t GCIdleTimeHandler::EstimateMarkingStepSize(
size_t idle_time_in_ms, size_t marking_speed_in_bytes_per_ms) {
DCHECK(idle_time_in_ms > 0);
......
......@@ -56,6 +56,8 @@ class GCIdleTimeAction {
return result;
}
void Print();
GCIdleTimeActionType type;
intptr_t parameter;
};
......
......@@ -4287,6 +4287,10 @@ bool Heap::WorthActivatingIncrementalMarking() {
bool Heap::IdleNotification(int idle_time_in_ms) {
// If incremental marking is off, we do not perform idle notification.
if (!FLAG_incremental_marking) return true;
base::ElapsedTimer timer;
if (FLAG_trace_idle_notification) {
timer.Start();
}
isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(
idle_time_in_ms);
HistogramTimerScope idle_notification_scope(
......@@ -4336,6 +4340,13 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
result = true;
break;
}
if (FLAG_trace_idle_notification) {
int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds());
PrintF("Idle notification: requested idle time %d ms, actual time %d ms [",
idle_time_in_ms, actual_time_ms);
action.Print();
PrintF("]\n");
}
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment