Skip to contentSkip to conversation

perf kmem: pass additional arguments to record

PATCH In review Ian Rogers 2 participants 2 messages Jul 8, 2020 – Jul 10, 2020 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf kmem: pass additional arguments to record

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.

---
 tools/perf/builtin-kmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-kmem.c +2 -1
index 38a5ab683ebc..a50dae2c4ae9 100644
@@ -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);
Signature · 1 line
2.27.0.383.g050319c2ae-goog
#1 lore raw

Em Wed, Jul 08, 2020 at 11:39:19AM -0700, Ian Rogers escreveu:

Quoted 22 lines

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)
```
Quoted 4 lines

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

Quoted 22 lines
---
 tools/perf/builtin-kmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-kmem.c +2 -1
index 38a5ab683ebc..a50dae2c4ae9 100644
@@ -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);
Signature · 1 line
2.27.0.383.g050319c2ae-goog
Signature · 1 line
- Arnaldo