aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sdt.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2017-10-22 20:22:23 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2017-10-22 20:22:23 +0000
commit5a17c5524fe977d5b8fddac04d24184d80824196 (patch)
treec4d1d24d064438d22d99e37e4ac88ec8a9847a9d /sys/sys/sdt.h
parentcc1307b67f847bda93317f700731598c88d54049 (diff)
downloadsrc-5a17c5524fe977d5b8fddac04d24184d80824196.tar.gz
src-5a17c5524fe977d5b8fddac04d24184d80824196.zip
sdt: make all sdt probe sites test one variable
This saves on cache misses at the expense of a slight grow of .text. Note this is a bandaid for lack of hotpatching. Discussed with: markj
Notes
Notes: svn path=/head/; revision=324869
Diffstat (limited to 'sys/sys/sdt.h')
-rw-r--r--sys/sys/sdt.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 25423d764e3c..6771bf9f1177 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -80,6 +80,8 @@
#include <sys/cdefs.h>
#include <sys/linker_set.h>
+extern volatile bool sdt_probes_enabled;
+
#ifndef KDTRACE_HOOKS
#define SDT_PROVIDER_DEFINE(prov)
@@ -161,10 +163,12 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \
- if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \
+ if (__predict_false(sdt_probes_enabled)) { \
+ if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \
(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \
(uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \
(uintptr_t) arg3, (uintptr_t) arg4); \
+ } \
} while (0)
#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \