mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Unify kernel debug messages, avoid printing time if unavailable
This commit is contained in:
parent
5791072280
commit
9b12571a86
Notes:
sideshowbarker
2024-07-19 16:58:12 +09:00
Author: https://github.com/konradekk Commit: https://github.com/SerenityOS/serenity/commit/9b12571a86b Pull-request: https://github.com/SerenityOS/serenity/pull/16781 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/gmta
1 changed files with 10 additions and 9 deletions
|
@ -886,10 +886,8 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
|
||||
#ifdef AK_OS_SERENITY
|
||||
# ifdef KERNEL
|
||||
if (Kernel::Processor::is_initialized()) {
|
||||
struct timespec ts = {};
|
||||
if (TimeManagement::is_initialized())
|
||||
ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
if (Kernel::Processor::is_initialized() && TimeManagement::is_initialized()) {
|
||||
struct timespec ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
if (Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("{}.{:03} \033[34;1m[#{} {}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, Kernel::Processor::current_id(), thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
|
@ -940,14 +938,17 @@ void vdmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
# ifdef AK_OS_SERENITY
|
||||
struct timespec ts = {};
|
||||
|
||||
if (TimeManagement::is_initialized())
|
||||
if (TimeManagement::is_initialized()) {
|
||||
ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("{}.{:03} \033[34;1m[{}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("{}.{:03} \033[34;1m[{}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
} else {
|
||||
builder.appendff("{}.{:03} \033[34;1m[Kernel]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000);
|
||||
}
|
||||
} else {
|
||||
builder.appendff("{}.{:03} \033[34;1m[Kernel]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000);
|
||||
builder.appendff("\033[34;1m[Kernel]\033[0m: ");
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue