perf tools: Use ui__error() for reporting --fields errors

So that we can get it working for TUI, where using just pr_err() would
end up making the message emitted to stderr to be erased by the TUI exit
routine restoring the terminal to its previous state.

Now we can see that trying to use a tracepoint field as one of the
--field entries isn't working:

  # perf top --stdio --no-children -e syscalls:sys_enter_write --fields pid,sym,count
  Error:
  Unknown --fields key: `count'
   Usage: perf top [<options>]

        --fields <key[,keys...]>
                          output field(s): overhead, period, sample plus all of sort keys
  #

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-usy9hhy7umdd4bbblkn63t8w@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 936f1f30
...@@ -2887,10 +2887,10 @@ static int setup_output_list(struct perf_hpp_list *list, char *str) ...@@ -2887,10 +2887,10 @@ static int setup_output_list(struct perf_hpp_list *list, char *str)
tok; tok = strtok_r(NULL, ", ", &tmp)) { tok; tok = strtok_r(NULL, ", ", &tmp)) {
ret = output_field_add(list, tok); ret = output_field_add(list, tok);
if (ret == -EINVAL) { if (ret == -EINVAL) {
pr_err("Invalid --fields key: `%s'", tok); ui__error("Invalid --fields key: `%s'", tok);
break; break;
} else if (ret == -ESRCH) { } else if (ret == -ESRCH) {
pr_err("Unknown --fields key: `%s'", tok); ui__error("Unknown --fields key: `%s'", tok);
break; break;
} }
} }
......
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