fix flakiness of profile-handler_unittest

When checking if timer is enabled, we should look at
it_interval.
This commit is contained in:
Aliaksey Kandratsenka 2023-07-13 16:04:14 -04:00
parent 5ba98e397c
commit 55d559f7c9

View File

@ -130,14 +130,8 @@ void Delay(int delay_ns) {
bool IsTimerEnabled() {
itimerval current_timer;
EXPECT_EQ(0, getitimer(timer_type_, &current_timer));
if ((current_timer.it_value.tv_sec == 0) &&
(current_timer.it_value.tv_usec != 0)) {
// May be the timer has expired. Sleep for a bit and check again.
Delay(kTimerResetInterval);
EXPECT_EQ(0, getitimer(timer_type_, &current_timer));
}
return (current_timer.it_value.tv_sec != 0 ||
current_timer.it_value.tv_usec != 0);
return (current_timer.it_interval.tv_sec != 0 ||
current_timer.it_interval.tv_usec != 0);
}
// Dummy worker thread to accumulate cpu time.