mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
perf tools: Allow hpp fields to be sort keys
Add overhead{,_sys,_us,_guest_sys,_guest_us}, sample and period sort keys so that they can be selected with --sort/-s option. $ perf report -s period,comm --stdio ... # Overhead Period Command # ........ ............ ............... # 47.06% 152 swapper 13.93% 45 qemu-system-arm 12.38% 40 synergys 3.72% 12 firefox 2.48% 8 xchat Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ingo Molnar <mingo@kernel.org> Link: http://lkml.kernel.org/r/1400480762-22852-9-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
This commit is contained in:
parent
fb821c9e71
commit
a2ce067e55
8 changed files with 67 additions and 13 deletions
|
@ -1028,6 +1028,26 @@ static struct sort_dimension memory_sort_dimensions[] = {
|
|||
|
||||
#undef DIM
|
||||
|
||||
struct hpp_dimension {
|
||||
const char *name;
|
||||
struct perf_hpp_fmt *fmt;
|
||||
int taken;
|
||||
};
|
||||
|
||||
#define DIM(d, n) { .name = n, .fmt = &perf_hpp__format[d], }
|
||||
|
||||
static struct hpp_dimension hpp_sort_dimensions[] = {
|
||||
DIM(PERF_HPP__OVERHEAD, "overhead"),
|
||||
DIM(PERF_HPP__OVERHEAD_SYS, "overhead_sys"),
|
||||
DIM(PERF_HPP__OVERHEAD_US, "overhead_us"),
|
||||
DIM(PERF_HPP__OVERHEAD_GUEST_SYS, "overhead_guest_sys"),
|
||||
DIM(PERF_HPP__OVERHEAD_GUEST_US, "overhead_guest_us"),
|
||||
DIM(PERF_HPP__SAMPLES, "sample"),
|
||||
DIM(PERF_HPP__PERIOD, "period"),
|
||||
};
|
||||
|
||||
#undef DIM
|
||||
|
||||
struct hpp_sort_entry {
|
||||
struct perf_hpp_fmt hpp;
|
||||
struct sort_entry *se;
|
||||
|
@ -1115,6 +1135,16 @@ static int __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __hpp_dimension__add(struct hpp_dimension *hd)
|
||||
{
|
||||
if (!hd->taken) {
|
||||
hd->taken = 1;
|
||||
|
||||
perf_hpp__register_sort_field(hd->fmt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sort_dimension__add(const char *tok)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -1144,6 +1174,15 @@ int sort_dimension__add(const char *tok)
|
|||
return __sort_dimension__add(sd, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hpp_sort_dimensions); i++) {
|
||||
struct hpp_dimension *hd = &hpp_sort_dimensions[i];
|
||||
|
||||
if (strncasecmp(tok, hd->name, strlen(tok)))
|
||||
continue;
|
||||
|
||||
return __hpp_dimension__add(hd);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(bstack_sort_dimensions); i++) {
|
||||
struct sort_dimension *sd = &bstack_sort_dimensions[i];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue