aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/oprof.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/oprof.c')
-rw-r--r--drivers/oprofile/oprof.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c
index f9bda64fcd1b..43b01daa91e1 100644
--- a/drivers/oprofile/oprof.c
+++ b/drivers/oprofile/oprof.c
@@ -239,6 +239,38 @@ int oprofile_set_ulong(unsigned long *addr, unsigned long val)
239 return err; 239 return err;
240} 240}
241 241
242#ifdef CONFIG_HAVE_HWSAMPLER
243int oprofile_set_hwsampler(unsigned long val)
244{
245 int err = 0;
246
247 mutex_lock(&start_mutex);
248
249 if (oprofile_started) {
250 err = -EBUSY;
251 goto out;
252 }
253
254 switch (val) {
255 case 1:
256 /* Switch to hardware sampling. */
257 __oprofile_timer_exit();
258 err = oprofile_arch_set_hwsampler(&oprofile_ops);
259 break;
260 case 0:
261 printk(KERN_INFO "oprofile: using timer interrupt.\n");
262 err = __oprofile_timer_init(&oprofile_ops);
263 break;
264 default:
265 err = -EINVAL;
266 }
267
268out:
269 mutex_unlock(&start_mutex);
270 return err;
271}
272#endif /* CONFIG_HAVE_HWSAMPLER */
273
242static int __init oprofile_init(void) 274static int __init oprofile_init(void)
243{ 275{
244 int err; 276 int err;