Fix profile save MaxBaxBackoff time
Bug: 27914456
Bug: 27937568
(cherry picked from commit 28530daffc05fe376dbd0df3b1b44257bce5a16f)
Change-Id: I072c4e41a5c0fc7941808109ec2f6fdd49130793
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index 70ea617..6599df2 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -120,16 +120,17 @@
FetchAndCacheResolvedClasses();
} else {
bool profile_saved_to_disk = ProcessProfilingInfo();
- if (!profile_saved_to_disk && save_period_ms < kMaxBackoffMs) {
- // If we don't need to save now it is less likely that we will need to do
- // so in the future. Increase the time between saves according to the
- // kBackoffCoef, but make it no larger than kMaxBackoffMs.
- save_period_ms = static_cast<uint64_t>(kBackoffCoef * save_period_ms);
- VLOG(profiler) << "Profile saver: nothing to save, delaying period to: " << save_period_ms;
- } else {
+ if (profile_saved_to_disk) {
// Reset the period to the initial value as it's highly likely to JIT again.
save_period_ms = kSavePeriodMs;
VLOG(profiler) << "Profile saver: saved something, period reset to: " << save_period_ms;
+ } else {
+ // If we don't need to save now it is less likely that we will need to do
+ // so in the future. Increase the time between saves according to the
+ // kBackoffCoef, but make it no larger than kMaxBackoffMs.
+ save_period_ms = std::min(kMaxBackoffMs,
+ static_cast<uint64_t>(kBackoffCoef * save_period_ms));
+ VLOG(profiler) << "Profile saver: nothing to save, delaying period to: " << save_period_ms;
}
}
cache_resolved_classes = false;