kern: update scheduler for new switch count tracking logic

This commit is contained in:
Michael Scire
2023-02-21 03:12:17 -07:00
parent 8176f085f1
commit 3a5f406c5f
6 changed files with 39 additions and 18 deletions

View File

@@ -88,10 +88,12 @@ namespace ams::kern {
if (m_state.should_count_idle) {
if (AMS_LIKELY(highest_thread != nullptr)) {
if (KProcess *process = highest_thread->GetOwnerProcess(); process != nullptr) {
process->SetRunningThread(m_core_id, highest_thread, m_state.idle_count);
/* Set running thread (and increment switch count). */
process->SetRunningThread(m_core_id, highest_thread, m_state.idle_count, ++m_state.switch_count);
}
} else {
m_state.idle_count++;
/* Set idle count and switch count to switch count + 1. */
m_state.idle_count = ++m_state.switch_count;
}
}