perf script: Add support for PERF_SAMPLE_CODE_PAGE_SIZE
Display sampled code page sizes when PERF_SAMPLE_CODE_PAGE_SIZE was set. For example: # perf script --fields comm,event,ip,code_page_size dtlb mem-loads:uP: 445777 4K dtlb mem-loads:uP: 40f724 4K dtlb mem-loads:uP: 474926 4K dtlb mem-loads:uP: 401075 4K dtlb mem-loads:uP: 401095 4K dtlb mem-loads:uP: 401095 4K dtlb mem-loads:uP: 4010cc 4K dtlb mem-loads:uP: 440b6f 4K # Signed-off-by: Stephane Eranian <eranian@google.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20210105195752.43489-5-kan.liang@linux.intel.com Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Родитель
c1de7f3d84
Коммит
c513de8a70
|
@ -118,7 +118,7 @@ OPTIONS
|
|||
comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff,
|
||||
srcline, period, iregs, uregs, brstack, brstacksym, flags, bpf-output,
|
||||
brstackinsn, brstackoff, callindent, insn, insnlen, synth, phys_addr,
|
||||
metric, misc, srccode, ipc, data_page_size.
|
||||
metric, misc, srccode, ipc, data_page_size, code_page_size.
|
||||
Field list can be prepended with the type, trace, sw or hw,
|
||||
to indicate to which event type the field list applies.
|
||||
e.g., -F sw:comm,tid,time,ip,sym and -F trace:time,cpu,trace
|
||||
|
|
|
@ -117,6 +117,7 @@ enum perf_output_field {
|
|||
PERF_OUTPUT_IPC = 1ULL << 31,
|
||||
PERF_OUTPUT_TOD = 1ULL << 32,
|
||||
PERF_OUTPUT_DATA_PAGE_SIZE = 1ULL << 33,
|
||||
PERF_OUTPUT_CODE_PAGE_SIZE = 1ULL << 34,
|
||||
};
|
||||
|
||||
struct perf_script {
|
||||
|
@ -182,6 +183,7 @@ struct output_option {
|
|||
{.str = "ipc", .field = PERF_OUTPUT_IPC},
|
||||
{.str = "tod", .field = PERF_OUTPUT_TOD},
|
||||
{.str = "data_page_size", .field = PERF_OUTPUT_DATA_PAGE_SIZE},
|
||||
{.str = "code_page_size", .field = PERF_OUTPUT_CODE_PAGE_SIZE},
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -255,7 +257,7 @@ static struct {
|
|||
PERF_OUTPUT_DSO | PERF_OUTPUT_PERIOD |
|
||||
PERF_OUTPUT_ADDR | PERF_OUTPUT_DATA_SRC |
|
||||
PERF_OUTPUT_WEIGHT | PERF_OUTPUT_PHYS_ADDR |
|
||||
PERF_OUTPUT_DATA_PAGE_SIZE,
|
||||
PERF_OUTPUT_DATA_PAGE_SIZE | PERF_OUTPUT_CODE_PAGE_SIZE,
|
||||
|
||||
.invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT,
|
||||
},
|
||||
|
@ -507,6 +509,10 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
|
|||
evsel__check_stype(evsel, PERF_SAMPLE_DATA_PAGE_SIZE, "DATA_PAGE_SIZE", PERF_OUTPUT_DATA_PAGE_SIZE))
|
||||
return -EINVAL;
|
||||
|
||||
if (PRINT_FIELD(CODE_PAGE_SIZE) &&
|
||||
evsel__check_stype(evsel, PERF_SAMPLE_CODE_PAGE_SIZE, "CODE_PAGE_SIZE", PERF_OUTPUT_CODE_PAGE_SIZE))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2020,6 +2026,9 @@ static void process_event(struct perf_script *script,
|
|||
if (PRINT_FIELD(DATA_PAGE_SIZE))
|
||||
fprintf(fp, " %s", get_page_size_name(sample->data_page_size, str));
|
||||
|
||||
if (PRINT_FIELD(CODE_PAGE_SIZE))
|
||||
fprintf(fp, " %s", get_page_size_name(sample->code_page_size, str));
|
||||
|
||||
perf_sample__fprintf_ipc(sample, attr, fp);
|
||||
|
||||
fprintf(fp, "\n");
|
||||
|
@ -3519,7 +3528,7 @@ int cmd_script(int argc, const char **argv)
|
|||
"addr,symoff,srcline,period,iregs,uregs,brstack,"
|
||||
"brstacksym,flags,bpf-output,brstackinsn,brstackoff,"
|
||||
"callindent,insn,insnlen,synth,phys_addr,metric,misc,ipc,tod,"
|
||||
"data_page_size",
|
||||
"data_page_size,code_page_size",
|
||||
parse_output_fields),
|
||||
OPT_BOOLEAN('a', "all-cpus", &system_wide,
|
||||
"system-wide collection from all CPUs"),
|
||||
|
|
|
@ -1312,6 +1312,9 @@ static void dump_sample(struct evsel *evsel, union perf_event *event,
|
|||
if (sample_type & PERF_SAMPLE_DATA_PAGE_SIZE)
|
||||
printf(" .. data page size: %s\n", get_page_size_name(sample->data_page_size, str));
|
||||
|
||||
if (sample_type & PERF_SAMPLE_CODE_PAGE_SIZE)
|
||||
printf(" .. code page size: %s\n", get_page_size_name(sample->code_page_size, str));
|
||||
|
||||
if (sample_type & PERF_SAMPLE_TRANSACTION)
|
||||
printf("... transaction: %" PRIx64 "\n", sample->transaction);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче