oprofile update for 2.5.52
PATCH 1/1 oprofile update for 2.5.52
The below patch makes the following changes :
o headers cleanup
o remove deprecated kernel_only
o mention minimum oprofile version
o correctly initialise task_exit statistic
o remove racy debug check (wli saw this oops)
o remove pointless simple_open
o add dump functionality
o remove pessimising FASTCALL
Note that current .51 and also with this patch need to use oprofile CVS, or here's a tarball :
http://www.movement.uklinux.net/oprofile-0.5cvs.tar.gz
Please apply
thanks
john
arch/i386/oprofile/init.c +0 -1
@@ -7,7 +7,6 @@* @author John Levon <[email protected]> */ -#include <linux/kernel.h> #include <linux/oprofile.h> #include <linux/init.h>
arch/i386/oprofile/nmi_int.c +1 -10
@@ -7,19 +7,13 @@* @author John Levon <[email protected]> */ -#include <linux/kernel.h> #include <linux/init.h> #include <linux/notifier.h> #include <linux/smp.h> #include <linux/oprofile.h> -#include <linux/pm.h> -#include <linux/thread_info.h> #include <asm/nmi.h> -#include <asm/ptrace.h> #include <asm/msr.h> #include <asm/apic.h> -#include <asm/bitops.h> -#include <asm/processor.h> #include "op_counter.h" #include "op_x86_model.h"
@@ -27,7 +21,6 @@static struct op_x86_model_spec const * model;static struct op_msrs cpu_msrs[NR_CPUS ];static unsigned long saved_lvtpc[NR_CPUS ]; -static unsigned long kernel_only;static int nmi_start (void );static void nmi_stop (void );
@@ -53,10 +46,9 @@ } -// FIXME: kernel_only static int nmi_callback (struct pt_regs * regs,int cpu) { -return (model->check_ctrs (cpu, &cpu_msrs[cpu], regs)); +return model->check_ctrs (cpu, &cpu_msrs[cpu], regs); }
@@ -210,7 +202,6 @@oprofilefs_create_ulong (sb, dir,"user" , &counter_config[i].user); } -oprofilefs_create_ulong (sb, root,"kernel_only" , &kernel_only);return 0 ; }
Documentation/Changes +5 -0
@@ -61,6 +61,7 @@ o PPP 2.4.0 # pppd --version o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version o procps 2.0.9 # ps --version +o oprofile 0.5 # oprofiled --version Kernel compilation ==================
@@ -368,6 +369,10 @@ --------- o <ftp://ftp.inr.ac.ru/ip-routing/iproute2-2.2.4-now-ss991023.tar.gz> +OProfile +-------- +o <http://oprofile.sf.net/download.php3> + Suggestions and corrections ===========================
drivers/oprofile/buffer_sync.c +6 -6
@@ -19,17 +19,17 @@* objects. */ -#include <linux/fs.h> #include <linux/mm.h> -#include <linux/timer.h> -#include <linux/dcookies.h> +#include <linux/workqueue.h> #include <linux/notifier.h> +#include <linux/dcookies.h> #include <linux/profile.h> -#include <linux/workqueue.h> - +#include <linux/fs.h> + +#include "oprofile_stats.h" #include "event_buffer.h" #include "cpu_buffer.h" -#include "oprofile_stats.h" +#include "buffer_sync.h" #define DEFAULT_EXPIRE (HZ / 4)
drivers/oprofile/cpu_buffer.c +1 -6
@@ -19,13 +19,10 @@#include <linux/sched.h> #include <linux/vmalloc.h> -#include <linux/smp.h> #include <linux/errno.h> -#include <linux/cache.h> #include "cpu_buffer.h" #include "oprof.h" -#include "oprofile_stats.h" struct oprofile_cpu_buffer cpu_buffer[NR_CPUS] __cacheline_aligned;
@@ -68,6 +65,7 @@ b->sample_received =0 ; b->sample_lost_locked =0 ; b->sample_lost_overflow =0 ; + b->sample_lost_task_exit =0 ; }return 0 ; fail:
@@ -92,9 +90,6 @@struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[cpu];struct task_struct * task; -/* temporary ? */ -BUG_ON (!oprofile_started); - cpu_buf->sample_received++;if (!spin_trylock (&cpu_buf->int_lock)) {
drivers/oprofile/event_buffer.c +5 -9
@@ -12,19 +12,15 @@* escape value ESCAPE_CODE followed by an identifying code. */ -#include <linux/fs.h> -#include <linux/slab.h> -#include <linux/sched.h> #include <linux/vmalloc.h> -#include <linux/smp.h> -#include <linux/dcookies.h> #include <linux/oprofile.h> +#include <linux/sched.h> +#include <linux/dcookies.h> +#include <linux/fs.h> #include <asm/uaccess.h> -#include <asm/atomic.h> - -#include "event_buffer.h" -#include "cpu_buffer.h" +#include "oprof.h" +#include "event_buffer.h" #include "oprofile_stats.h" DECLARE_MUTEX (buffer_sem);
drivers/oprofile/event_buffer.h +1 -1
@@ -11,7 +11,7 @@#define EVENT_BUFFER_H #include <linux/types.h> -#include <linux/sem.h> +#include <asm/semaphore.h> int alloc_event_buffer (void );
drivers/oprofile/oprof.c +7 -6
@@ -10,12 +10,8 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> -#include <linux/mm.h> -#include <linux/module.h> -#include <linux/sched.h> -#include <linux/notifier.h> -#include <linux/profile.h> #include <linux/oprofile.h> +#include <asm/semaphore.h> #include "oprof.h" #include "event_buffer.h"
@@ -86,6 +82,7 @@ goto out; oprofile_started =1 ; +oprofile_reset_stats (); out:up (&start_sem);
@@ -148,6 +145,10 @@oprofilefs_unregister (); } -MODULE_LICENSE ("GPL" ); +module_init (oprofile_init);module_exit (oprofile_exit); + +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("John Levon <[email protected]>" ); +MODULE_DESCRIPTION ("OProfile system profiler" );
drivers/oprofile/oprof.h +5 -3
@@ -10,9 +10,6 @@#ifndef OPROF_H #define OPROF_H -#include <linux/spinlock.h> -#include <linux/oprofile.h> -int oprofile_setup (void );void oprofile_shutdown (void );
@@ -22,6 +19,8 @@int oprofile_start (void );void oprofile_stop (void ); +struct oprofile_operations ; +extern unsigned long fs_buffer_size;extern unsigned long fs_cpu_buffer_size;extern unsigned long fs_buffer_watershed;
@@ -29,6 +28,9 @@extern struct oprofile_operations * oprofile_ops;extern unsigned long oprofile_started; +struct super_block ; +struct dentry ; +void oprofile_create_files (struct super_block * sb,struct dentry * root);#endif /* OPROF_H */
drivers/oprofile/oprofile_files.c +15 -13
@@ -7,26 +7,18 @@* @author John Levon <[email protected]> */ -#include <linux/oprofile.h> #include <linux/fs.h> -#include <linux/slab.h> -#include <asm/uaccess.h> - -#include "oprof.h" +#include <linux/oprofile.h> +#include "event_buffer.h" #include "oprofile_stats.h" +#include "oprof.h" unsigned long fs_buffer_size =131072 ;unsigned long fs_cpu_buffer_size =8192 ;unsigned long fs_buffer_watershed =32768 ;/* FIXME: tune */ -static int simple_open (struct inode * inode,struct file * filp) -{ -return 0 ; -} - -static ssize_t cpu_type_read (struct file * file,char * buf,size_t count,loff_t * offset) {unsigned long cpu_type = oprofile_cpu_type;
@@ -36,7 +28,6 @@static struct file_operations cpu_type_fops = { - .open = simple_open, .read = cpu_type_read, };
@@ -71,15 +62,26 @@static struct file_operations enable_fops = { - .open = simple_open, .read = enable_read, .write = enable_write, }; + +static ssize_t dump_write (struct file *file,char const * buf,size_t count,loff_t * offset) +{ +wake_up_buffer_waiter (); +return count; +} + + +static struct file_operations dump_fops = { + .write = dump_write, +};void oprofile_create_files (struct super_block * sb,struct dentry * root) {oprofilefs_create_file (sb, root,"enable" , &enable_fops); +oprofilefs_create_file (sb, root,"dump" , &dump_fops);oprofilefs_create_file (sb, root,"buffer" , &event_buffer_fops);oprofilefs_create_ulong (sb, root,"buffer_size" , &fs_buffer_size);oprofilefs_create_ulong (sb, root,"buffer_watershed" , &fs_buffer_watershed);
drivers/oprofile/oprofilefs.c +2 -5
@@ -12,12 +12,9 @@#include <linux/init.h> #include <linux/module.h> -#include <linux/pagemap.h> -#include <linux/fs.h> -#include <linux/dcache.h> -#include <linux/file.h> -#include <linux/namei.h> #include <linux/oprofile.h> +#include <linux/fs.h> +#include <linux/pagemap.h> #include <asm/uaccess.h> #include "oprof.h"
include/linux/oprofile.h +1 -1
@@ -55,7 +55,7 @@* Add a sample. This may be called from any context. Pass * smp_processor_id() as cpu. */ -extern void FASTCALL (oprofile_add_sample (unsigned long eip,unsigned long event,int cpu)); +extern void oprofile_add_sample (unsigned long eip,unsigned long event,int cpu);/** * Create a file of the given name as a child of the given root, with