From 50315a1d20e99a3751e44ed79dcae33439e82331 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 22 Sep 2011 10:58:03 +0200 Subject: [PATCH] dump every minute the average cpu load --- arch/x86/kernel/timer.c | 6 +++++- include/metalsvm/tasks.h | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/timer.c b/arch/x86/kernel/timer.c index 70f62b1c..a2d4ed9f 100644 --- a/arch/x86/kernel/timer.c +++ b/arch/x86/kernel/timer.c @@ -79,12 +79,16 @@ static void timer_handler(struct state *s) /*if (timer_ticks % TIMER_FREQ == 0) { vga_puts("One second has passed\n"); }*/ + + /* Dump load every minute */ + if (timer_ticks % (TIMER_FREQ*60) == 0) + dump_load(); } update_load(); #if MAX_CORES > 1 - if ((atomic_int32_read(&cpu_online) > 1) && (timer_ticks % (TIMER_FREQ/5) == 0)) + if (atomic_int32_read(&cpu_online) > 1) load_balancing(); #endif } diff --git a/include/metalsvm/tasks.h b/include/metalsvm/tasks.h index 3f4589cb..55056cbd 100644 --- a/include/metalsvm/tasks.h +++ b/include/metalsvm/tasks.h @@ -92,6 +92,11 @@ tid_t wait(int32_t* result); */ void update_load(void); +/** @brief Print the current cpu load + * + */ +void dump_load(void); + #if MAX_CORES > 1 /** @brief Load balancer * @@ -103,7 +108,8 @@ void load_balancing(void); /** @brief Task switcher * - * Timer-interrupted use of this function for task switching */ + * Timer-interrupted use of this function for task switching + */ void scheduler(void); /** @brief Wake up a blocked task