Kernel: Show current_task's name in the log
This commit is contained in:
parent
f1bfa6bec8
commit
59506b8852
@ -2,6 +2,7 @@
|
||||
#include "io/Serial.h"
|
||||
#include "std/stdio.h"
|
||||
#include "thread/PIT.h"
|
||||
#include "thread/Scheduler.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
static int level_mask = 15;
|
||||
@ -22,7 +23,13 @@ static void log_backend_serial(const char* function, LogLevel level, const char*
|
||||
va_list ap;
|
||||
va_copy(ap, origin);
|
||||
Serial::reset_color();
|
||||
printf("[%ld.%ld] %s: ", PIT::ms_since_boot / 1000, PIT::ms_since_boot % 1000, function);
|
||||
if (Scheduler::current_task() && Scheduler::current_task()->id)
|
||||
{
|
||||
Task* current_task = Scheduler::current_task();
|
||||
printf("[%ld.%ld] (%s %ld) %s: ", PIT::ms_since_boot / 1000, PIT::ms_since_boot % 1000, current_task->name,
|
||||
current_task->id, function);
|
||||
}
|
||||
else { printf("[%ld.%ld] (kernel) %s: ", PIT::ms_since_boot / 1000, PIT::ms_since_boot % 1000, function); }
|
||||
switch (level)
|
||||
{
|
||||
case LogLevel::WARN: Serial::set_color(Color::Yellow); break;
|
||||
|
@ -91,6 +91,8 @@ void Scheduler::init()
|
||||
idle_task.user_task = false;
|
||||
idle_task.state = idle_task.Idle;
|
||||
|
||||
strlcpy(idle_task.name, "[cpu-idle]", sizeof(idle_task.name));
|
||||
|
||||
sched_current_task = &idle_task;
|
||||
|
||||
frequency = 1000 / PIT::frequency();
|
||||
|
Loading…
Reference in New Issue
Block a user