summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-07-22 14:38:06 +1000
committerDamien Zammit <damien@zamaudio.com>2023-07-22 14:38:06 +1000
commit3aca429f24dcb0f8c725bd2480bc112a8ff55d5a (patch)
tree60da62eee7c217a53840b21f9d941be0b979fe7f
parentbdcafee412ab6eec58f6b315e16e57fe3dad002f (diff)
Add timing info to MACH_LOCK_MON lock monitoringmach-lock-mon
Booting to beginning of bootstrap with different number of cpus and checking the lock statistics where TIME is in milliseconds: Set MACH_LOCK_MON to 1 in configfrag.ac, then Configure options --enable-ncpus=8 --enable-kdb --enable-apic --disable-linux-groups -smp 1 db{0}> show all slocks SUCCESS FAIL MASKED STACK TIME LOCK/CALLER 4208 0/0 4208/100 2/0 7890/1 0xc1098f54(c11847c8) 1 0/0 1/100 0/0 7890/7890 0x315(c11966e0) 30742 0/0 0/0 2106/0 160/0 0xf52a9e2c(f5a07958) 30742 0/0 0/0 0/0 140/0 0xf52a5e2c(f5a07b10) 149649 0/0 3372/2 1/0 120/0 0xc118a590(c118a9d4) 16428 0/0 0/0 1/0 90/0 0xf52a5dd0(f5a07ab8) 14345 0/0 0/0 18/0 80/0 0xf64afe2c(f64aa488) 1791 0/0 0/0 1/0 80/0 0xf52a3e70(f5e57f70) 17331 total locks, 0 empty buckets 2320150 0/0 455490/19 11570533/4 17860/0 0xc10a4580(c10a4580) -smp 2 (could not wait until booted) db{0}> show all slocks SUCCESS FAIL MASKED STACK TIME LOCK/CALLER 47082 0/0 47082/100 0/0 413940/8 0xc1098f54(c11847c8) 2 0/0 2/100 0/0 413940/206970 0x6ede(c11966e0) 47139 0/0 0/0 2106/0 4670/0 0xc119edec(f5e409b0) 132895 3/0 3372/2 1/0 4580/0 0xc118a590(c118a9d4) 118313 0/0 2/0 0/0 3660/0 0xc1098ec4(c1189f80) 183233 1/0 1714/0 2/0 2290/0 0xc1098e54(c118aa8c) 14357 0/0 0/0 1878/0 1200/0 0xf52a4de0(f5e40a60) 14345 0/0 0/0 18/0 1200/0 0xf52a4dec(f528f488) 16910 total locks, 0 empty buckets 2220850 455/0 485391/21 11549793/5 879030/0 0xc10a4580(c10a4580)
-rw-r--r--kern/lock_mon.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kern/lock_mon.c b/kern/lock_mon.c
index b8216788..3ca4592c 100644
--- a/kern/lock_mon.c
+++ b/kern/lock_mon.c
@@ -46,6 +46,7 @@
#include <kern/thread.h>
#include <kern/lock.h>
#include <kern/printf.h>
+#include <kern/mach_clock.h>
#include <machine/ipl.h>
#include <ddb/db_sym.h>
#include <ddb/db_output.h>
@@ -56,13 +57,10 @@ def_simple_lock_data(, kdb_lock)
def_simple_lock_data(, printf_lock)
#if NCPUS > 1 && MACH_LOCK_MON
-
-#if TIME_STAMP
-extern time_stamp_t time_stamp;
-#else /* TIME_STAMP */
+#define TIME_STAMP 1
typedef unsigned int time_stamp_t;
-#define time_stamp 0
-#endif /* TIME_STAMP */
+/* in milliseconds */
+#define time_stamp (elapsed_ticks * 1000 / hz)
#define LOCK_INFO_MAX (1024*32)
#define LOCK_INFO_HASH_COUNT 1024