Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf mem: Add -T/--data-type option to report subcommand

This is just a shortcut to have 'type' in the sort key and use more
compact output format like below.

$ perf mem report -T
...
#
# Overhead Samples Memory access Snoop TLB access Data Type
# ........ ............ ....................................... ............ ...................... .........
#
14.84% 22 L1 hit None L1 or L2 hit (unknown)
7.68% 8 LFB/MAB hit None L1 or L2 hit (unknown)
7.17% 3 RAM hit Hit L2 miss (unknown)
6.29% 12 L1 hit None L1 or L2 hit (stack operation)
4.85% 5 RAM hit Hit L1 or L2 hit (unknown)
3.97% 5 LFB/MAB hit None L1 or L2 hit struct psi_group_cpu
3.18% 3 LFB/MAB hit None L1 or L2 hit (stack operation)
2.58% 3 L1 hit None L1 or L2 hit unsigned int
2.36% 2 L1 hit None L1 or L2 hit struct
2.31% 2 L1 hit None L1 or L2 hit struct psi_group_cpu
...

Users also can use their own sort keys and -T option makes sure it has
the 'type' sort key at the end.

$ perf mem report -T -s mem

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
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-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
7320ad97 2d99a991

+9
+9
tools/perf/builtin-mem.c
··· 38 38 bool data_page_size; 39 39 bool all_kernel; 40 40 bool all_user; 41 + bool data_type; 41 42 int operation; 42 43 const char *cpu_list; 43 44 DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); ··· 318 317 319 318 if (mem->sort_key) 320 319 scnprintf(sort, sizeof(sort), "--sort=%s", mem->sort_key); 320 + else if (mem->data_type) 321 + strcpy(sort, "--sort=mem,snoop,tlb,type"); 321 322 /* 322 323 * there is no weight (cost) associated with stores, so don't print 323 324 * the column ··· 338 335 339 336 if (mem->data_page_size) 340 337 strcat(sort, ",data_page_size"); 338 + 339 + /* make sure it has 'type' sort key even -s option is used */ 340 + if (mem->data_type && !strstr(sort, "type")) 341 + strcat(sort, ",type"); 341 342 342 343 return strdup(sort); 343 344 } ··· 515 508 " between columns '.' is reserved."), 516 509 OPT_STRING('s', "sort", &mem.sort_key, "key[,key2...]", 517 510 sort_order_help), 511 + OPT_BOOLEAN('T', "type-profile", &mem.data_type, 512 + "Show data-type profile result"), 518 513 OPT_PARENT(mem_options) 519 514 }; 520 515 const char *const mem_subcommands[] = { "record", "report", NULL };