From 130000e068ec68a10fc632ee4ffc8a5fb563159b Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Wed, 9 Oct 2013 01:37:00 +0200 Subject: [PATCH] kernel: Dump scheduler specific thread data --- src/system/kernel/scheduler/scheduler_affine.cpp | 3 ++- src/system/kernel/scheduler/scheduler_simple.cpp | 15 ++++++++++++++- .../kernel/scheduler/scheduler_simple_smp.cpp | 3 ++- src/system/kernel/thread.cpp | 4 ++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/scheduler/scheduler_affine.cpp b/src/system/kernel/scheduler/scheduler_affine.cpp index fde10f0d59..471b53ef7c 100644 --- a/src/system/kernel/scheduler/scheduler_affine.cpp +++ b/src/system/kernel/scheduler/scheduler_affine.cpp @@ -547,7 +547,8 @@ static scheduler_ops kAffineOps = { affine_on_thread_create, affine_on_thread_init, affine_on_thread_destroy, - affine_start + affine_start, + NULL }; diff --git a/src/system/kernel/scheduler/scheduler_simple.cpp b/src/system/kernel/scheduler/scheduler_simple.cpp index 40a789aa98..fe359299fd 100644 --- a/src/system/kernel/scheduler/scheduler_simple.cpp +++ b/src/system/kernel/scheduler/scheduler_simple.cpp @@ -120,6 +120,18 @@ dump_run_queue(int argc, char** argv) } +static void +simple_dump_thread_data(scheduler_thread_data* schedulerThreadData) +{ + kprintf("\tpriority_penalty:\t%" B_PRId32 "\n", + schedulerThreadData->priority_penalty); + kprintf("\tforced_yield_count:\t%" B_PRId32 "\n", + schedulerThreadData->forced_yield_count); + kprintf("\tstolen_time:\t\t%" B_PRId64 "\n", + schedulerThreadData->stolen_time); +} + + static inline int32 simple_get_effective_priority(Thread* thread) { @@ -563,7 +575,8 @@ static scheduler_ops kSimpleOps = { simple_on_thread_create, simple_on_thread_init, simple_on_thread_destroy, - simple_start + simple_start, + simple_dump_thread_data }; diff --git a/src/system/kernel/scheduler/scheduler_simple_smp.cpp b/src/system/kernel/scheduler/scheduler_simple_smp.cpp index d30ce9c3a7..e596014743 100644 --- a/src/system/kernel/scheduler/scheduler_simple_smp.cpp +++ b/src/system/kernel/scheduler/scheduler_simple_smp.cpp @@ -462,7 +462,8 @@ static scheduler_ops kSimpleSMPOps = { on_thread_create, on_thread_init, on_thread_destroy, - start + start, + NULL }; diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index 781720c1c6..66972e70bf 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -1786,6 +1786,10 @@ _dump_thread_info(Thread *thread, bool shortInfo) kprintf("flags: 0x%" B_PRIx32 "\n", thread->flags); kprintf("architecture dependant section:\n"); arch_thread_dump_info(&thread->arch_info); + if (gScheduler->dump_thread_data != NULL) { + kprintf("scheduler data:\n"); + gScheduler->dump_thread_data(thread->scheduler_data); + } }