perf_callchain.c 999 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Performance event callchain support - SuperH architecture code
  3. *
  4. * Copyright (C) 2009 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/sched.h>
  12. #include <linux/perf_event.h>
  13. #include <linux/percpu.h>
  14. #include <asm/unwinder.h>
  15. #include <asm/ptrace.h>
  16. static int callchain_stack(void *data, char *name)
  17. {
  18. return 0;
  19. }
  20. static void callchain_address(void *data, unsigned long addr, int reliable)
  21. {
  22. struct perf_callchain_entry_ctx *entry = data;
  23. if (reliable)
  24. perf_callchain_store(entry, addr);
  25. }
  26. static const struct stacktrace_ops callchain_ops = {
  27. .stack = callchain_stack,
  28. .address = callchain_address,
  29. };
  30. void
  31. perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
  32. {
  33. perf_callchain_store(entry, regs->pc);
  34. unwind_stack(NULL, regs, NULL, &callchain_ops, entry);
  35. }