Improve accuracy of heap trim times
Before, WaitForConcurrentGc was being called inside of Heap::Trim.
This caused the printed trim times to be larger than they should be.
Change-Id: Icc76b5ed7fb99350536d48a5215e7c1fdb8b4567
diff --git a/src/native/dalvik_system_VMRuntime.cc b/src/native/dalvik_system_VMRuntime.cc
index b98f974..9c40041 100644
--- a/src/native/dalvik_system_VMRuntime.cc
+++ b/src/native/dalvik_system_VMRuntime.cc
@@ -156,15 +156,14 @@
}
}
-static void VMRuntime_trimHeap(JNIEnv* env, jobject) {
+static void VMRuntime_trimHeap(JNIEnv*, jobject) {
// Trim the managed heap.
Heap* heap = Runtime::Current()->GetHeap();
uint64_t start_ns = NanoTime();
DlMallocSpace* alloc_space = heap->GetAllocSpace();
size_t alloc_space_size = alloc_space->Size();
float utilization = static_cast<float>(alloc_space->GetNumBytesAllocated()) / alloc_space_size;
- Thread* self = static_cast<JNIEnvExt*>(env)->self;
- heap->Trim(self);
+ heap->Trim();
// Trim the native heap.
dlmalloc_trim(0);
dlmalloc_inspect_all(MspaceMadviseCallback, NULL);