--- linux-2.6.25.perfctr26/CREDITS.~1~	2008-04-17 18:22:31.000000000 +0200
+++ linux-2.6.25.perfctr26/CREDITS	2008-06-22 15:17:34.000000000 +0200
@@ -2717,6 +2717,7 @@ N: Mikael Pettersson
 E: mikpe@it.uu.se
 W: http://user.it.uu.se/~mikpe/linux/
 D: Miscellaneous fixes
+D: Performance-monitoring counters driver
 
 N: Reed H. Petty
 E: rhp@draper.net
--- linux-2.6.25.perfctr26/Documentation/ioctl-number.txt.~1~	2008-04-17 18:22:31.000000000 +0200
+++ linux-2.6.25.perfctr26/Documentation/ioctl-number.txt	2008-06-22 15:17:34.000000000 +0200
@@ -188,6 +188,8 @@ Code	Seq#	Include File		Comments
 0xB1	00-1F	PPPoX			<mailto:mostrows@styx.uwaterloo.ca>
 0xCB	00-1F	CBM serial IEC bus	in development:
 					<mailto:michael.klein@puffin.lb.shuttle.de>
+0xD0	all	performance counters	see drivers/perfctr/
+					<mailto:mikpe@it.uu.se>
 0xDD	00-3F	ZFCP device driver	see drivers/s390/scsi/
 					<mailto:aherrman@de.ibm.com>
 0xF3	00-3F	video/sisfb.h		sisfb (in development)
--- linux-2.6.25.perfctr26/MAINTAINERS.~1~	2008-04-17 18:22:31.000000000 +0200
+++ linux-2.6.25.perfctr26/MAINTAINERS	2008-06-22 15:17:34.000000000 +0200
@@ -3098,6 +3098,12 @@ M:	nagar@watson.ibm.com
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 
+PERFORMANCE-MONITORING COUNTERS DRIVER
+P:	Mikael Pettersson
+M:	mikpe@it.uu.se
+W:	http://user.it.uu.se/~mikpe/linux/perfctr/
+S:	Maintained
+
 PERSONALITY HANDLING
 P:	Christoph Hellwig
 M:	hch@infradead.org
--- linux-2.6.25.perfctr26/arch/arm/Kconfig.~1~	2008-04-17 18:22:31.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/arm/Kconfig	2008-06-22 15:17:34.000000000 +0200
@@ -573,6 +573,10 @@ config IWMMXT
 	  Enable support for iWMMXt context switching at run time if
 	  running on a CPU that supports it.
 
+if CPU_XSCALE
+source drivers/perfctr/Kconfig
+endif
+
 #  bool 'Use XScale PMU as timer source' CONFIG_XSCALE_PMU_TIMER
 config XSCALE_PMU
 	bool
--- linux-2.6.25.perfctr26/arch/arm/kernel/process.c.~1~	2008-04-17 18:22:31.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/arm/kernel/process.c	2008-06-22 15:17:34.000000000 +0200
@@ -26,6 +26,7 @@
 #include <linux/cpu.h>
 #include <linux/elfcore.h>
 #include <linux/pm.h>
+#include <linux/perfctr.h>
 #include <linux/tick.h>
 #include <linux/utsname.h>
 
@@ -303,6 +304,7 @@ void show_fpregs(struct user_fp *regs)
  */
 void exit_thread(void)
 {
+	perfctr_exit_thread(&current->thread);
 }
 
 ATOMIC_NOTIFIER_HEAD(thread_notify_head);
@@ -348,6 +350,8 @@ copy_thread(int nr, unsigned long clone_
 	if (clone_flags & CLONE_SETTLS)
 		thread->tp_value = regs->ARM_r3;
 
+	perfctr_copy_task(p, regs);
+
 	return 0;
 }
 
--- linux-2.6.25.perfctr26/arch/powerpc/kernel/process.c.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/powerpc/kernel/process.c	2008-06-22 15:17:34.000000000 +0200
@@ -30,6 +30,7 @@
 #include <linux/init_task.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
+#include <linux/perfctr.h>
 #include <linux/mqueue.h>
 #include <linux/hardirq.h>
 #include <linux/utsname.h>
@@ -358,8 +359,10 @@ struct task_struct *__switch_to(struct t
 	 * window where the kernel stack SLB and the kernel stack are out
 	 * of sync. Hard disable here.
 	 */
+	perfctr_suspend_thread(&prev->thread);
 	hard_irq_disable();
 	last = _switch(old_thread, new_thread);
+	perfctr_resume_thread(&current->thread);
 
 	local_irq_restore(flags);
 
@@ -497,6 +500,7 @@ void show_regs(struct pt_regs * regs)
 void exit_thread(void)
 {
 	discard_lazy_cpu_state();
+	perfctr_exit_thread(&current->thread);
 }
 
 void flush_thread(void)
@@ -616,6 +620,8 @@ int copy_thread(int nr, unsigned long cl
 	kregs->nip = (unsigned long)ret_from_fork;
 #endif
 
+	perfctr_copy_task(p, regs);
+
 	return 0;
 }
 
--- linux-2.6.25.perfctr26/arch/powerpc/platforms/Kconfig.cputype.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/powerpc/platforms/Kconfig.cputype	2008-06-22 15:17:34.000000000 +0200
@@ -232,4 +232,8 @@ config NOT_COHERENT_CACHE
 config CHECK_CACHE_COHERENCY
 	bool
 
+if PPC32
+source "drivers/perfctr/Kconfig"
+endif
+
 endmenu
--- linux-2.6.25.perfctr26/arch/x86/Kconfig.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/Kconfig	2008-06-22 15:17:34.000000000 +0200
@@ -1074,6 +1074,8 @@ config CC_STACKPROTECTOR_ALL
 	  functions that use large-ish on-stack buffers. By enabling
 	  this option, GCC will be asked to do this for ALL functions.
 
+source "drivers/perfctr/Kconfig"
+
 source kernel/Kconfig.hz
 
 config KEXEC
--- linux-2.6.25.perfctr26/arch/x86/kernel/entry_32.S.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/kernel/entry_32.S	2008-06-22 15:17:34.000000000 +0200
@@ -640,6 +640,23 @@ ENDPROC(name)
 /* The include is where all of the SMP etc. interrupts come from */
 #include "entry_arch.h"
 
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_KPERFCTR)
+ENTRY(perfctr_interrupt)
+	RING0_INT_FRAME
+	pushl $~(LOCAL_PERFCTR_VECTOR)
+	CFI_ADJUST_CFA_OFFSET 4
+	SAVE_ALL
+	TRACE_IRQS_OFF
+	pushl %esp
+	CFI_ADJUST_CFA_OFFSET 4
+	call smp_perfctr_interrupt
+	addl $4, %esp
+	CFI_ADJUST_CFA_OFFSET -4
+	jmp ret_from_intr
+	CFI_ENDPROC
+ENDPROC(perfctr_interrupt)
+#endif
+
 KPROBE_ENTRY(page_fault)
 	RING0_EC_FRAME
 	pushl $do_page_fault
--- linux-2.6.25.perfctr26/arch/x86/kernel/entry_64.S.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/kernel/entry_64.S	2008-06-22 15:17:34.000000000 +0200
@@ -730,6 +730,12 @@ ENTRY(spurious_interrupt)
 	apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
 END(spurious_interrupt)
 				
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_KPERFCTR)
+ENTRY(perfctr_interrupt)
+	apicinterrupt LOCAL_PERFCTR_VECTOR,smp_perfctr_interrupt
+END(perfctr_interrupt)
+#endif
+
 /*
  * Exception entry points.
  */ 		
--- linux-2.6.25.perfctr26/arch/x86/kernel/i8259_32.c.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/kernel/i8259_32.c	2008-06-22 15:17:34.000000000 +0200
@@ -20,6 +20,7 @@
 #include <asm/apic.h>
 #include <asm/arch_hooks.h>
 #include <asm/i8259.h>
+#include <asm/perfctr.h>
 
 /*
  * This is the 'legacy' 8259A Programmable Interrupt Controller,
@@ -398,6 +399,8 @@ void __init native_init_IRQ(void)
 	 */
 	intr_init_hook();
 
+	perfctr_vector_init();
+
 	/*
 	 * External FPU? Set up irq13 if so, for
 	 * original braindamaged IBM FERR coupling.
--- linux-2.6.25.perfctr26/arch/x86/kernel/i8259_64.c.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/kernel/i8259_64.c	2008-06-22 15:17:34.000000000 +0200
@@ -21,6 +21,7 @@
 #include <asm/delay.h>
 #include <asm/desc.h>
 #include <asm/apic.h>
+#include <asm/perfctr.h>
 #include <asm/i8259.h>
 
 /*
@@ -507,6 +508,8 @@ void __init native_init_IRQ(void)
 	set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
 	set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
 
+	perfctr_vector_init();
+
 	if (!acpi_ioapic)
 		setup_irq(2, &irq2);
 }
--- linux-2.6.25.perfctr26/arch/x86/kernel/process_32.c.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/kernel/process_32.c	2008-06-22 15:17:34.000000000 +0200
@@ -28,6 +28,7 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/perfctr.h>
 #include <linux/mc146818rtc.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
@@ -430,6 +431,7 @@ void exit_thread(void)
 		tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET;
 		put_cpu();
 	}
+	perfctr_exit_thread(&current->thread);
 }
 
 void flush_thread(void)
@@ -486,6 +488,8 @@ int copy_thread(int nr, unsigned long cl
 
 	savesegment(gs, p->thread.gs);
 
+	perfctr_copy_task(p, regs);
+
 	tsk = current;
 	if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
 		p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,
@@ -722,6 +726,8 @@ struct task_struct * __switch_to(struct 
 
 	x86_write_percpu(current_task, next_p);
 
+	perfctr_resume_thread(next);
+
 	return prev_p;
 }
 
--- linux-2.6.25.perfctr26/arch/x86/kernel/process_64.c.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/arch/x86/kernel/process_64.c	2008-06-22 15:17:34.000000000 +0200
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/ptrace.h>
+#include <linux/perfctr.h>
 #include <linux/random.h>
 #include <linux/notifier.h>
 #include <linux/kprobes.h>
@@ -391,6 +392,7 @@ void exit_thread(void)
 		t->io_bitmap_max = 0;
 		put_cpu();
 	}
+	perfctr_exit_thread(t);
 }
 
 void flush_thread(void)
@@ -494,6 +496,8 @@ int copy_thread(int nr, unsigned long cl
 	asm("mov %%es,%0" : "=m" (p->thread.es));
 	asm("mov %%ds,%0" : "=m" (p->thread.ds));
 
+	perfctr_copy_task(p, regs);
+
 	if (unlikely(test_tsk_thread_flag(me, TIF_IO_BITMAP))) {
 		p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
 		if (!p->thread.io_bitmap_ptr) {
@@ -699,6 +703,9 @@ __switch_to(struct task_struct *prev_p, 
 	 */
 	if (next_p->fpu_counter>5)
 		math_state_restore();
+
+	perfctr_resume_thread(next);
+
 	return prev_p;
 }
 
--- linux-2.6.25.perfctr26/drivers/Makefile.~1~	2008-04-17 18:22:32.000000000 +0200
+++ linux-2.6.25.perfctr26/drivers/Makefile	2008-06-22 15:17:34.000000000 +0200
@@ -82,6 +82,7 @@ obj-$(CONFIG_MEMSTICK)		+= memstick/
 obj-$(CONFIG_NEW_LEDS)		+= leds/
 obj-$(CONFIG_INFINIBAND)	+= infiniband/
 obj-$(CONFIG_SGI_SN)		+= sn/
+obj-$(CONFIG_KPERFCTR)		+= perfctr/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
--- linux-2.6.25.perfctr26/fs/exec.c.~1~	2008-04-17 18:22:35.000000000 +0200
+++ linux-2.6.25.perfctr26/fs/exec.c	2008-06-22 15:17:56.000000000 +0200
@@ -51,6 +51,7 @@
 #include <linux/tsacct_kern.h>
 #include <linux/cn_proc.h>
 #include <linux/audit.h>
+#include <linux/perfctr.h>
 
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -1006,6 +1007,7 @@ int flush_old_exec(struct linux_binprm *
 	set_task_comm(current, tcomm);
 
 	current->flags &= ~PF_RANDOMIZE;
+	perfctr_flush_thread(&current->thread);
 	flush_thread();
 
 	/* Set the new mm task size. We have to do that late because it may
--- linux-2.6.25.perfctr26/include/asm-arm/processor.h.~1~	2008-04-17 18:22:35.000000000 +0200
+++ linux-2.6.25.perfctr26/include/asm-arm/processor.h	2008-06-22 15:17:34.000000000 +0200
@@ -50,6 +50,10 @@ struct thread_struct {
 	unsigned long		error_code;
 							/* debugging	  */
 	struct debug_info	debug;
+
+#ifdef CONFIG_PERFCTR_VIRTUAL
+	struct vperfctr		*perfctr;		/* performance counters */
+#endif
 };
 
 #define INIT_THREAD  {	}
--- linux-2.6.25.perfctr26/include/asm-arm/system.h.~1~	2008-04-17 18:22:35.000000000 +0200
+++ linux-2.6.25.perfctr26/include/asm-arm/system.h	2008-06-22 15:17:34.000000000 +0200
@@ -264,7 +264,9 @@ extern struct task_struct *__switch_to(s
 
 #define switch_to(prev,next,last)					\
 do {									\
+	perfctr_suspend_thread(&(prev)->thread);			\
 	last = __switch_to(prev,task_thread_info(prev), task_thread_info(next));	\
+	perfctr_resume_thread(&(current)->thread);			\
 } while (0)
 
 #if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
--- linux-2.6.25.perfctr26/include/asm-powerpc/processor.h.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/include/asm-powerpc/processor.h	2008-06-22 15:17:34.000000000 +0200
@@ -177,6 +177,9 @@ struct thread_struct {
 	unsigned long	spefscr;	/* SPE & eFP status */
 	int		used_spe;	/* set if process has used spe */
 #endif /* CONFIG_SPE */
+#ifdef CONFIG_PERFCTR_VIRTUAL
+	struct vperfctr *perfctr;	/* performance counters */
+#endif
 };
 
 #define ARCH_MIN_TASKALIGN 16
--- linux-2.6.25.perfctr26/include/asm-x86/hw_irq_64.h.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/include/asm-x86/hw_irq_64.h	2008-06-22 15:17:34.000000000 +0200
@@ -84,14 +84,15 @@
  * sources per level' errata.
  */
 #define LOCAL_TIMER_VECTOR	0xef
+#define LOCAL_PERFCTR_VECTOR	0xee
 
 /*
- * First APIC vector available to drivers: (vectors 0x30-0xee)
+ * First APIC vector available to drivers: (vectors 0x30-0xed)
  * we start at 0x41 to spread out vectors evenly between priority
  * levels. (0x80 is the syscall vector)
  */
 #define FIRST_DEVICE_VECTOR	(IRQ15_VECTOR + 2)
-#define FIRST_SYSTEM_VECTOR	0xef   /* duplicated in irq.h */
+#define FIRST_SYSTEM_VECTOR	0xee   /* duplicated in irq.h */
 
 
 #ifndef __ASSEMBLY__
--- linux-2.6.25.perfctr26/include/asm-x86/irq_64.h.~1~	2008-01-25 12:31:58.000000000 +0100
+++ linux-2.6.25.perfctr26/include/asm-x86/irq_64.h	2008-06-22 15:17:34.000000000 +0200
@@ -29,7 +29,7 @@
  */
 #define NR_VECTORS 256
 
-#define FIRST_SYSTEM_VECTOR	0xef   /* duplicated in hw_irq.h */
+#define FIRST_SYSTEM_VECTOR	0xee   /* duplicated in hw_irq.h */
 
 #define NR_IRQS (NR_VECTORS + (32 *NR_CPUS))
 #define NR_IRQ_VECTORS NR_IRQS
--- linux-2.6.25.perfctr26/include/asm-x86/mach-default/irq_vectors.h.~1~	2008-01-25 12:31:58.000000000 +0100
+++ linux-2.6.25.perfctr26/include/asm-x86/mach-default/irq_vectors.h	2008-06-22 15:17:34.000000000 +0200
@@ -56,14 +56,15 @@
  * sources per level' errata.
  */
 #define LOCAL_TIMER_VECTOR	0xef
+#define LOCAL_PERFCTR_VECTOR	0xee
 
 /*
- * First APIC vector available to drivers: (vectors 0x30-0xee)
+ * First APIC vector available to drivers: (vectors 0x30-0xed)
  * we start at 0x31 to spread out vectors evenly between priority
  * levels. (0x80 is the syscall vector)
  */
 #define FIRST_DEVICE_VECTOR	0x31
-#define FIRST_SYSTEM_VECTOR	0xef
+#define FIRST_SYSTEM_VECTOR	0xee
 
 #define TIMER_IRQ 0
 
--- linux-2.6.25.perfctr26/include/asm-x86/mach-visws/irq_vectors.h.~1~	2008-01-25 12:31:58.000000000 +0100
+++ linux-2.6.25.perfctr26/include/asm-x86/mach-visws/irq_vectors.h	2008-06-22 15:17:34.000000000 +0200
@@ -35,14 +35,15 @@
  * sources per level' errata.
  */
 #define LOCAL_TIMER_VECTOR	0xef
+#define LOCAL_PERFCTR_VECTOR	0xee
 
 /*
- * First APIC vector available to drivers: (vectors 0x30-0xee)
+ * First APIC vector available to drivers: (vectors 0x30-0xed)
  * we start at 0x31 to spread out vectors evenly between priority
  * levels. (0x80 is the syscall vector)
  */
 #define FIRST_DEVICE_VECTOR	0x31
-#define FIRST_SYSTEM_VECTOR	0xef
+#define FIRST_SYSTEM_VECTOR	0xee
 
 #define TIMER_IRQ 0
 
--- linux-2.6.25.perfctr26/include/asm-x86/processor.h.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/include/asm-x86/processor.h	2008-06-22 15:17:34.000000000 +0200
@@ -349,6 +349,8 @@ struct thread_struct {
 	unsigned long	iopl;
 /* max allowed port in the bitmap, in bytes: */
 	unsigned io_bitmap_max;
+/* performance counters */
+	struct vperfctr *perfctr;
 /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set.  */
 	unsigned long	debugctlmsr;
 /* Debug Store - if not 0 points to a DS Save Area configuration;
--- linux-2.6.25.perfctr26/include/asm-x86/system.h.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/include/asm-x86/system.h	2008-06-22 15:17:34.000000000 +0200
@@ -29,6 +29,7 @@ struct task_struct *__switch_to(struct t
  */
 #define switch_to(prev, next, last) do {				\
 	unsigned long esi, edi;						\
+	perfctr_suspend_thread(&(prev)->thread);			\
 	asm volatile("pushfl\n\t"		/* Save flags */	\
 		     "pushl %%ebp\n\t"					\
 		     "movl %%esp,%0\n\t"	/* save ESP */		\
@@ -62,7 +63,8 @@ struct task_struct *__switch_to(struct t
 	  "r12", "r13", "r14", "r15"
 
 /* Save restore flags to clear handle leaking NT */
-#define switch_to(prev, next, last) \
+#define switch_to(prev, next, last) do { \
+	perfctr_suspend_thread(&(prev)->thread); \
 	asm volatile(SAVE_CONTEXT						    \
 	     "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */	  \
 	     "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */	  \
@@ -82,7 +84,8 @@ struct task_struct *__switch_to(struct t
 	       [tif_fork] "i" (TIF_FORK),			  	  \
 	       [thread_info] "i" (offsetof(struct task_struct, stack)),   \
 	       [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent))  \
-	     : "memory", "cc" __EXTRA_CLOBBER)
+	     : "memory", "cc" __EXTRA_CLOBBER); \
+} while (0)
 #endif
 
 #ifdef __KERNEL__
--- linux-2.6.25.perfctr26/kernel/exit.c.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/kernel/exit.c	2008-06-22 15:17:34.000000000 +0200
@@ -28,6 +28,7 @@
 #include <linux/proc_fs.h>
 #include <linux/kthread.h>
 #include <linux/mempolicy.h>
+#include <linux/perfctr.h>
 #include <linux/taskstats_kern.h>
 #include <linux/delayacct.h>
 #include <linux/freezer.h>
@@ -173,6 +174,7 @@ repeat:
 		zap_leader = (leader->exit_signal == -1);
 	}
 
+	perfctr_release_task(p);
 	write_unlock_irq(&tasklist_lock);
 	release_thread(p);
 	call_rcu(&p->rcu, delayed_put_task_struct);
--- linux-2.6.25.perfctr26/kernel/sched.c.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/kernel/sched.c	2008-06-22 15:17:34.000000000 +0200
@@ -54,6 +54,7 @@
 #include <linux/cpu.h>
 #include <linux/cpuset.h>
 #include <linux/percpu.h>
+#include <linux/perfctr.h>
 #include <linux/kthread.h>
 #include <linux/seq_file.h>
 #include <linux/sysctl.h>
@@ -5345,6 +5346,8 @@ int set_cpus_allowed(struct task_struct 
 	struct rq *rq;
 	int ret = 0;
 
+	perfctr_set_cpus_allowed(p, new_mask);
+
 	rq = task_rq_lock(p, &flags);
 	if (!cpus_intersects(new_mask, cpu_online_map)) {
 		ret = -EINVAL;
--- linux-2.6.25.perfctr26/kernel/timer.c.~1~	2008-04-17 18:22:36.000000000 +0200
+++ linux-2.6.25.perfctr26/kernel/timer.c	2008-06-22 15:17:34.000000000 +0200
@@ -33,6 +33,7 @@
 #include <linux/jiffies.h>
 #include <linux/posix-timers.h>
 #include <linux/cpu.h>
+#include <linux/perfctr.h>
 #include <linux/syscalls.h>
 #include <linux/delay.h>
 #include <linux/tick.h>
@@ -849,6 +850,7 @@ void update_process_times(int user_tick)
 
 	/* Note: this timer irq context must be accounted for as well. */
 	account_process_tick(p, user_tick);
+	perfctr_sample_thread(&p->thread);
 	run_local_timers();
 	if (rcu_pending(cpu))
 		rcu_check_callbacks(cpu, user_tick);
