Commit fc8a3bee authored by ernstm@chromium.org's avatar ernstm@chromium.org

Add event statistics to GCTracer.

- Add method to GCTracer to compute mean and max of the last few
  Scavenger, Mark Compactor and Incremental Marking events.

R=hpayer@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22605 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b6182bd7
......@@ -268,5 +268,50 @@ void GCTracer::PrintNVP() const {
PrintF("\n");
}
double GCTracer::MeanDuration(const EventBuffer& events) const {
if (events.empty()) return 0.0;
double mean = 0.0;
EventBuffer::const_iterator iter = events.begin();
while (iter != events.end()) {
mean += iter->end_time - iter->start_time;
++iter;
}
return mean / events.size();
}
double GCTracer::MaxDuration(const EventBuffer& events) const {
if (events.empty()) return 0.0;
double maximum = 0.0f;
EventBuffer::const_iterator iter = events.begin();
while (iter != events.end()) {
maximum = Max(iter->end_time - iter->start_time, maximum);
++iter;
}
return maximum;
}
double GCTracer::MeanIncrementalMarkingDuration() const {
if (mark_compactor_events_.empty()) return 0.0;
EventBuffer::const_iterator last_mc = mark_compactor_events_.begin();
return last_mc->incremental_marking_duration /
last_mc->incremental_marking_steps;
}
double GCTracer::MaxIncrementalMarkingDuration() const {
if (mark_compactor_events_.empty()) return 0.0;
EventBuffer::const_iterator last_mc = mark_compactor_events_.begin();
return last_mc->longest_incremental_marking_step;
}
}
} // namespace v8::internal
......@@ -202,6 +202,36 @@ class GCTracer BASE_EMBEDDED {
// Log an incremental marking step.
void AddIncrementalMarkingStep(double duration);
// Compute the mean duration of the last scavenger events. Returns 0 if no
// events have been recorded.
double MeanScavengerDuration() const {
return MeanDuration(scavenger_events_);
}
// Compute the max duration of the last scavenger events. Returns 0 if no
// events have been recorded.
double MaxScavengerDuration() const { return MaxDuration(scavenger_events_); }
// Compute the mean duration of the last mark compactor events. Returns 0 if
// no events have been recorded.
double MeanMarkCompactorDuration() const {
return MeanDuration(mark_compactor_events_);
}
// Compute the max duration of the last mark compactor events. Return 0 if no
// events have been recorded.
double MaxMarkCompactorDuration() const {
return MaxDuration(mark_compactor_events_);
}
// Compute the mean step duration of the last incremental marking round.
// Returns 0 if no incremental marking round has been completed.
double MeanIncrementalMarkingDuration() const;
// Compute the max step duration of the last incremental marking round.
// Returns 0 if no incremental marking round has been completed.
double MaxIncrementalMarkingDuration() const;
private:
// Print one detailed trace line in name=value format.
// TODO(ernstm): Move to Heap.
......@@ -211,6 +241,12 @@ class GCTracer BASE_EMBEDDED {
// TODO(ernstm): Move to Heap.
void Print() const;
// Compute the mean duration of the events in the given ring buffer.
double MeanDuration(const EventBuffer& events) const;
// Compute the max duration of the events in the given ring buffer.
double MaxDuration(const EventBuffer& events) const;
// Pointer to the heap that owns this tracer.
Heap* heap_;
......
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