diff options
| author | John Levon <levon@movementarian.org> | 2003-05-25 07:42:45 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-25 07:42:45 -0700 |
| commit | fed4d7bd949f5c4437f63e64f4dee4dd4d59144b (patch) | |
| tree | 2c2b089e7214ad637fa7fd1bb03b231d62dfea27 | |
| parent | 0d22b578d5e540aa4d046d8f9eebfe5166d3f4a4 (diff) | |
[PATCH] OProfile: timer usage override
A patch mostly by Will Cohen, adding a parameter to OProfile to
over-ride use of the perfctr hardware. Useful for testing and
a host of other things.
| -rw-r--r-- | Documentation/kernel-parameters.txt | 3 | ||||
| -rw-r--r-- | drivers/oprofile/oprof.c | 25 |
2 files changed, 22 insertions, 6 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 2d87a0293cb5..dd844c9ff2f7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -652,6 +652,9 @@ running once the system is up. opl3sa2= [HW,OSS] Format: <io>,<irq>,<dma>,<dma2>,<mss_io>,<mpu_io>,<ymode>,<loopback>[,<isapnp>,<multiple] + oprofile.timer= [HW] + Use timer interrupt instead of performance counters + optcd= [HW,CD] Format: <io> diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index adaf0c407f87..bcc7ae257544 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c @@ -11,6 +11,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/oprofile.h> +#include <linux/moduleparam.h> #include <asm/semaphore.h> #include "oprof.h" @@ -24,6 +25,12 @@ unsigned long oprofile_started; static unsigned long is_setup; static DECLARE_MUTEX(start_sem); +/* timer + 0 - use performance monitoring hardware if available + 1 - use the timer int mechanism regardless + */ +static int timer = 0; + int oprofile_setup(void) { int err; @@ -124,13 +131,16 @@ extern void timer_init(struct oprofile_operations ** ops); static int __init oprofile_init(void) { - int err; + int err = -ENODEV; + + if (!timer) { + /* Architecture must fill in the interrupt ops and the + * logical CPU type, or we can fall back to the timer + * interrupt profiler. + */ + err = oprofile_arch_init(&oprofile_ops); + } - /* Architecture must fill in the interrupt ops and the - * logical CPU type, or we can fall back to the timer - * interrupt profiler. - */ - err = oprofile_arch_init(&oprofile_ops); if (err == -ENODEV) { timer_init(&oprofile_ops); err = 0; @@ -163,6 +173,9 @@ static void __exit oprofile_exit(void) module_init(oprofile_init); module_exit(oprofile_exit); + +module_param_named(timer, timer, int, 0644); +MODULE_PARM_DESC(timer, "force use of timer interrupt"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("John Levon <levon@movementarian.org>"); |
