summaryrefslogtreecommitdiffstats
path: root/sys/sys/sdt.h
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2013-11-26 08:49:53 +0000
committeravg <avg@FreeBSD.org>2013-11-26 08:49:53 +0000
commit37cef93b68d0398a7db5f43bc15095c947a4e05d (patch)
tree3c2826d7902e6aefa433565539f3b4e7170abd61 /sys/sys/sdt.h
parent71889a5eff815ac21ca37c8402d0239ddc0239ec (diff)
downloadFreeBSD-src-37cef93b68d0398a7db5f43bc15095c947a4e05d.zip
FreeBSD-src-37cef93b68d0398a7db5f43bc15095c947a4e05d.tar.gz
sdt: add support for solaris/illumos style DTRACE_PROBE macros
The new macros are implemented in terms of SDT_PROBE_DEFINE and SDT_PROBE. Probes defined in this way will appear under SDT provider named "sdt". Parameter types are exposed via SDT_PROBE_ARGTYPE. This is something that illumos does not have by default. This kind of SDT probes is already present in ZFS code, so those probes will now be available if KDTRACE_HOOKS options is enabled. A potential future illumos compatibility enhancement is to encode a provider name as a prefix in a probe name. Reviewed by: markj MFC after: 3 weeks X-MFC after: r258622
Diffstat (limited to 'sys/sys/sdt.h')
-rw-r--r--sys/sys/sdt.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 9e39625..ca820f6 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -126,6 +126,14 @@
arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
xarg6)
+#define DTRACE_PROBE(name)
+#define DTRACE_PROBE1(name, type0, arg0)
+#define DTRACE_PROBE2(name, type0, arg0, type1, arg1)
+#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)
+#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)
+#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,\
+ type4, arg4)
+
#else
SET_DECLARE(sdt_providers_set, struct sdt_provider);
@@ -313,6 +321,51 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
(uintptr_t)arg6); \
} while (0)
+#define DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) do { \
+ static SDT_PROBE_DEFINE(sdt, , , name); \
+ SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4);
+#define DTRACE_PROBE_IMPL_END } while (0)
+
+#define DTRACE_PROBE(name) \
+ DTRACE_PROBE_IMPL_START(name, 0, 0, 0, 0, 0) \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE1(name, type0, arg0) \
+ DTRACE_PROBE_IMPL_START(name, arg0, 0, 0, 0, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, 0, 0, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, 0, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3, \
+ type4, arg4) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 4, #type4, NULL); \
+ DTRACE_PROBE_IMPL_END
+
#endif /* KDTRACE_HOOKS */
/*
@@ -365,6 +418,8 @@ struct sdt_provider {
void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
uintptr_t);
+SDT_PROVIDER_DECLARE(sdt);
+
#endif /* _KERNEL */
#endif /* _SYS_SDT_H */
OpenPOWER on IntegriCloud