svn commit: r237859 - in projects/calloutng/sys: conf kern
Davide Italiano
davide at FreeBSD.org
Sat Jun 30 23:34:34 UTC 2012
Author: davide
Date: Sat Jun 30 23:34:33 2012
New Revision: 237859
URL: http://svn.freebsd.org/changeset/base/237859
Log:
Add a new CALLOUT_PROFILING option so that SYSCTLs on the wheel may be
selectively disabled/enabled. Reintroduce a SYSCTL that I wrongly removed
in a previous commit. Selectively disabling this sort of rudimentary
profiling may have a good effect on CPU caches because same variable is not
accessed anymore by different CPUs.
Discussed with: mav
Modified:
projects/calloutng/sys/conf/NOTES
projects/calloutng/sys/conf/options
projects/calloutng/sys/kern/kern_timeout.c
Modified: projects/calloutng/sys/conf/NOTES
==============================================================================
--- projects/calloutng/sys/conf/NOTES Sat Jun 30 23:29:34 2012 (r237858)
+++ projects/calloutng/sys/conf/NOTES Sat Jun 30 23:34:33 2012 (r237859)
@@ -1,4 +1,4 @@
-# $FreeBSD$
+
#
# NOTES -- Lines that can be cut/pasted into kernel and hints configs.
#
@@ -259,6 +259,8 @@ options SX_NOINLINE
# SMP Debugging Options:
#
+# CALLOUT_PROFILING enables rudimentary profiling of the callwheel data
+# structure used as backend in callout(9).
# PREEMPTION allows the threads that are in the kernel to be preempted by
# higher priority [interrupt] threads. It helps with interactivity
# and allows interrupt threads to run sooner rather than waiting.
@@ -297,6 +299,9 @@ options LOCK_PROFILING
options MPROF_BUFFERS="1536"
options MPROF_HASH_SIZE="1543"
+# Profiling for the callout(9) backend.
+options CALLOUT_PROFILING
+
# Profiling for internal hash tables.
options SLEEPQUEUE_PROFILING
options TURNSTILE_PROFILING
Modified: projects/calloutng/sys/conf/options
==============================================================================
--- projects/calloutng/sys/conf/options Sat Jun 30 23:29:34 2012 (r237858)
+++ projects/calloutng/sys/conf/options Sat Jun 30 23:34:33 2012 (r237859)
@@ -66,6 +66,7 @@ SYSCTL_DEBUG opt_sysctl.h
ADAPTIVE_LOCKMGRS
ALQ
AUDIT opt_global.h
+CALLOUT_PROFILING
CAPABILITIES opt_capsicum.h
CAPABILITY_MODE opt_capsicum.h
CODA_COMPAT_5 opt_coda.h
Modified: projects/calloutng/sys/kern/kern_timeout.c
==============================================================================
--- projects/calloutng/sys/kern/kern_timeout.c Sat Jun 30 23:29:34 2012 (r237858)
+++ projects/calloutng/sys/kern/kern_timeout.c Sat Jun 30 23:34:33 2012 (r237859)
@@ -37,6 +37,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_callout_profiling.h"
#include "opt_kdtrace.h"
#include <sys/param.h>
@@ -69,6 +70,10 @@ SDT_PROBE_DEFINE(callout_execute, kernel
SDT_PROBE_ARGTYPE(callout_execute, kernel, , callout_end, 0,
"struct callout *");
+#ifdef CALLOUT_PROFILING
+static int avg_depth;
+SYSCTL_INT(_debug, OID_AUTO, to_avg_depth, CTLFLAG_RD, &avg_depth, 0,
+ "Average number of items examined per softclock call. Units = 1/1000");
static int avg_gcalls;
SYSCTL_INT(_debug, OID_AUTO, to_avg_gcalls, CTLFLAG_RD, &avg_gcalls, 0,
"Average number of Giant callouts made per softclock call. Units = 1/1000");
@@ -78,6 +83,7 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_lock
static int avg_mpcalls;
SYSCTL_INT(_debug, OID_AUTO, to_avg_mpcalls, CTLFLAG_RD, &avg_mpcalls, 0,
"Average number of MP callouts made per softclock call. Units = 1/1000");
+#endif
/*
* TODO:
* allocate more timeout table slots when table overflows.
@@ -784,10 +790,12 @@ softclock(void *arg)
steps = 0;
}
}
-
+#ifdef CALLOUT_PROFILING
+ avg_depth += (depth * 1000 - avg_depth) >> 8;
avg_mpcalls += (mpcalls * 1000 - avg_mpcalls) >> 8;
avg_lockcalls += (lockcalls * 1000 - avg_lockcalls) >> 8;
avg_gcalls += (gcalls * 1000 - avg_gcalls) >> 8;
+#endif
cc->cc_next = NULL;
CC_UNLOCK(cc);
}
More information about the svn-src-projects
mailing list