Re: [PATCH 04/15] perf mem: Add -u/-k options
From: Arnaldo Carvalho de Melo
Date: Wed Feb 24 2016 - 08:17:16 EST
Em Wed, Feb 24, 2016 at 09:46:45AM +0100, Jiri Olsa escreveu:
> Add -u/-k (--all-user/--all-kernel) options to use
> the perf record --all-user/--all-kernel options.
Missing documentation update. -u/-k usage is ok, should be the same
accross all tools, have to check that... Actually make that -U and -K,
'perf top' needs fixing in making -U mean --hide_kernel_symbols , will do.
- Arnaldo
> Link: http://lkml.kernel.org/n/tip-adxn5c48oe0gmjrjmq6we27q@xxxxxxxxxxxxxx
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
> tools/perf/builtin-mem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
> index 9da09e058f4b..8a31b3f634d9 100644
> --- a/tools/perf/builtin-mem.c
> +++ b/tools/perf/builtin-mem.c
> @@ -62,6 +62,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
> int rec_argc, i = 0, j;
> const char **rec_argv;
> int ret;
> + bool all_user = false, all_kernel = false;
> struct option options[] = {
> OPT_CALLBACK('e', "event", &mem, "event",
> "event selector. use 'perf mem record -e list' to list available events",
> @@ -69,13 +70,15 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
> OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
> OPT_INCR('v', "verbose", &verbose,
> "be more verbose (show counter open errors, etc)"),
> + OPT_BOOLEAN('u', "--all-user", &all_user, "collect only user level data"),
> + OPT_BOOLEAN('k', "--all-kernel", &all_kernel, "collect only kernel level data"),
> OPT_END()
> };
>
> argc = parse_options(argc, argv, options, record_mem_usage,
> PARSE_OPT_STOP_AT_NON_OPTION);
>
> - rec_argc = argc + 7; /* max number of arguments */
> + rec_argc = argc + 9; /* max number of arguments */
> rec_argv = calloc(rec_argc + 1, sizeof(char *));
> if (!rec_argv)
> return -1;
> @@ -104,6 +107,12 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
> rec_argv[i++] = perf_mem_events__name(j);
> };
>
> + if (all_user)
> + rec_argv[i++] = "--all-user";
> +
> + if (all_kernel)
> + rec_argv[i++] = "--all-kernel";
> +
> for (j = 0; j < argc; j++, i++)
> rec_argv[i] = argv[j];
>
> --
> 2.4.3