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.
This commit is contained in:
parent
0cb507cb20
commit
000968010a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133998
@ -87,12 +87,18 @@ of monitoring.
|
||||
Since it would not be possible to call
|
||||
.Xr malloc 9
|
||||
from within the mutex profiling code, this is a static limit.
|
||||
The number of records can be changed with the
|
||||
.Dv MPROF_BUFFERS
|
||||
kernel option.
|
||||
.It Va debug.mutex.prof.rejected
|
||||
The number of acquisition points that were ignored after the table
|
||||
filled up.
|
||||
.It Va debug.mutex.prof.hashsize
|
||||
The size of the hash table used to map acquisition points to
|
||||
statistics records.
|
||||
The hash size can be changed with the
|
||||
.Dv MPROF_HASH_SIZE
|
||||
kernel option.
|
||||
.It Va debug.mutex.prof.collisions
|
||||
The number of hash collisions in the acquisition point hash table.
|
||||
.It Va debug.mutex.prof.stats
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user