Fix profile saver reference point when calculating the sleep time
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
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index 9f6cfb7..9822f6e 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -120,7 +120,7 @@
{
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 @@
{
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)) {