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
Change-Id: I88ab36c18b3b7b6e310bcdc6c59cadedc4cc9260
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index c5d3ccd..a773e1f 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)) {