mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
If no context switch occurs, add 1 to the timesScheduled() for current.
This seems like more accurate accounting.
This commit is contained in:
parent
571dc8234f
commit
ba56f4afde
1 changed files with 10 additions and 9 deletions
|
@ -451,13 +451,6 @@ bool scheduleNewTask()
|
|||
return contextSwitch(Task::kernelTask());
|
||||
}
|
||||
|
||||
#if 0
|
||||
kprintf("Scheduler choices:\n");
|
||||
for (auto* task = s_tasks->head(); task; task = task->next()) {
|
||||
kprintf("%p %u %s\n", task, task->pid(), task->name().characters());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check and unblock tasks whose wait conditions have been met.
|
||||
for (auto* task = s_tasks->head(); task; task = task->next()) {
|
||||
if (task->state() == Task::BlockedSleep) {
|
||||
|
@ -475,6 +468,15 @@ bool scheduleNewTask()
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
kprintf("Scheduler choices:\n");
|
||||
for (auto* task = s_tasks->head(); task; task = task->next()) {
|
||||
if (task->state() == Task::BlockedWait || task->state() == Task::BlockedSleep)
|
||||
continue;
|
||||
kprintf("%w %s(%u)\n", task->state(), task->name().characters(), task->pid());
|
||||
}
|
||||
#endif
|
||||
|
||||
auto* prevHead = s_tasks->head();
|
||||
for (;;) {
|
||||
// Move head to tail.
|
||||
|
@ -509,6 +511,7 @@ static bool contextSwitch(Task* t)
|
|||
{
|
||||
//kprintf("c_s to %s (same:%u)\n", t->name().characters(), current == t);
|
||||
t->setTicksLeft(5);
|
||||
t->didSchedule();
|
||||
|
||||
if (current == t)
|
||||
return false;
|
||||
|
@ -562,8 +565,6 @@ static bool contextSwitch(Task* t)
|
|||
tssDescriptor.type = 11; // Busy TSS
|
||||
|
||||
flushGDT();
|
||||
|
||||
t->didSchedule();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue