Skip to contentSkip to conversation

oprofile - i386 driver

PATCH In review John Levon 1 participant 1 message Oct 15, 2002

lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH 7/7 oprofile - i386 driver

Finally, add the i386 timer-interrupt and perfctr drivers for i386

arch/i386/Makefile +2 -0
diff -X dontdiff -Naur linux-linus/arch/i386/Makefile linux-linus2/arch/i386/Makefile
@@ -57,6 +57,8 @@
 					   arch/i386/$(MACHINE)/
 drivers-$(CONFIG_MATH_EMULATION)	+= arch/i386/math-emu/
 drivers-$(CONFIG_PCI)			+= arch/i386/pci/
+# FIXME: is drivers- right ?
+drivers-$(CONFIG_OPROFILE)		+= arch/i386/oprofile/
 
 CFLAGS += -Iarch/i386/$(MACHINE)
 AFLAGS += -Iarch/i386/$(MACHINE)
arch/i386/config.in +1 -6
diff -X dontdiff -Naur linux-linus/arch/i386/config.in linux-linus2/arch/i386/config.in
@@ -442,12 +442,7 @@
 
 source net/bluetooth/Config.in
 
-if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-   mainmenu_option next_comment
-   comment 'Profiling support'
-   bool 'Profiling support (EXPERIMENTAL)' CONFIG_PROFILING
-   endmenu
-fi
+source arch/i386/oprofile/Config.in
  
 mainmenu_option next_comment
 comment 'Kernel hacking'
arch/i386/oprofile/Config.help +6 -0
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/Config.help linux-linus2/arch/i386/oprofile/Config.help
@@ -0,0 +1,6 @@
+CONFIG_OPROFILE
+  OProfile is a profiling system capable of profiling the
+  whole system, include the kernel, kernel modules, libraries,
+  and applications.
+
+  If unsure, say N.
arch/i386/oprofile/Config.in +9 -0
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/Config.in linux-linus2/arch/i386/oprofile/Config.in
@@ -0,0 +1,9 @@
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+   mainmenu_option next_comment
+   comment 'Profiling support'
+   bool 'Profiling support (EXPERIMENTAL)' CONFIG_PROFILING
+   if [ "$CONFIG_PROFILING" = "y" ]; then
+      tristate '  OProfile system profiling (EXPERIMENTAL)' CONFIG_OPROFILE
+   fi
+   endmenu
+fi
arch/i386/oprofile/Makefile +16 -0
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/Makefile linux-linus2/arch/i386/oprofile/Makefile
@@ -0,0 +1,16 @@
+vpath %.c = . $(TOPDIR)/drivers/oprofile
+
+obj-$(CONFIG_OPROFILE) += oprofile.o
+ 
+DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
+	oprof.o cpu_buffer.o buffer_sync.o \
+	event_buffer.o oprofile_files.o \
+	oprofilefs.o oprofile_stats.o )
+ 
+oprofile-objs := $(DRIVER_OBJS) init.o timer_int.o
+
+ifdef CONFIG_X86_LOCAL_APIC
+oprofile-objs += nmi_int.o op_model_athlon.o op_model_ppro.o
+endif
+ 
+include $(TOPDIR)/Rules.make
arch/i386/oprofile/init.c +30 -0
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/init.c linux-linus2/arch/i386/oprofile/init.c
@@ -0,0 +1,30 @@
+/**
+ * @file init.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon <[email protected]>
+ */
+
+#include <linux/kernel.h>
+#include <linux/oprofile.h>
+#include <linux/init.h>
+ 
+/* We support CPUs that have performance counters like the Pentium Pro
+ * with NMI mode samples. Other x86 CPUs use a simple interrupt keyed
+ * off the timer interrupt, which cannot profile interrupts-disabled
+ * code unlike the NMI-based code.
+ */
+ 
+extern int nmi_init(struct oprofile_operations ** ops, enum oprofile_cpu * cpu);
+extern void timer_init(struct oprofile_operations ** ops, enum oprofile_cpu * cpu);
+
+int __init oprofile_arch_init(struct oprofile_operations ** ops, enum oprofile_cpu * cpu)
+{
+#ifdef CONFIG_X86_LOCAL_APIC
+	if (!nmi_init(ops, cpu))
+#endif
+		timer_init(ops, cpu);
+	return 0;
+}
arch/i386/oprofile/nmi_int.c +258 -0

258 lines not on this page · raw message

arch/i386/oprofile/op_counter.h +29 -0
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/op_counter.h linux-linus2/arch/i386/oprofile/op_counter.h
@@ -0,0 +1,29 @@
+/**
+ * @file op_counter.h
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon
+ */
+ 
+#ifndef OP_COUNTER_H
+#define OP_COUNTER_H
+ 
+#define OP_MAX_COUNTER 4
+ 
+/* Per-perfctr configuration as set via
+ * oprofilefs.
+ */
+struct op_counter_config {
+        unsigned long count;
+        unsigned long enabled;
+        unsigned long event;
+        unsigned long kernel;
+        unsigned long user;
+        unsigned long unit_mask;
+};
+
+extern struct op_counter_config counter_config[];
+
+#endif /* OP_COUNTER_H */
arch/i386/oprofile/op_model_athlon.c +149 -0

149 lines not on this page · raw message

arch/i386/oprofile/op_model_ppro.c +133 -0

133 lines not on this page · raw message

arch/i386/oprofile/op_x86_model.h +52 -0

52 lines not on this page · raw message

arch/i386/oprofile/timer_int.c +57 -0

57 lines not on this page · raw message