linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf kmem: pass additional arguments to record
@ 2020-07-08 18:39 Ian Rogers
  2020-07-10 12:39 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2020-07-08 18:39 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-kernel
  Cc: Stephane Eranian, Ian Rogers

perf kmem has an input file option but current an output file option
fails:
```
$ sudo perf kmem record -o /tmp/p.data sleep 1  
 Error: unknown switch `o'

Usage: perf kmem [<options>] {record|stat}

   -f, --force           don't complain, do it
   -i, --input <file>    input file name
   -l, --line <num>      show n lines
   -s, --sort <key[,key2...]>
                         sort by keys: ptr, callsite, bytes, hit, pingpong, frag, page, order, mig>
   -v, --verbose         be more verbose (show symbol address, etc)
       --alloc           show per-allocation statistics
       --caller          show per-callsite statistics
       --live            Show live page stat
       --page            Analyze page allocator
       --raw-ip          show raw ip instead of symbol
       --slab            Analyze slab allocator
       --time <str>      Time span of interest (start,stop)
```
perf sched is similar in implementation and avoids the problem by
passing additional arguments to perf record. This change makes perf kmem
parse command line options consistently with perf sched, although
neither actually list that -o is a supported option.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/builtin-kmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 38a5ab683ebc..a50dae2c4ae9 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -1933,7 +1933,8 @@ int cmd_kmem(int argc, const char **argv)
 		return ret;
 
 	argc = parse_options_subcommand(argc, argv, kmem_options,
-					kmem_subcommands, kmem_usage, 0);
+					kmem_subcommands, kmem_usage,
+					PARSE_OPT_STOP_AT_NON_OPTION);
 
 	if (!argc)
 		usage_with_options(kmem_usage, kmem_options);
-- 
2.27.0.383.g050319c2ae-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf kmem: pass additional arguments to record
  2020-07-08 18:39 [PATCH] perf kmem: pass additional arguments to record Ian Rogers
@ 2020-07-10 12:39 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-07-10 12:39 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-kernel, Stephane Eranian

Em Wed, Jul 08, 2020 at 11:39:19AM -0700, Ian Rogers escreveu:
> perf kmem has an input file option but current an output file option
> fails:
> ```
> $ sudo perf kmem record -o /tmp/p.data sleep 1  
>  Error: unknown switch `o'
> 
> Usage: perf kmem [<options>] {record|stat}
> 
>    -f, --force           don't complain, do it
>    -i, --input <file>    input file name
>    -l, --line <num>      show n lines
>    -s, --sort <key[,key2...]>
>                          sort by keys: ptr, callsite, bytes, hit, pingpong, frag, page, order, mig>
>    -v, --verbose         be more verbose (show symbol address, etc)
>        --alloc           show per-allocation statistics
>        --caller          show per-callsite statistics
>        --live            Show live page stat
>        --page            Analyze page allocator
>        --raw-ip          show raw ip instead of symbol
>        --slab            Analyze slab allocator
>        --time <str>      Time span of interest (start,stop)
> ```
> perf sched is similar in implementation and avoids the problem by
> passing additional arguments to perf record. This change makes perf kmem
> parse command line options consistently with perf sched, although
> neither actually list that -o is a supported option.

Thanks, tested and applied.

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/builtin-kmem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
> index 38a5ab683ebc..a50dae2c4ae9 100644
> --- a/tools/perf/builtin-kmem.c
> +++ b/tools/perf/builtin-kmem.c
> @@ -1933,7 +1933,8 @@ int cmd_kmem(int argc, const char **argv)
>  		return ret;
>  
>  	argc = parse_options_subcommand(argc, argv, kmem_options,
> -					kmem_subcommands, kmem_usage, 0);
> +					kmem_subcommands, kmem_usage,
> +					PARSE_OPT_STOP_AT_NON_OPTION);
>  
>  	if (!argc)
>  		usage_with_options(kmem_usage, kmem_options);
> -- 
> 2.27.0.383.g050319c2ae-goog
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-10 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 18:39 [PATCH] perf kmem: pass additional arguments to record Ian Rogers
2020-07-10 12:39 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).