diff options
author | jmg <jmg@FreeBSD.org> | 2004-08-19 06:38:26 +0000 |
---|---|---|
committer | jmg <jmg@FreeBSD.org> | 2004-08-19 06:38:26 +0000 |
commit | bead871bc0f3ff80e8f33ef17761a029b9bbd474 (patch) | |
tree | 3c7134810ae9368ab3c523ee533b8e18fb367227 /sys | |
parent | 268e93a97ab7c72fc1761c0b603ddbc58df9ce01 (diff) | |
download | FreeBSD-src-bead871bc0f3ff80e8f33ef17761a029b9bbd474.zip FreeBSD-src-bead871bc0f3ff80e8f33ef17761a029b9bbd474.tar.gz |
add options MPROF_BUFFERS and MPROF_HASH_SIZE that adjust the sizes of
the mutex profiling buffers. Document them in the man page and in NOTES.
Ensure _HASH_SIZE is larger than _BUFFERS with a cpp error.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/conf/NOTES | 4 | ||||
-rw-r--r-- | sys/conf/options | 2 | ||||
-rw-r--r-- | sys/kern/kern_mutex.c | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 60a625c..41e0e9e 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -222,6 +222,10 @@ options WITNESS_SKIPSPIN # MUTEX_PROFILING - Profiling mutual exclusion locks (mutexes). See # MUTEX_PROFILING(9) for details. options MUTEX_PROFILING +# Set the number of buffers and the hash size. The hash size MUST be larger +# than the number of buffers. Hash size should be prime. +options MPROF_BUFFERS="1536" +options MPROF_HASH_SIZE="1543" # Profiling for internal hash tables. options SLEEPQUEUE_PROFILING diff --git a/sys/conf/options b/sys/conf/options index b6ff58c..8c16d05 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -108,6 +108,8 @@ MAC_STUB opt_dontuse.h MAC_TEST opt_dontuse.h MD_ROOT opt_md.h MD_ROOT_SIZE opt_md.h +MPROF_BUFFERS opt_mprof.h +MPROF_HASH_SIZE opt_mprof.h MUTEX_WAKE_ALL NSWBUF_MIN opt_swap.h PANIC_REBOOT_WAIT_TIME opt_panic.h diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 884eeda..c041886 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_adaptive_mutexes.h" #include "opt_ddb.h" +#include "opt_mprof.h" #include "opt_mutex_wake_all.h" #include <sys/param.h> @@ -118,10 +119,19 @@ struct mutex_prof { * * Note: NUM_MPROF_BUFFERS must be smaller than MPROF_HASH_SIZE. */ +#ifdef MPROF_BUFFERS +#define NUM_MPROF_BUFFERS MPROF_BUFFERS +#else #define NUM_MPROF_BUFFERS 1000 +#endif static struct mutex_prof mprof_buf[NUM_MPROF_BUFFERS]; static int first_free_mprof_buf; +#ifndef MPROF_HASH_SIZE #define MPROF_HASH_SIZE 1009 +#endif +#if NUM_MPROF_BUFFERS >= MPROF_HASH_SIZE +#error MPROF_BUFFERS must be larger than MPROF_HASH_SIZE +#endif static struct mutex_prof *mprof_hash[MPROF_HASH_SIZE]; /* SWAG: sbuf size = avg stat. line size * number of locks */ #define MPROF_SBUF_SIZE 256 * 400 |