diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-11-15 11:05:18 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-11-15 11:05:18 +0100 |
commit | c23205c8488f11cb9ebe7a7b5851a1d8a0171011 (patch) | |
tree | 239dd82daddb1ce08b50ea9145d8f2a4685ebead /drivers/oprofile/oprof.c | |
parent | 5d81e5cfb37a174e8ddc0413e2e70cdf05807ace (diff) | |
parent | de346b6949063aa040ef607943b072835294f4b3 (diff) | |
download | op-kernel-dev-c23205c8488f11cb9ebe7a7b5851a1d8a0171011.zip op-kernel-dev-c23205c8488f11cb9ebe7a7b5851a1d8a0171011.tar.gz |
Merge branch 'core' of git://amd64.org/linux/rric into perf/core
Diffstat (limited to 'drivers/oprofile/oprof.c')
-rw-r--r-- | drivers/oprofile/oprof.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index dccd863..ed2c3ec 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c @@ -239,26 +239,39 @@ int oprofile_set_ulong(unsigned long *addr, unsigned long val) return err; } +static int timer_mode; + static int __init oprofile_init(void) { int err; + /* always init architecture to setup backtrace support */ + timer_mode = 0; err = oprofile_arch_init(&oprofile_ops); - if (err < 0 || timer) { - printk(KERN_INFO "oprofile: using timer interrupt.\n"); + if (!err) { + if (!timer && !oprofilefs_register()) + return 0; + oprofile_arch_exit(); + } + + /* setup timer mode: */ + timer_mode = 1; + /* no nmi timer mode if oprofile.timer is set */ + if (timer || op_nmi_timer_init(&oprofile_ops)) { err = oprofile_timer_init(&oprofile_ops); if (err) return err; } + return oprofilefs_register(); } static void __exit oprofile_exit(void) { - oprofile_timer_exit(); oprofilefs_unregister(); - oprofile_arch_exit(); + if (!timer_mode) + oprofile_arch_exit(); } |