Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Dec 2018 06:30:41 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341720 - in head/sys: kern sys
Message-ID:  <201812080630.wB86UfO2007755@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sat Dec  8 06:30:41 2018
New Revision: 341720
URL: https://svnweb.freebsd.org/changeset/base/341720

Log:
  Provide SDT_PROBES_ENABLED macro.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/kern_synch.c
  head/sys/sys/sdt.h

Modified: head/sys/kern/kern_synch.c
==============================================================================
--- head/sys/kern/kern_synch.c	Sat Dec  8 04:53:08 2018	(r341719)
+++ head/sys/kern/kern_synch.c	Sat Dec  8 06:30:41 2018	(r341720)
@@ -431,7 +431,7 @@ mi_switch(int flags, struct thread *newtd)
 	CTR4(KTR_PROC, "mi_switch: old thread %ld (td_sched %p, pid %ld, %s)",
 	    td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name);
 #ifdef KDTRACE_HOOKS
-	if (__predict_false(sdt_probes_enabled) &&
+	if (SDT_PROBES_ENABLED() &&
 	    ((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 &&
 	    (flags & SW_TYPE_MASK) == SWT_NEEDRESCHED)))
 		SDT_PROBE0(sched, , , preempt);

Modified: head/sys/sys/sdt.h
==============================================================================
--- head/sys/sys/sdt.h	Sat Dec  8 04:53:08 2018	(r341719)
+++ head/sys/sys/sdt.h	Sat Dec  8 06:30:41 2018	(r341720)
@@ -164,8 +164,10 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
 #define SDT_PROBE_DECLARE(prov, mod, func, name)				\
 	extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
 
+#define	SDT_PROBES_ENABLED()	__predict_false(sdt_probes_enabled)
+
 #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)	do {	\
-	if (__predict_false(sdt_probes_enabled)) {				\
+	if (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,	\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812080630.wB86UfO2007755>