timer_int.c 822 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @file timer_int.c
  3. *
  4. * @remark Copyright 2002 OProfile authors
  5. * @remark Read the file COPYING
  6. *
  7. * @author John Levon <levon@movementarian.org>
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/notifier.h>
  11. #include <linux/smp.h>
  12. #include <linux/oprofile.h>
  13. #include <linux/profile.h>
  14. #include <linux/init.h>
  15. #include <asm/ptrace.h>
  16. #include "oprof.h"
  17. static int timer_notify(struct pt_regs *regs)
  18. {
  19. oprofile_add_sample(regs, 0);
  20. return 0;
  21. }
  22. static int timer_start(void)
  23. {
  24. return register_timer_hook(timer_notify);
  25. }
  26. static void timer_stop(void)
  27. {
  28. unregister_timer_hook(timer_notify);
  29. }
  30. void __init oprofile_timer_init(struct oprofile_operations *ops)
  31. {
  32. ops->create_files = NULL;
  33. ops->setup = NULL;
  34. ops->shutdown = NULL;
  35. ops->start = timer_start;
  36. ops->stop = timer_stop;
  37. ops->cpu_type = "timer";
  38. }