OSDN Git Service

Dump the number of OSR compiled code.
authorNicolas Geoffray <ngeoffray@google.com>
Thu, 25 Feb 2016 13:27:47 +0000 (13:27 +0000)
committerNicolas Geoffray <ngeoffray@google.com>
Thu, 25 Feb 2016 13:27:47 +0000 (13:27 +0000)
Change-Id: I20efc80e8556da8220dab92c3a7947f883d48cf8

runtime/jit/jit.cc
runtime/jit/jit_code_cache.cc
runtime/jit/jit_code_cache.h

index bdc7ee2..cdf09bf 100644 (file)
@@ -63,7 +63,8 @@ void Jit::DumpInfo(std::ostream& os) {
      << "JIT data cache size=" << PrettySize(code_cache_->DataCacheSize()) << "\n"
      << "JIT current capacity=" << PrettySize(code_cache_->GetCurrentCapacity()) << "\n"
      << "JIT number of compiled code=" << code_cache_->NumberOfCompiledCode() << "\n"
-     << "JIT total number of compilations=" << code_cache_->NumberOfCompilations() << "\n";
+     << "JIT total number of compilations=" << code_cache_->NumberOfCompilations() << "\n"
+     << "JIT total number of osr compilations=" << code_cache_->NumberOfOsrCompilations() << "\n";
   cumulative_timings_.Dump(os);
 }
 
index 478b164..8858b48 100644 (file)
@@ -128,7 +128,8 @@ JitCodeCache::JitCodeCache(MemMap* code_map,
       garbage_collect_code_(garbage_collect_code),
       used_memory_for_data_(0),
       used_memory_for_code_(0),
-      number_of_compilations_(0) {
+      number_of_compilations_(0),
+      number_of_osr_compilations_(0) {
 
   DCHECK_GE(max_capacity, initial_code_capacity + initial_data_capacity);
   code_mspace_ = create_mspace_with_base(code_map_->Begin(), code_end_, false /*locked*/);
@@ -338,6 +339,7 @@ uint8_t* JitCodeCache::CommitCodeInternal(Thread* self,
     MutexLock mu(self, lock_);
     method_code_map_.Put(code_ptr, method);
     if (osr) {
+      number_of_osr_compilations_++;
       osr_code_map_.Put(method, code_ptr);
     } else {
       Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(
@@ -366,6 +368,11 @@ size_t JitCodeCache::NumberOfCompilations() {
   return number_of_compilations_;
 }
 
+size_t JitCodeCache::NumberOfOsrCompilations() {
+  MutexLock mu(Thread::Current(), lock_);
+  return number_of_osr_compilations_;
+}
+
 size_t JitCodeCache::CodeCacheSize() {
   MutexLock mu(Thread::Current(), lock_);
   return CodeCacheSizeLocked();
index e5b8e6c..4574edf 100644 (file)
@@ -73,6 +73,7 @@ class JitCodeCache {
 
   // Number of compilations done throughout the lifetime of the JIT.
   size_t NumberOfCompilations() REQUIRES(!lock_);
+  size_t NumberOfOsrCompilations() REQUIRES(!lock_);
 
   bool NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr)
       SHARED_REQUIRES(Locks::mutator_lock_)
@@ -304,6 +305,7 @@ class JitCodeCache {
 
   // Number of compilations done throughout the lifetime of the JIT.
   size_t number_of_compilations_ GUARDED_BY(lock_);
+  size_t number_of_osr_compilations_ GUARDED_BY(lock_);
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(JitCodeCache);
 };