]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf sort: Use perf_env e_machine rather than arch
authorIan Rogers <irogers@google.com>
Tue, 2 Jun 2026 15:25:06 +0000 (08:25 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 3 Jun 2026 19:48:14 +0000 (16:48 -0300)
Use the e_machine rather than the arch to determine x86 or PPC types.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Honglei Wang <jameshongleiwang@126.com>
Cc: Jan Polensky <japo@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/sort.c

index 0020089cb13c7858ba04579568b1bdbc32909c63..90bc4a31bb554c1774cdc9c55faa570479112604 100644 (file)
@@ -1,40 +1,45 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "sort.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <inttypes.h>
-#include <regex.h>
 #include <stdlib.h>
+
+#include <elf.h>
+#include <linux/kernel.h>
 #include <linux/mman.h>
+#include <linux/string.h>
 #include <linux/time64.h>
+
+#include <regex.h>
+
+#include "annotate-data.h"
+#include "annotate.h"
+#include "branch.h"
+#include "cacheline.h"
+#include "cgroup.h"
+#include "comm.h"
 #include "debug.h"
 #include "dso.h"
-#include "sort.h"
+#include "event.h"
+#include "evlist.h"
+#include "evsel.h"
 #include "hist.h"
-#include "cacheline.h"
-#include "comm.h"
+#include "machine.h"
 #include "map.h"
-#include "maps.h"
-#include "symbol.h"
 #include "map_symbol.h"
-#include "branch.h"
-#include "thread.h"
-#include "evsel.h"
-#include "evlist.h"
-#include "srcline.h"
-#include "strlist.h"
-#include "strbuf.h"
+#include "maps.h"
 #include "mem-events.h"
 #include "mem-info.h"
-#include "annotate.h"
-#include "annotate-data.h"
-#include "event.h"
-#include "time-utils.h"
-#include "cgroup.h"
-#include "machine.h"
 #include "session.h"
+#include "srcline.h"
+#include "strbuf.h"
+#include "strlist.h"
+#include "symbol.h"
+#include "thread.h"
+#include "time-utils.h"
 #include "trace-event.h"
-#include <linux/kernel.h>
-#include <linux/string.h>
 
 #ifdef HAVE_LIBTRACEEVENT
 #include <event-parse.h>
@@ -2673,9 +2678,10 @@ struct sort_dimension {
 
 static int arch_support_sort_key(const char *sort_key, struct perf_env *env)
 {
-       const char *arch = perf_env__arch(env);
+       uint16_t e_machine = perf_env__e_machine(env, /*e_eflags=*/NULL);
 
-       if (!strcmp("x86", arch) || !strcmp("powerpc", arch)) {
+       if (e_machine == EM_X86_64 || e_machine == EM_386 || e_machine == EM_PPC64 ||
+           e_machine == EM_PPC) {
                if (!strcmp(sort_key, "p_stage_cyc"))
                        return 1;
                if (!strcmp(sort_key, "local_p_stage_cyc"))
@@ -2686,14 +2692,14 @@ static int arch_support_sort_key(const char *sort_key, struct perf_env *env)
 
 static const char *arch_perf_header_entry(const char *se_header, struct perf_env *env)
 {
-       const char *arch = perf_env__arch(env);
+       uint16_t e_machine = perf_env__e_machine(env, /*e_eflags=*/NULL);
 
-       if (!strcmp("x86", arch)) {
+       if (e_machine == EM_X86_64 || e_machine == EM_386) {
                if (!strcmp(se_header, "Local Pipeline Stage Cycle"))
                        return "Local Retire Latency";
                else if (!strcmp(se_header, "Pipeline Stage Cycle"))
                        return "Retire Latency";
-       } else if (!strcmp("powerpc", arch)) {
+       } else if (e_machine == EM_PPC64 || e_machine == EM_PPC) {
                if (!strcmp(se_header, "Local INSTR Latency"))
                        return "Finish Cyc";
                else if (!strcmp(se_header, "INSTR Latency"))