Re: [PATCH] perf script: Add option to display guest samples in host

From: zhangmengting
Date: Mon Oct 23 2017 - 02:57:45 EST


Hi all,
For sched_switch tracepoint, I guess maybe it would be more reasonable to show guest samples together with host samples by default, instead of setting an option to display guest samples when we meet with this confused situation.
To take care of this issue, the code should be changed as below:

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 0c977b6..dcfab00 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1557,7 +1557,7 @@ static int process_sample_event(struct perf_tool *tool,
return -1;
}

- if (al.filtered)
+ if (al.filtered && !(strcmp(evsel->name, "sched:sched_switch")== 0 && perf_host &&(al.filtered & (1 << HIST_FILTER__GUEST))))
goto out_put;

if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))

Right?

Thanks,
Mengting Zhang


On 2017/10/18 22:37, David Ahern wrote:
On 10/18/17 1:09 AM, Mengting Zhang wrote:
@@ -2771,6 +2772,8 @@ int cmd_script(int argc, const char **argv)
"Show context switch events (if recorded)"),
OPT_BOOLEAN('\0', "show-namespace-events", &script.show_namespace_events,
"Show namespace events (if recorded)"),
+ OPT_BOOLEAN('\0', "show-guest-samples", &script.show_guest_samples,
+ "Show guest samples (if recorded)"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
OPT_INTEGER(0, "max-blocks", &max_blocks,
"Maximum number of code blocks to dump with brstackinsn"),
At this point we need a 'show-all' option.

.