svn commit: r327427 - head/sys/sys

Colin Percival cperciva at FreeBSD.org
Sun Dec 31 09:23:04 UTC 2017


Author: cperciva
Date: Sun Dec 31 09:23:02 2017
New Revision: 327427
URL: https://svnweb.freebsd.org/changeset/base/327427

Log:
  Use the TSLOG framework to record SYSINIT entry/exit timestamps.

Modified:
  head/sys/sys/kernel.h

Modified: head/sys/sys/kernel.h
==============================================================================
--- head/sys/sys/kernel.h	Sun Dec 31 09:22:31 2017	(r327426)
+++ head/sys/sys/kernel.h	Sun Dec 31 09:23:02 2017	(r327427)
@@ -54,6 +54,9 @@
 /* for intrhook below */
 #include <sys/queue.h>
 
+/* for timestamping SYSINITs; other files may assume this is included here */
+#include <sys/tslog.h>
+
 /* Global variables for the kernel. */
 
 /* 1.1 */
@@ -229,14 +232,44 @@ struct sysinit {
  * correct warnings when -Wcast-qual is used.
  *
  */
+#ifdef TSLOG
+struct sysinit_tslog {
+	sysinit_cfunc_t func;
+	const void * data;
+	const char * name;
+};
+static inline void
+sysinit_tslog_shim(const void * data)
+{
+	const struct sysinit_tslog * x = data;
+
+	TSRAW(curthread, TS_ENTER, "SYSINIT", x->name);
+	(x->func)(x->data);
+	TSRAW(curthread, TS_EXIT, "SYSINIT", x->name);
+}
 #define	C_SYSINIT(uniquifier, subsystem, order, func, ident)	\
+	static struct sysinit_tslog uniquifier ## _sys_init_tslog = {	\
+		func,						\
+		(ident),					\
+		#uniquifier					\
+	};							\
 	static struct sysinit uniquifier ## _sys_init = {	\
 		subsystem,					\
 		order,						\
+		sysinit_tslog_shim,				\
+		&uniquifier ## _sys_init_tslog			\
+	};							\
+	DATA_SET(sysinit_set,uniquifier ## _sys_init)
+#else
+#define	C_SYSINIT(uniquifier, subsystem, order, func, ident)	\
+	static struct sysinit uniquifier ## _sys_init = {	\
+		subsystem,					\
+		order,						\
 		func,						\
 		(ident)						\
 	};							\
 	DATA_SET(sysinit_set,uniquifier ## _sys_init)
+#endif
 
 #define	SYSINIT(uniquifier, subsystem, order, func, ident)	\
 	C_SYSINIT(uniquifier, subsystem, order,			\


More information about the svn-src-head mailing list