diff options
author | Tom <tomut@yahoo.com> | 2021-07-15 14:54:19 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-15 23:46:37 +0200 |
commit | 82e9fe8d6726564475c5620099efc737de5e44f5 (patch) | |
tree | b0655b3580853e4c50a0dd333ecc6d09744e33f5 /Kernel/Scheduler.cpp | |
parent | 0150ae4bbdb328f9d2b447e51995bded5f66cd07 (diff) | |
download | serenity-82e9fe8d6726564475c5620099efc737de5e44f5.zip |
Kernel: Optionally dump scheduler state with stack traces
This will dump stack traces of all threads when pressing
Ctrl+Shift+Alt+F12
Diffstat (limited to 'Kernel/Scheduler.cpp')
-rw-r--r-- | Kernel/Scheduler.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index ef3e702aca..21f1762467 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -53,7 +53,7 @@ static SpinLock<u8> g_ready_queues_lock; static u32 g_ready_queues_mask; static constexpr u32 g_ready_queue_buckets = sizeof(g_ready_queues_mask) * 8; READONLY_AFTER_INIT static ThreadReadyQueue* g_ready_queues; // g_ready_queue_buckets entries -static void dump_thread_list(); +static void dump_thread_list(bool = false); static inline u32 thread_priority_to_priority_index(u32 thread_priority) { @@ -526,9 +526,9 @@ void Scheduler::idle_loop(void*) } } -void Scheduler::dump_scheduler_state() +void Scheduler::dump_scheduler_state(bool with_stack_traces) { - dump_thread_list(); + dump_thread_list(with_stack_traces); } bool Scheduler::is_initialized() @@ -537,7 +537,7 @@ bool Scheduler::is_initialized() return Processor::idle_thread() != nullptr; } -void dump_thread_list() +void dump_thread_list(bool with_stack_traces) { dbgln("Scheduler thread list for processor {}:", Processor::id()); @@ -580,6 +580,8 @@ void dump_thread_list() thread.times_scheduled()); break; } + if (with_stack_traces) + dbgln("{}", thread.backtrace()); }); } |