summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/gc/collector/concurrent_copying.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index fefe9ab475..1cd11fb428 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -2079,6 +2079,9 @@ void ConcurrentCopying::ReclaimPhase() {
LOG(INFO) << "(after) num_bytes_allocated="
<< heap_->num_bytes_allocated_.load();
}
+
+ float reclaimed_bytes_ratio = static_cast<float>(freed_bytes) / num_bytes_allocated_before_gc_;
+ reclaimed_bytes_ratio_sum_ += reclaimed_bytes_ratio;
}
{
@@ -2094,11 +2097,6 @@ void ConcurrentCopying::ReclaimPhase() {
CheckEmptyMarkStack();
- int64_t num_bytes_allocated_after_gc = static_cast<int64_t>(heap_->GetBytesAllocated());
- int64_t diff = num_bytes_allocated_before_gc_ - num_bytes_allocated_after_gc;
- auto ratio = static_cast<float>(diff) / num_bytes_allocated_before_gc_;
- reclaimed_bytes_ratio_sum_ += ratio;
-
if (kVerboseMode) {
LOG(INFO) << "GC end of ReclaimPhase";
}