diff options
| author | 2012-10-19 10:49:56 -0700 | |
|---|---|---|
| committer | 2012-10-19 11:33:07 -0700 | |
| commit | 3056d0ca38acc3d829a13ec8f97d35a002ee354e (patch) | |
| tree | 395028dc5fbfaf00f52594fe2df34b57b88e65f4 | |
| parent | ec139de9e77663c13a907a5244267db8bed947b5 (diff) | |
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
| -rw-r--r-- | src/heap.cc | 3 | ||||
| -rw-r--r-- | src/heap.h | 2 | ||||
| -rw-r--r-- | src/native/dalvik_system_VMRuntime.cc | 5 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/heap.cc b/src/heap.cc index c6f2395dd3..584c5b2e69 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -2040,8 +2040,7 @@ void Heap::ConcurrentGC(Thread* self) { } } -void Heap::Trim(Thread* self) { - WaitForConcurrentGcToComplete(self); +void Heap::Trim() { alloc_space_->Trim(); } diff --git a/src/heap.h b/src/heap.h index 14d8382226..984a3296b2 100644 --- a/src/heap.h +++ b/src/heap.h @@ -278,7 +278,7 @@ class Heap { void DumpForSigQuit(std::ostream& os); - void Trim(Thread* self); + void Trim(); HeapBitmap* GetLiveBitmap() SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) { return live_bitmap_.get(); diff --git a/src/native/dalvik_system_VMRuntime.cc b/src/native/dalvik_system_VMRuntime.cc index b98f974f12..9c400418db 100644 --- a/src/native/dalvik_system_VMRuntime.cc +++ b/src/native/dalvik_system_VMRuntime.cc @@ -156,15 +156,14 @@ static void VMRuntime_setTargetSdkVersion(JNIEnv* env, jobject, jint targetSdkVe } } -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); |