2 * auxtrace.c: AUX area tracing support
3 * Copyright (c) 2013-2014, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope 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
18 #include "../../util/header.h"
19 #include "../../util/debug.h"
20 #include "../../util/pmu.h"
21 #include "../../util/auxtrace.h"
22 #include "../../util/intel-pt.h"
23 #include "../../util/intel-bts.h"
24 #include "../../util/evlist.h"
27 struct auxtrace_record
*auxtrace_record__init_intel(struct perf_evlist
*evlist
,
30 struct perf_pmu
*intel_pt_pmu
;
31 struct perf_pmu
*intel_bts_pmu
;
32 struct perf_evsel
*evsel
;
33 bool found_pt
= false;
34 bool found_bts
= false;
36 intel_pt_pmu
= perf_pmu__find(INTEL_PT_PMU_NAME
);
37 intel_bts_pmu
= perf_pmu__find(INTEL_BTS_PMU_NAME
);
40 evlist__for_each_entry(evlist
, evsel
) {
42 evsel
->attr
.type
== intel_pt_pmu
->type
)
45 evsel
->attr
.type
== intel_bts_pmu
->type
)
50 if (found_pt
&& found_bts
) {
51 pr_err("intel_pt and intel_bts may not be used together\n");
57 return intel_pt_recording_init(err
);
60 return intel_bts_recording_init(err
);
65 struct auxtrace_record
*auxtrace_record__init(struct perf_evlist
*evlist
,
73 ret
= get_cpuid(buffer
, sizeof(buffer
));
79 if (!strncmp(buffer
, "GenuineIntel,", 13))
80 return auxtrace_record__init_intel(evlist
, err
);