From b172c94f398c782d53a3147250c71e3c0eafe890 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 24 Nov 2023 14:48:05 +0800 Subject: [PATCH] 1 --- f8/app.cc | 6 ++++-- f8/timer.cc | 5 +++++ f8/timer.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/f8/app.cc b/f8/app.cc index c19c7ab..0153a66 100644 --- a/f8/app.cc +++ b/f8/app.cc @@ -217,15 +217,17 @@ namespace f8 has_task = user_app_->HasTask(); } if (!has_task) { -#if 1 +#if 0 int sleep_time = 1; loop_cond_->wait_for(lk, std::chrono::milliseconds(sleep_time)); #else - int sleep_time = f8::Timer::Instance()->GetIdleableMillSeconds(); + int sleep_time = f8::Timer::Instance()->GetIdleTime(); loop_cond_->wait_for(lk, std::chrono::milliseconds(sleep_time)); + #if 0 if (sleep_time > perf.max_timer_idle) { perf.max_timer_idle = sleep_time; } + #endif #endif } } diff --git a/f8/timer.cc b/f8/timer.cc index 7b7f31b..a2f8d9b 100644 --- a/f8/timer.cc +++ b/f8/timer.cc @@ -115,4 +115,9 @@ namespace f8 return xtimer_.IsRunning(); } + long long Timer::GetIdleTime() + { + return xtimer_.GetIdleTime(); + } + } diff --git a/f8/timer.h b/f8/timer.h index 71a1db0..31a9f80 100644 --- a/f8/timer.h +++ b/f8/timer.h @@ -58,6 +58,7 @@ namespace f8 long long GetRemainTime(TimerWp& timer_wp); void DeleteCurrentTimer(); bool IsRunning(); + long long GetIdleTime(); private: bool initialized_ = false;