PERFORCE change 143184 for review

John Birrell jb at FreeBSD.org
Mon Jun 9 06:56:25 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=143184

Change 143184 by jb at freebsd3 on 2008/06/09 06:56:04

	Add the cyclic timer hook for DTrace.

Affected files ...

.. //depot/projects/dtrace6/src/sys/amd64/amd64/local_apic.c#4 edit

Differences ...

==== //depot/projects/dtrace6/src/sys/amd64/amd64/local_apic.c#4 (text+ko) ====

@@ -35,6 +35,7 @@
 __FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.17.2.15 2007/11/08 20:09:45 jhb Exp $");
 
 #include "opt_hwpmc_hooks.h"
+#include "opt_kdtrace.h"
 
 #include "opt_ddb.h"
 
@@ -65,6 +66,11 @@
 #include <ddb/ddb.h>
 #endif
 
+#ifdef KDTRACE_HOOKS
+#include <sys/dtrace_bsd.h>
+cyclic_clock_func_t	lapic_cyclic_clock_func[MAXCPU];
+#endif
+
 /* Sanity checks on IDT vectors. */
 CTASSERT(APIC_IO_INTS + APIC_NUM_IOINTS == APIC_TIMER_INT);
 CTASSERT(APIC_TIMER_INT < APIC_LOCAL_INTS);
@@ -662,6 +668,17 @@
 	(*la->la_timer_count)++;
 	critical_enter();
 
+#ifdef KDTRACE_HOOKS
+	/*
+	 * If the DTrace hooks are configured and a callback function
+	 * has been registered, then call it to process the high speed
+	 * timers.
+	 */
+	int cpu = PCPU_GET(cpuid);
+	if (lapic_cyclic_clock_func[cpu] != NULL)
+		(*lapic_cyclic_clock_func[cpu])(frame);
+#endif
+
 	/* Fire hardclock at hz. */
 	la->la_hard_ticks += hz;
 	if (la->la_hard_ticks >= lapic_timer_hz) {


More information about the p4-projects mailing list