patch-2.1.36 linux/arch/i386/kernel/irq.h

Next file: linux/arch/i386/kernel/ptrace.c
Previous file: linux/arch/i386/kernel/irq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/arch/i386/kernel/irq.h linux/arch/i386/kernel/irq.h
@@ -266,4 +266,26 @@
 	UNBLK_##chip(mask) \
 	"jmp ret_from_intr\n");
 
+/*
+ * x86 profiling function, SMP safe. We might want to do this in
+ * assembly totally?
+ */
+static inline void x86_do_profile (unsigned long eip)
+{
+	if (prof_buffer && current->pid) {
+		extern int _stext;
+		eip -= (unsigned long) &_stext;
+		eip >>= prof_shift;
+		if (eip < prof_len)
+			atomic_inc((atomic_t *)&prof_buffer[eip]);
+		else
+		/*
+		 * Dont ignore out-of-bounds EIP values silently,
+		 * put them into the last histogram slot, so if
+		 * present, they will show up as a sharp peak.
+		 */
+			atomic_inc((atomic_t *)&prof_buffer[prof_len-1]);
+	}
+}
+
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov