2 * arch/metag/oprofile/common.c
4 * Copyright (C) 2013 Imagination Technologies Ltd.
6 * Based on arch/sh/oprofile/common.c:
8 * Copyright (C) 2003 - 2010 Paul Mundt
10 * Based on arch/mips/oprofile/common.c:
12 * Copyright (C) 2004, 2005 Ralf Baechle
13 * Copyright (C) 2005 MIPS Technologies, Inc.
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
19 #include <linux/errno.h>
20 #include <linux/init.h>
21 #include <linux/oprofile.h>
22 #include <linux/perf_event.h>
23 #include <linux/slab.h>
25 #include "backtrace.h"
27 #ifdef CONFIG_HW_PERF_EVENTS
29 * This will need to be reworked when multiple PMUs are supported.
31 static char *metag_pmu_op_name
;
33 char *op_name_from_perf_id(void)
35 return metag_pmu_op_name
;
38 int __init
oprofile_arch_init(struct oprofile_operations
*ops
)
40 ops
->backtrace
= metag_backtrace
;
42 if (perf_num_counters() == 0)
45 metag_pmu_op_name
= kasprintf(GFP_KERNEL
, "metag/%s",
47 if (unlikely(!metag_pmu_op_name
))
50 return oprofile_perf_init(ops
);
53 void oprofile_arch_exit(void)
56 kfree(metag_pmu_op_name
);
59 int __init
oprofile_arch_init(struct oprofile_operations
*ops
)
61 ops
->backtrace
= metag_backtrace
;
62 /* fall back to timer interrupt PC sampling */
65 void oprofile_arch_exit(void) {}
66 #endif /* CONFIG_HW_PERF_EVENTS */