OSDN Git Service

Fix profile saver reference point when calculating the sleep time
authorCalin Juravle <calin@google.com>
Wed, 25 May 2016 17:09:53 +0000 (18:09 +0100)
committerNarayan Kamath <narayan@google.com>
Thu, 26 May 2016 10:00:40 +0000 (11:00 +0100)
It is wrong to use last_time_ns_saver_woke_up_ as a reference. We should
use sleep_start.

Bug: 28953776

(cherry picked from commit dc85bd757e7f27c38143536a9f4fa4c2c7d07272)

Change-Id: I400502c76a0423190826bbf1bd8e552cf591ebc3

runtime/jit/profile_saver.cc

index 9f6cfb7..9822f6e 100644 (file)
@@ -120,7 +120,7 @@ void ProfileSaver::Run() {
       {
         MutexLock mu(self, wait_lock_);
         period_condition_.Wait(self);
-        sleep_time = NanoTime() - last_time_ns_saver_woke_up_;
+        sleep_time = NanoTime() - sleep_start;
       }
       // Check if the thread was woken up for shutdown.
       if (ShuttingDown(self)) {
@@ -134,7 +134,7 @@ void ProfileSaver::Run() {
         {
           MutexLock mu(self, wait_lock_);
           period_condition_.TimedWait(self, NsToMs(kMinSavePeriodNs - sleep_time), 0);
-          sleep_time = NanoTime() - last_time_ns_saver_woke_up_;
+          sleep_time = NanoTime() - sleep_start;
         }
         // Check if the thread was woken up for shutdown.
         if (ShuttingDown(self)) {