Skip to content

Commit 65ad7b1

Browse files
perf tools: adding coresight etm PMU record capabilities
Coresight ETMs are IP blocks used to perform HW assisted tracing on a CPU core. This patch introduce the required auxiliary API functions allowing the perf core to interact with a tracer. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 2eb654b commit 65ad7b1

9 files changed

Lines changed: 724 additions & 1 deletion

File tree

MAINTAINERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,9 @@ F: Documentation/trace/coresight.txt
10081008
F: Documentation/devicetree/bindings/arm/coresight.txt
10091009
F: Documentation/ABI/testing/sysfs-bus-coresight-devices-*
10101010
F: tools/perf/arch/arm/util/pmu.c
1011+
F: tools/perf/arch/arm/util/auxtrace.c
1012+
F: tools/perf/arch/arm/util/cs_etm.c
1013+
F: tools/perf/arch/arm/util/cs_etm.h
10111014

10121015
ARM/CORGI MACHINE SUPPORT
10131016
M: Richard Purdie <rpurdie@rpsys.net>

tools/perf/arch/arm/util/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ libperf-$(CONFIG_DWARF) += dwarf-regs.o
33
libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
44
libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
55

6-
libperf-$(CONFIG_AUXTRACE) += pmu.o
6+
libperf-$(CONFIG_AUXTRACE) += pmu.o auxtrace.o cs-etm.o
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright(C) 2015 Linaro Limited. All rights reserved.
3+
* Author: Mathieu Poirier <mathieu.poirier@linaro.org>
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 as published by
7+
* the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+
* more details.
13+
*
14+
* You should have received a copy of the GNU General Public License along with
15+
* this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include <stdbool.h>
19+
#include <linux/coresight-pmu.h>
20+
21+
#include "../../util/auxtrace.h"
22+
#include "../../util/evlist.h"
23+
#include "../../util/pmu.h"
24+
#include "cs-etm.h"
25+
26+
struct auxtrace_record
27+
*auxtrace_record__init(struct perf_evlist *evlist, int *err)
28+
{
29+
struct perf_pmu *cs_etm_pmu;
30+
struct perf_evsel *evsel;
31+
bool found_etm = false;
32+
33+
cs_etm_pmu = perf_pmu__find(CORESIGHT_ETM_PMU_NAME);
34+
35+
if (evlist) {
36+
evlist__for_each(evlist, evsel) {
37+
if (cs_etm_pmu &&
38+
evsel->attr.type == cs_etm_pmu->type)
39+
found_etm = true;
40+
}
41+
}
42+
43+
if (found_etm)
44+
return cs_etm_record_init(err);
45+
46+
/*
47+
* Clear 'err' even if we haven't found a cs_etm event - that way perf
48+
* record can still be used even if tracers aren't present. The NULL
49+
* return value will take care of telling the infrastructure HW tracing
50+
* isn't available.
51+
*/
52+
*err = 0;
53+
return NULL;
54+
}

0 commit comments

Comments
 (0)