Revision: 22605
Author: [email protected]
Date: Thu Jul 24 15:23:06 2014 UTC
Log: 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.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/410413005
http://code.google.com/p/v8/source/detail?r=22605
Modified:
/branches/bleeding_edge/src/gc-tracer.cc
/branches/bleeding_edge/src/gc-tracer.h
=======================================
--- /branches/bleeding_edge/src/gc-tracer.cc Thu Jul 24 13:06:38 2014 UTC
+++ /branches/bleeding_edge/src/gc-tracer.cc Thu Jul 24 15:23:06 2014 UTC
@@ -268,5 +268,50 @@
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
=======================================
--- /branches/bleeding_edge/src/gc-tracer.h Thu Jul 24 13:06:38 2014 UTC
+++ /branches/bleeding_edge/src/gc-tracer.h Thu Jul 24 15:23:06 2014 UTC
@@ -202,6 +202,36 @@
// 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 @@
// 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_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.