linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH] perf kmem: pass additional arguments to record
Date: Wed,  8 Jul 2020 11:39:19 -0700	[thread overview]
Message-ID: <20200708183919.4141023-1-irogers@google.com> (raw)

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


             reply	other threads:[~2020-07-08 18:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 18:39 Ian Rogers [this message]
2020-07-10 12:39 ` [PATCH] perf kmem: pass additional arguments to record Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200708183919.4141023-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).