x86 performance counters driver 3.0-pre2 for 2.5.44: [1/4] core files
PATCH 1/1 x86 performance counters driver 3.0-pre2 for 2.5.44: [1/4] core files
Here is perfctr-3.0-pre2 for 2.5.44. This is the 2.5-ready version of the Linux/x86 performance-monitoring counters kernel extension. Please consider it for inclusion in 2.5/2.6.
This is part 1 of 4: adding core files. The kernel will still compile with this patch set applied.
/Mikael
drivers/perfctr/Config.help | 30 +++++++++ drivers/perfctr/Config.in | 13 ++++ drivers/perfctr/Makefile | 29 ++++++++ drivers/perfctr/compat.h | 35 ++++++++++ drivers/perfctr/init.c | 68 +++++++++++++++++++++ include/linux/perfctr.h | 142 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 317 insertions(+)
drivers/perfctr/Config.help +30 -0
@@ -0,0 +1,30 @@ +CONFIG_PERFCTR + This driver provides access to the performance-monitoring counter + registers available in some (but not all) modern processors. + These special-purpose registers can be programmed to count low-level + performance-related events which occur during program execution, + such as cache misses, pipeline stalls, etc. + + The driver supports most x86-class processors known to have + performance-monitoring counters: Intel Pentium to Pentium 4, + AMD K7, Cyrix 6x86MX/MII/III, VIA C3, and WinChip C6/2/3. + + On processors which have a time-stamp counter but no performance- + monitoring counters, such as the AMD K6 family, the driver supports + plain cycle-count performance measurements only. + + On WinChip C6/2/3 processors the performance-monitoring counters + cannot be used unless the time-stamp counter has been disabled. + Please read <file:drivers/perfctr/x86.c> for further information. + + You can safely say Y here, even if you intend to run the kernel + on a processor without performance-monitoring counters. + +CONFIG_PERFCTR_VIRTUAL + The processor's performance-monitoring counters are special-purpose + global registers. This option adds support for virtual per-process + performance-monitoring counters which only run when the process + to which they belong is executing. This improves the accuracy of + performance measurements by reducing "noise" from other processes. + + Say Y.
drivers/perfctr/Config.in +13 -0
@@ -0,0 +1,13 @@ +# $Id: Config.in,v 1.11 2002/10/11 08:47:05 mikpe Exp $ +# Performance-monitoring counters driver configuration +# + +if [ "$CONFIG_PREEMPT" != "y" ]; then + mainmenu_option next_comment + comment 'Performance-monitoring counters support' + bool 'Performance-monitoring counters support' CONFIG_PERFCTR + if [ "$CONFIG_PERFCTR" != "n" ]; then + bool ' Virtual performance counters support' CONFIG_PERFCTR_VIRTUAL $CONFIG_PERFCTR + fi + endmenu +fi
drivers/perfctr/Makefile +29 -0
@@ -0,0 +1,29 @@ +# $Id: Makefile,v 1.9 2002/10/11 08:47:05 mikpe Exp $ +# Makefile for the Performance-monitoring counters driver. + +ifeq ($(VERSION).$(PATCHLEVEL),2.4) +compat := y +else +compat := n +endif + +compat-objs-y := +perfctr-objs-y := init.o + +compat-objs-$(CONFIG_X86) += x86_compat.o +perfctr-objs-$(CONFIG_X86) += x86.o + +compat-objs-$(CONFIG_PERFCTR_VIRTUAL) += virtual_compat.o +perfctr-objs-$(CONFIG_PERFCTR_VIRTUAL) += virtual.o + +perfctr-objs-$(compat) += $(compat-objs-y) + +perfctr-objs := $(perfctr-objs-y) +obj-$(CONFIG_PERFCTR) := perfctr.o + +ifeq ($(VERSION).$(PATCHLEVEL),2.4) +O_TARGET := perfctr.o +obj-y := $(perfctr-objs) +endif + +include $(TOPDIR)/Rules.make
drivers/perfctr/compat.h +35 -0
@@ -0,0 +1,35 @@ +/* $Id: compat.h,v 1.27 2002/10/11 08:47:05 mikpe Exp $ +* Performance-monitoring counters driver. +* Compatibility definitions for 2.4/2.5 kernels. +* +* Copyright (C) 1999-2002 Mikael Pettersson +*/ +#include <linux/fs.h> +#include <linux/version.h> + +#if defined(CONFIG_X86 ) &&LINUX_VERSION_CODE <KERNEL_VERSION (2 ,4 ,11 ) && !defined(cpu_relax) +#define cpu_relax () rep_nop() +#endif + +/* PROC_I() was introduced in 2.5.4 */ +#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,5 ,4 ) +#include <linux/proc_fs.h> +#else /* for 2.4 only, not 2.2 */ +#define PROC_I (inode) (&(inode)->u.proc_i) +#endif + +/* remap_page_range() changed in 2.5.3-pre1 */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,3 ) +#include <linux/mm.h> +static inline int perfctr_remap_page_range (struct vm_area_struct *vma,unsigned long from,unsigned long to,unsigned long size,pgprot_t prot) +{ +return remap_page_range (from, to, size, prot); +} +#undef remap_page_range +#define remap_page_range (vma,from,to,size,prot) perfctr_remap_page_range((vma),(from),(to),(size),(prot)) +#endif + +/* put_task_struct() was introduced in 2.5.4 */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,4 ) +#define put_task_struct (tsk) free_task_struct((tsk)) +#endif
drivers/perfctr/init.c +68 -0
68 lines not on this page · raw message
include/linux/perfctr.h +142 -0
142 lines not on this page · raw message