perf sort: Use perf_env e_machine rather than arch

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>
This commit is contained in:
Ian Rogers 2026-06-02 08:25:06 -07:00 committed by Arnaldo Carvalho de Melo
parent d08cb3fb0f
commit 0158eb0d12

View 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 "hist.h"
#include "cacheline.h"
#include "comm.h"
#include "map.h"
#include "maps.h"
#include "symbol.h"
#include "map_symbol.h"
#include "branch.h"
#include "thread.h"
#include "evsel.h"
#include "event.h"
#include "evlist.h"
#include "srcline.h"
#include "strlist.h"
#include "strbuf.h"
#include "evsel.h"
#include "hist.h"
#include "machine.h"
#include "map.h"
#include "map_symbol.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"))