[PATCH v9 12/18] perf c2c: Use perf_env e_machine rather than arch

Ian Rogers
2026-05-03T00:23:17Z

Use the e_machine rather than arch string matching for AARCH64.

Add include of dwarf-regs.h in case the EM_AARCH64 isn't defined, sort
the headers given this include.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/builtin-c2c.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 72a7802775ee..c55cab53531b 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -12,41 +12,45 @@
*/
#include <errno.h>
#include <inttypes.h>
+
+#include <asm/bug.h>
#include <linux/compiler.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#include <linux/zalloc.h>
-#include <asm/bug.h>
#include <sys/param.h>
-#include "debug.h"
-#include "builtin.h"
+
+#include <dwarf-regs.h>
#include <perf/cpumap.h>
#include <subcmd/pager.h>
#include <subcmd/parse-options.h>
-#include "map_symbol.h"
-#include "mem-events.h"
-#include "session.h"
-#include "hist.h"
-#include "sort.h"
-#include "tool.h"
+
+#include "builtin.h"
#include "cacheline.h"
#include "data.h"
+#include "debug.h"
#include "event.h"
#include "evlist.h"
#include "evsel.h"
-#include "ui/browsers/hists.h"
-#include "thread.h"
-#include "mem2node.h"
+#include "hist.h"
+#include "map_symbol.h"
+#include "mem-events.h"
#include "mem-info.h"
-#include "symbol.h"
-#include "ui/ui.h"
-#include "ui/progress.h"
+#include "mem2node.h"
#include "pmus.h"
+#include "session.h"
+#include "sort.h"
#include "string2.h"
-#include "util/util.h"
-#include "util/symbol.h"
+#include "symbol.h"
+#include "thread.h"
+#include "tool.h"
+#include "ui/browsers/hists.h"
+#include "ui/progress.h"
+#include "ui/ui.h"
#include "util/annotate.h"
+#include "util/symbol.h"
+#include "util/util.h"

struct c2c_hists {
struct hists hists;
@@ -3202,7 +3206,7 @@ static int perf_c2c__report(int argc, const char **argv)
* default display type.
*/
if (!display) {
- if (!strcmp(perf_env__arch(env), "arm64"))
+ if (perf_env__e_machine(env, /*e_flags=*/NULL) == EM_AARCH64)
display = "peer";
else
display = "tot";
--
2.54.0.545.g6539524ca2-goog