diff --git a/etc/make/conf.mk b/etc/make/conf.mk index ed766da..1c7b151 100644 --- a/etc/make/conf.mk +++ b/etc/make/conf.mk @@ -95,3 +95,7 @@ endif DIRS+=$(O)/sys/vfs/ext2 \ $(O)/sys/net \ $(O)/sys/blk + +ifeq ($(DEBUG_COUNTERS),1) +CFLAGS+=-DDEBUG_COUNTERS +endif diff --git a/sys/amd64/sys/sched.c b/sys/amd64/sys/sched.c index 262992d..a1e5ec8 100644 --- a/sys/amd64/sys/sched.c +++ b/sys/amd64/sys/sched.c @@ -304,6 +304,7 @@ void sched_reboot(unsigned int cmd) { t_user_init->sigq |= 1 << (SIGTERM - 1); } +#if defined(DEBUG_COUNTERS) static uint64_t debug_last_tick = 0; static void debug_print_thread_name(int level, struct thread *thr) { @@ -401,6 +402,7 @@ static void debug_stats(void) { syscall_count = 0; } +#endif int sched(void) { struct thread *from = get_cpu()->thread; @@ -408,12 +410,13 @@ int sched(void) { int cpu = get_cpu()->processor_id; uintptr_t flags; - (void) debug_stats; +#if defined(DEBUG_COUNTERS) // Print various stuff every second if (!cpu && system_time - debug_last_tick >= 1000000000) { - //debug_stats(); + debug_stats(); debug_last_tick = system_time; } +#endif if (from == &t_idle[cpu]) { from = NULL;