OSDN Git Service

ART: Fix JIT profile saver
authorSerguei Katkov <serguei.i.katkov@intel.com>
Mon, 1 Aug 2016 10:47:04 +0000 (17:47 +0700)
committerCalin Juravle <calin@google.com>
Wed, 10 Aug 2016 14:47:58 +0000 (14:47 +0000)
We miss the case when jit activity notification count exceeds
the threshold. Fix it.

Bug: 30583550
Test: manual test in master

Change-Id: Ib10a34d3c2f5d3cf674b1c4d7a3c1204784865d3
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
runtime/jit/profile_saver.cc

index 5a469e5..b35c958 100644 (file)
@@ -176,14 +176,13 @@ void ProfileSaver::NotifyJitActivityInternal() {
     MutexLock wait_mutex(Thread::Current(), wait_lock_);
     if ((NanoTime() - last_time_ns_saver_woke_up_) > MsToNs(options_.GetMinSavePeriodMs())) {
       WakeUpSaver();
+    } else if (jit_activity_notifications_ > options_.GetMaxNotificationBeforeWake()) {
+      // Make sure to wake up the saver if we see a spike in the number of notifications.
+      // This is a precaution to avoid losing a big number of methods in case
+      // this is a spike with no jit after.
+      total_number_of_hot_spikes_++;
+      WakeUpSaver();
     }
-  } else if (jit_activity_notifications_ > options_.GetMaxNotificationBeforeWake()) {
-    // Make sure to wake up the saver if we see a spike in the number of notifications.
-    // This is a precaution to avoid "loosing" a big number of methods in case
-    // this is a spike with no jit after.
-    total_number_of_hot_spikes_++;
-    MutexLock wait_mutex(Thread::Current(), wait_lock_);
-    WakeUpSaver();
   }
 }