Fix statistics reporting in JIT.
We now need to take into account shared / private regions.
Test: boot, take a bugreport
Bug: 119800099
Change-Id: I131a73a0fd96a60b13c464c17445b0ba3973bef4
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 256543b..6e7d4b0 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -929,7 +929,7 @@
}
size_t JitCodeCache::CodeCacheSizeLocked() {
- return private_region_.GetUsedMemoryForCode();
+ return GetCurrentRegion()->GetUsedMemoryForCode();
}
size_t JitCodeCache::DataCacheSize() {
@@ -938,7 +938,7 @@
}
size_t JitCodeCache::DataCacheSizeLocked() {
- return private_region_.GetUsedMemoryForData();
+ return GetCurrentRegion()->GetUsedMemoryForData();
}
void JitCodeCache::ClearData(Thread* self,
@@ -1719,12 +1719,20 @@
void JitCodeCache::Dump(std::ostream& os) {
MutexLock mu(Thread::Current(), *Locks::jit_lock_);
- os << "Current JIT code cache size: " << PrettySize(private_region_.GetUsedMemoryForCode())
+ os << "Current JIT code cache size: " << PrettySize(GetCurrentRegion()->GetUsedMemoryForCode())
<< "\n"
- << "Current JIT data cache size: " << PrettySize(private_region_.GetUsedMemoryForData())
- << "\n"
- << "Current JIT mini-debug-info size: " << PrettySize(GetJitMiniDebugInfoMemUsage()) << "\n"
- << "Current JIT capacity: " << PrettySize(private_region_.GetCurrentCapacity()) << "\n"
+ << "Current JIT data cache size: " << PrettySize(GetCurrentRegion()->GetUsedMemoryForData())
+ << "\n";
+ if (!Runtime::Current()->IsZygote()) {
+ os << "Zygote JIT code cache size (at point of fork): "
+ << PrettySize(shared_region_.GetUsedMemoryForCode())
+ << "\n"
+ << "Zygote JIT data cache size (at point of fork): "
+ << PrettySize(shared_region_.GetUsedMemoryForData())
+ << "\n";
+ }
+ os << "Current JIT mini-debug-info size: " << PrettySize(GetJitMiniDebugInfoMemUsage()) << "\n"
+ << "Current JIT capacity: " << PrettySize(GetCurrentRegion()->GetCurrentCapacity()) << "\n"
<< "Current number of JIT JNI stub entries: " << jni_stubs_map_.size() << "\n"
<< "Current number of JIT code cache entries: " << method_code_map_.size() << "\n"
<< "Total number of JIT compilations: " << number_of_compilations_ << "\n"
@@ -1764,6 +1772,9 @@
number_of_compilations_ = 0;
number_of_osr_compilations_ = 0;
number_of_collections_ = 0;
+ histogram_stack_map_memory_use_.Reset();
+ histogram_code_memory_use_.Reset();
+ histogram_profiling_info_memory_use_.Reset();
size_t initial_capacity = Runtime::Current()->GetJITOptions()->GetCodeCacheInitialCapacity();
size_t max_capacity = Runtime::Current()->GetJITOptions()->GetCodeCacheMaxCapacity();