mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
perf mem: Add -s/--sort option
So that users can set the sort key manually as they want.
$ perf mem report -s
Error: switch `s' requires a value
Usage: perf mem report [<options>]
-s, --sort <key[,key2...]>
sort by key(s): overhead overhead_sys overhead_us overhead_guest_sys
overhead_guest_us overhead_children sample period
weight1 weight2 weight3 ins_lat retire_lat p_stage_cyc
pid comm dso symbol parent cpu socket srcline srcfile
local_weight weight transaction trace symbol_size
dso_size cgroup cgroup_id ipc_null time code_page_size
local_ins_lat ins_lat local_p_stage_cyc p_stage_cyc
addr local_retire_lat retire_lat simd type typeoff
symoff symbol_daddr dso_daddr locked tlb mem snoop
dcacheline symbol_iaddr phys_daddr data_page_size
blocked
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20240731235505.710436-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
871893d748
commit
2d99a99133
|
|
@ -19,6 +19,7 @@
|
|||
#include "util/symbol.h"
|
||||
#include "util/pmus.h"
|
||||
#include "util/sample.h"
|
||||
#include "util/sort.h"
|
||||
#include "util/string2.h"
|
||||
#include "util/util.h"
|
||||
#include <linux/err.h>
|
||||
|
|
@ -28,7 +29,8 @@
|
|||
|
||||
struct perf_mem {
|
||||
struct perf_tool tool;
|
||||
char const *input_name;
|
||||
const char *input_name;
|
||||
const char *sort_key;
|
||||
bool hide_unresolved;
|
||||
bool dump_raw;
|
||||
bool force;
|
||||
|
|
@ -313,11 +315,13 @@ static char *get_sort_order(struct perf_mem *mem)
|
|||
bool has_extra_options = (mem->phys_addr | mem->data_page_size) ? true : false;
|
||||
char sort[128];
|
||||
|
||||
if (mem->sort_key)
|
||||
scnprintf(sort, sizeof(sort), "--sort=%s", mem->sort_key);
|
||||
/*
|
||||
* there is no weight (cost) associated with stores, so don't print
|
||||
* the column
|
||||
*/
|
||||
if (!(mem->operation & MEM_OPERATION_LOAD)) {
|
||||
else if (!(mem->operation & MEM_OPERATION_LOAD)) {
|
||||
strcpy(sort, "--sort=mem,sym,dso,symbol_daddr,"
|
||||
"dso_daddr,tlb,locked");
|
||||
} else if (has_extra_options) {
|
||||
|
|
@ -468,6 +472,7 @@ int cmd_mem(int argc, const char **argv)
|
|||
*/
|
||||
.operation = MEM_OPERATION_LOAD | MEM_OPERATION_STORE,
|
||||
};
|
||||
char *sort_order_help = sort_help("sort by key(s):", SORT_MODE__MEMORY);
|
||||
const struct option mem_options[] = {
|
||||
OPT_CALLBACK('t', "type", &mem.operation,
|
||||
"type", "memory operations(load,store) Default load,store",
|
||||
|
|
@ -501,6 +506,8 @@ int cmd_mem(int argc, const char **argv)
|
|||
"separator",
|
||||
"separator for columns, no spaces will be added"
|
||||
" between columns '.' is reserved."),
|
||||
OPT_STRING('s', "sort", &mem.sort_key, "key[,key2...]",
|
||||
sort_order_help),
|
||||
OPT_PARENT(mem_options)
|
||||
};
|
||||
const char *const mem_subcommands[] = { "record", "report", NULL };
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user