diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-04-08 11:14:54 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-04-08 12:12:14 -0700 |
commit | 5a48719b516a52d1a6800d8ae6f7dcba3d883bdc (patch) | |
tree | 832da1739937d3142d7c75523955e90166a4c57d /runtime/gc | |
parent | 476fe7c81c0d6b060be5cde4c44a2bb8b0b8ffd2 (diff) | |
download | art-5a48719b516a52d1a6800d8ae6f7dcba3d883bdc.zip art-5a48719b516a52d1a6800d8ae6f7dcba3d883bdc.tar.gz art-5a48719b516a52d1a6800d8ae6f7dcba3d883bdc.tar.bz2 |
Reset GC timings after SIGQUIT.
We now reset the GC timings when a SIGQUIT happens, this is useful
for excluding GCs which happen during the initialization of an app
when measuring GC performance.
Change-Id: I68c79bdb279290c12ae588bc7e95ac24908c157e
Diffstat (limited to 'runtime/gc')
-rw-r--r-- | runtime/gc/collector/garbage_collector.cc | 8 | ||||
-rw-r--r-- | runtime/gc/collector/garbage_collector.h | 3 | ||||
-rw-r--r-- | runtime/gc/heap.cc | 3 |
3 files changed, 13 insertions, 1 deletions
diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc index 82340f5..a700c73 100644 --- a/runtime/gc/collector/garbage_collector.cc +++ b/runtime/gc/collector/garbage_collector.cc @@ -204,6 +204,14 @@ uint64_t GarbageCollector::GetEstimatedLastIterationThroughput() const { return (static_cast<uint64_t>(freed_bytes_) * 1000) / (NsToMs(GetDurationNs()) + 1); } +void GarbageCollector::ResetMeasurements() { + cumulative_timings_.Reset(); + pause_histogram_.Reset(); + total_time_ns_ = 0; + total_freed_objects_ = 0; + total_freed_bytes_ = 0; +} + } // namespace collector } // namespace gc } // namespace art diff --git a/runtime/gc/collector/garbage_collector.h b/runtime/gc/collector/garbage_collector.h index 5b7b8a2..b19ac3f 100644 --- a/runtime/gc/collector/garbage_collector.h +++ b/runtime/gc/collector/garbage_collector.h @@ -110,6 +110,9 @@ class GarbageCollector { return pause_histogram_; } + // Reset the cumulative timings and pause histogram. + void ResetMeasurements(); + // Returns the estimated throughput in bytes / second. uint64_t GetEstimatedMeanThroughput() const; diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index e3fa834..feb7a48 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -660,7 +660,7 @@ void Heap::DumpGcPerformanceInfo(std::ostream& os) { // Dump cumulative loggers for each GC type. uint64_t total_paused_time = 0; - for (const auto& collector : garbage_collectors_) { + for (auto& collector : garbage_collectors_) { const CumulativeLogger& logger = collector->GetCumulativeTimings(); if (logger.GetTotalNs() != 0) { os << ConstDumpable<CumulativeLogger>(logger); @@ -680,6 +680,7 @@ void Heap::DumpGcPerformanceInfo(std::ostream& os) { total_duration += total_ns; total_paused_time += total_pause_ns; } + collector->ResetMeasurements(); } uint64_t allocation_time = static_cast<uint64_t>(total_allocation_time_) * kTimeAdjust; if (total_duration != 0) { |