perf report: Use ui__warning in some more places

So that we get a proper warning in the TUI in cases like:

 $ perf report --stdio -g fractal,0.5,caller --sort pid
 Selected -g but no callchain data. Did you call 'perf record' without -g?
 $

The --stdio case is ok because it uses fprintf, ui__warning is needed to
figure out if --stdio or --tui is being used.

Cc: Arun Sharma <asharma@fb.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sam Liao <phyomh@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ag9fz2wd17mbbfjsbznq1wms@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3e9f45a7
...@@ -162,23 +162,22 @@ static int perf_session__setup_sample_type(struct perf_session *self) ...@@ -162,23 +162,22 @@ static int perf_session__setup_sample_type(struct perf_session *self)
{ {
if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) { if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
if (sort__has_parent) { if (sort__has_parent) {
fprintf(stderr, "selected --sort parent, but no" ui__warning("Selected --sort parent, but no "
" callchain data. Did you call" "callchain data. Did you call "
" perf record without -g?\n"); "'perf record' without -g?\n");
return -EINVAL; return -EINVAL;
} }
if (symbol_conf.use_callchain) { if (symbol_conf.use_callchain) {
fprintf(stderr, "selected -g but no callchain data." ui__warning("Selected -g but no callchain data. Did "
" Did you call perf record without" "you call 'perf record' without -g?\n");
" -g?\n");
return -1; return -1;
} }
} else if (!dont_use_callchains && callchain_param.mode != CHAIN_NONE && } else if (!dont_use_callchains && callchain_param.mode != CHAIN_NONE &&
!symbol_conf.use_callchain) { !symbol_conf.use_callchain) {
symbol_conf.use_callchain = true; symbol_conf.use_callchain = true;
if (callchain_register_param(&callchain_param) < 0) { if (callchain_register_param(&callchain_param) < 0) {
fprintf(stderr, "Can't register callchain" ui__warning("Can't register callchain "
" params\n"); "params.\n");
return -EINVAL; return -EINVAL;
} }
} }
......
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