Check pause histogram sample size.
There is a race where the GC sees > 0 iterations but 0 pauses.
We now check that there is a non zero number of pauses before
printing the pause histogram.
Bug: 16898792
Change-Id: I87813e5e6f27871ef79f70792925519d112f3534
diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc
index 646c032..07b61e6 100644
--- a/runtime/gc/collector/garbage_collector.cc
+++ b/runtime/gc/collector/garbage_collector.cc
@@ -195,9 +195,11 @@
const uint64_t freed_objects = GetTotalFreedObjects();
{
MutexLock mu(Thread::Current(), pause_histogram_lock_);
- Histogram<uint64_t>::CumulativeData cumulative_data;
- pause_histogram_.CreateHistogram(&cumulative_data);
- pause_histogram_.PrintConfidenceIntervals(os, 0.99, cumulative_data);
+ if (pause_histogram_.SampleSize() > 0) {
+ Histogram<uint64_t>::CumulativeData cumulative_data;
+ pause_histogram_.CreateHistogram(&cumulative_data);
+ pause_histogram_.PrintConfidenceIntervals(os, 0.99, cumulative_data);
+ }
}
os << GetName() << " total time: " << PrettyDuration(total_ns)
<< " mean time: " << PrettyDuration(total_ns / iterations) << "\n"