bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 gnumach] Add timing info to MACH_LOCK_MON lock monitoring


From: Damien Zammit
Subject: [PATCH v2 gnumach] Add timing info to MACH_LOCK_MON lock monitoring
Date: Sat, 22 Jul 2023 04:50:50 +0000

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)
---
 kern/lock_mon.c | 10 ++++------
 1 file 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
-- 
2.40.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]