aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2017-12-31 09:23:02 +0000
committerColin Percival <cperciva@FreeBSD.org>2017-12-31 09:23:02 +0000
commit95e678f96e8df33773582f7e43f8e3a9a86a8d11 (patch)
treea8faa742b67998d8d526f4d1807cedd92eaea5ad /sys
parent6032e08810f5aa15ef849fe45f475d24448698fa (diff)
downloadsrc-95e678f96e8df33773582f7e43f8e3a9a86a8d11.tar.gz
src-95e678f96e8df33773582f7e43f8e3a9a86a8d11.zip
Use the TSLOG framework to record SYSINIT entry/exit timestamps.
Notes
Notes: svn path=/head/; revision=327427
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/kernel.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index ea3bf2620dab..2e103c7804b1 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -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,6 +232,35 @@ 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, \
@@ -237,6 +269,7 @@ struct sysinit {
(ident) \
}; \
DATA_SET(sysinit_set,uniquifier ## _sys_init)
+#endif
#define SYSINIT(uniquifier, subsystem, order, func, ident) \
C_SYSINIT(uniquifier, subsystem, order, \