Add an option for controlling debugging cycles

This commit is contained in:
Mark
2020-01-21 00:09:22 +02:00
parent 5f5f315a4b
commit beecf5e2b3
2 changed files with 9 additions and 2 deletions
+4
View File
@@ -95,3 +95,7 @@ endif
DIRS+=$(O)/sys/vfs/ext2 \
$(O)/sys/net \
$(O)/sys/blk
ifeq ($(DEBUG_COUNTERS),1)
CFLAGS+=-DDEBUG_COUNTERS
endif
+5 -2
View File
@@ -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;