Commit b3505208 authored by Taesoo Kim's avatar Taesoo Kim Committed by Arnaldo Carvalho de Melo

perf list: Fix --raw-dump option

Currently, 'perf list --raw-dump' requires extra arguments
(e.g., hw) to invoke, which breaks bash/zsh completion
(perf-completion.sh).

  $ perf list --raw-dump
    Error: unknown option `raw-dump'

     usage: perf list [hw|sw|cache|tracepoint|pmu|event_glob]

After,

  $ perf list --raw-dump
  cpu-cycles instructions cache-references cache-misses ...
Signed-off-by: default avatarTaesoo Kim <tsgatesv@gmail.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taesoo kim <taesoo@gatech.edu>
Link: http://lkml.kernel.org/r/1419997015-11071-1-git-send-email-tsgatesv@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4093325f
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
{ {
int i; int i;
const struct option list_options[] = { bool raw_dump = false;
struct option list_options[] = {
OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"),
OPT_END() OPT_END()
}; };
const char * const list_usage[] = { const char * const list_usage[] = {
...@@ -27,11 +29,18 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -27,11 +29,18 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
NULL NULL
}; };
set_option_flag(list_options, 0, "raw-dump", PARSE_OPT_HIDDEN);
argc = parse_options(argc, argv, list_options, list_usage, argc = parse_options(argc, argv, list_options, list_usage,
PARSE_OPT_STOP_AT_NON_OPTION); PARSE_OPT_STOP_AT_NON_OPTION);
setup_pager(); setup_pager();
if (raw_dump) {
print_events(NULL, true);
return 0;
}
if (argc == 0) { if (argc == 0) {
print_events(NULL, false); print_events(NULL, false);
return 0; return 0;
...@@ -53,8 +62,6 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -53,8 +62,6 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
print_hwcache_events(NULL, false); print_hwcache_events(NULL, false);
else if (strcmp(argv[i], "pmu") == 0) else if (strcmp(argv[i], "pmu") == 0)
print_pmu_events(NULL, false); print_pmu_events(NULL, false);
else if (strcmp(argv[i], "--raw-dump") == 0)
print_events(NULL, true);
else { else {
char *sep = strchr(argv[i], ':'), *s; char *sep = strchr(argv[i], ':'), *s;
int sep_idx; int sep_idx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment