summaryrefslogtreecommitdiffstats
path: root/runtime/gc/collector/garbage_collector.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-03-27 16:09:46 -0700
committerMathieu Chartier <mathieuc@google.com>2014-03-28 11:35:02 -0700
commit4aeec176eaf11fe03f342aadcbb79142230270ed (patch)
treeb2c7abd4b3624dc1f801f6a29893e0f66497f378 /runtime/gc/collector/garbage_collector.cc
parenta708e32a9f764a48175e705ec4bcd2201c84f492 (diff)
downloadart-4aeec176eaf11fe03f342aadcbb79142230270ed.zip
art-4aeec176eaf11fe03f342aadcbb79142230270ed.tar.gz
art-4aeec176eaf11fe03f342aadcbb79142230270ed.tar.bz2
Refactor some GC code.
Reduced amount of code in mark sweep / semi space by moving common logic to garbage_collector.cc. Cleaned up mod union tables and deleted an unused implementation. Change-Id: I4bcc6ba41afd96d230cfbaf4d6636f37c52e37ea
Diffstat (limited to 'runtime/gc/collector/garbage_collector.cc')
-rw-r--r--runtime/gc/collector/garbage_collector.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc
index 0c7565c..c199a69 100644
--- a/runtime/gc/collector/garbage_collector.cc
+++ b/runtime/gc/collector/garbage_collector.cc
@@ -86,8 +86,8 @@ void GarbageCollector::Run(GcCause gc_cause, bool clear_soft_references) {
// Pause is the entire length of the GC.
uint64_t pause_start = NanoTime();
ATRACE_BEGIN("Application threads suspended");
- // Mutator lock may be already exclusively held when we do garbage collections for changing the
- // current collector / allocator during process state updates.
+ // Mutator lock may be already exclusively held when we do garbage collections for changing
+ // the current collector / allocator during process state updates.
if (Locks::mutator_lock_->IsExclusiveHeld(self)) {
// PreGcRosAllocVerification() is called in Heap::TransitionCollector().
RevokeAllThreadLocalBuffers();
@@ -146,7 +146,11 @@ void GarbageCollector::Run(GcCause gc_cause, bool clear_soft_references) {
break;
}
}
-
+ // Add the current timings to the cumulative timings.
+ cumulative_timings_.AddLogger(timings_);
+ // Update cumulative statistics with how many bytes the GC iteration freed.
+ total_freed_objects_ += GetFreedObjects() + GetFreedLargeObjects();
+ total_freed_bytes_ += GetFreedBytes() + GetFreedLargeObjectBytes();
uint64_t end_time = NanoTime();
duration_ns_ = end_time - start_time;
total_time_ns_ += GetDurationNs();