summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorchs <chs@NetBSD.org>2012-12-02 01:05:16 +0000
committerchs <chs@NetBSD.org>2012-12-02 01:05:16 +0000
commitdde9accaab0bbd279d26bd95b3ded3085bc3afd6 (patch)
tree9f72be6800cdf8ac1312510313727ea3f1fc4f89 /sys
parent4172f452c347a3918a0b823ca6aecc485bdf38e3 (diff)
adapt the cyclic module and profile dtrace provider to netbsd.
for now, just hook the cyclic callback into hardclock().
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_clock.c19
-rw-r--r--sys/modules/Makefile3
-rw-r--r--sys/modules/cyclic/Makefile16
-rw-r--r--sys/modules/dtrace/Makefile4
-rw-r--r--sys/modules/dtrace/profile/Makefile16
-rw-r--r--sys/sys/dtrace_bsd.h13
6 files changed, 56 insertions, 15 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index a95a386243d..e16c112ffe2 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_clock.c,v 1.130 2011/10/30 01:57:40 christos Exp $ */
+/* $NetBSD: kern_clock.c,v 1.131 2012/12/02 01:05:16 chs Exp $ */
/*-
* Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,8 +69,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.130 2011/10/30 01:57:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.131 2012/12/02 01:05:16 chs Exp $");
+#include "opt_dtrace.h"
#include "opt_ntp.h"
#include "opt_perfctrs.h"
@@ -93,6 +94,13 @@ __KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.130 2011/10/30 01:57:40 christos Ex
#include <sys/gmon.h>
#endif
+#ifdef KDTRACE_HOOKS
+#include <sys/dtrace_bsd.h>
+#include <sys/cpu.h>
+
+cyclic_clock_func_t cyclic_clock_func[MAXCPUS];
+#endif
+
/*
* Clock handling routines.
*
@@ -225,6 +233,13 @@ hardclock(struct clockframe *frame)
* Update real-time timeout queue.
*/
callout_hardclock();
+
+#ifdef KDTRACE_HOOKS
+ cyclic_clock_func_t func = cyclic_clock_func[cpu_index(ci)];
+ if (func) {
+ (*func)((struct clockframe *)frame);
+ }
+#endif
}
/*
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index d73e631d0d1..74ccbbe60ff 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.115 2012/11/06 07:59:09 alnsn Exp $
+# $NetBSD: Makefile,v 1.116 2012/12/02 01:05:16 chs Exp $
.include <bsd.own.mk>
@@ -241,6 +241,7 @@ SUBDIR+= dm
.endif
.if (${MKDTRACE} != "no")
+SUBDIR+= cyclic
SUBDIR+= dtrace
.endif
diff --git a/sys/modules/cyclic/Makefile b/sys/modules/cyclic/Makefile
new file mode 100644
index 00000000000..084b4bc369c
--- /dev/null
+++ b/sys/modules/cyclic/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD: src/sys/modules/dtrace/sdt/Makefile,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
+
+.include "../../Makefile.inc"
+
+.PATH: ${NETBSDSRCDIR}/external/cddl/osnet/dev/cyclic
+
+KMOD= cyclic
+SRCS= cyclic.c
+
+CPPFLAGS+= -I${NETBSDSRCDIR}/external/cddl/osnet/sys \
+ -I${NETBSDSRCDIR}/external/cddl/osnet/dev/cyclic/${MACHINE:S/amd64/i386/} \
+ -I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
+
+CPPFLAGS+= -Wno-unknown-pragmas -Wno-cast-qual
+
+.include <bsd.kmodule.mk>
diff --git a/sys/modules/dtrace/Makefile b/sys/modules/dtrace/Makefile
index ecd26282aee..88614aeb50b 100644
--- a/sys/modules/dtrace/Makefile
+++ b/sys/modules/dtrace/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2010/03/12 21:53:16 darran Exp $
+# $NetBSD: Makefile,v 1.4 2012/12/02 01:05:17 chs Exp $
# $FreeBSD: src/sys/modules/dtrace/Makefile,v 1.6.2.1 2009/08/03 08:13:06 kensmith Exp $
.include <bsd.own.mk>
-SUBDIR= dtrace sdt fbt
+SUBDIR= dtrace sdt fbt profile
.include <bsd.subdir.mk>
diff --git a/sys/modules/dtrace/profile/Makefile b/sys/modules/dtrace/profile/Makefile
new file mode 100644
index 00000000000..530a41c9f4d
--- /dev/null
+++ b/sys/modules/dtrace/profile/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.1 2012/12/02 01:05:17 chs Exp $
+
+.include "../../Makefile.inc"
+
+.PATH: ${NETBSDSRCDIR}/external/cddl/osnet/dev/profile
+
+KMOD= profile
+SRCS= profile.c
+
+CPPFLAGS+= -I${NETBSDSRCDIR}/external/cddl/osnet/sys \
+ -I${NETBSDSRCDIR}/external/cddl/osnet/dev/profile \
+ -I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
+
+CPPFLAGS+= -Wno-unknown-pragmas -Wno-cast-qual
+
+.include <bsd.kmodule.mk>
diff --git a/sys/sys/dtrace_bsd.h b/sys/sys/dtrace_bsd.h
index 0323910a002..2e282dbd757 100644
--- a/sys/sys/dtrace_bsd.h
+++ b/sys/sys/dtrace_bsd.h
@@ -1,4 +1,4 @@
-/* $NetBSD: dtrace_bsd.h,v 1.6 2012/12/02 00:05:38 chs Exp $ */
+/* $NetBSD: dtrace_bsd.h,v 1.7 2012/12/02 01:05:16 chs Exp $ */
/*-
* Copyright (c) 2007-2008 John Birrell (jb@freebsd.org)
@@ -55,15 +55,8 @@ struct ucred;
* Cyclic clock function type definition used to hook the cyclic
* subsystem into the appropriate timer interrupt.
*/
-typedef void (*cyclic_clock_func_t)(struct trapframe *);
-
-/*
- * These external variables are actually machine-dependent, so
- * they might not actually exist.
- *
- * Defining them here avoids a proliferation of header files.
- */
-extern cyclic_clock_func_t cyclic_clock_func[];
+typedef void (*cyclic_clock_func_t)(struct clockframe *);
+extern cyclic_clock_func_t cyclic_clock_func[];
/*
* The dtrace module handles traps that occur during a DTrace probe.