diff options
author | Namhyung Kim <namhyung@gmail.com> | 2012-05-29 00:22:57 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-29 10:53:42 -0400 |
commit | 3780f4883b2f3319afe88bf3ddc73ef426851d49 (patch) | |
tree | 240a22d02b4ba502e5e68c1a6526db6338acc782 /tools/perf/builtin-top.c | |
parent | 21f0d423b989284f82004d0f80c75581fec91fb2 (diff) |
perf tools: Convert critical messages to ui__error()
There were places where use ui__warning (or even fprintf) to show
critical messages. This patch converts them to ui__error so that the
front-end code can implement appropriate behavior.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1338265382-6872-3-git-send-email-namhyung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index d4a5f9b7f4f9..871b540293e1 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -959,16 +959,16 @@ try_again: | |||
959 | } | 959 | } |
960 | 960 | ||
961 | if (err == ENOENT) { | 961 | if (err == ENOENT) { |
962 | ui__warning("The %s event is not supported.\n", | 962 | ui__error("The %s event is not supported.\n", |
963 | event_name(counter)); | 963 | event_name(counter)); |
964 | goto out_err; | 964 | goto out_err; |
965 | } else if (err == EMFILE) { | 965 | } else if (err == EMFILE) { |
966 | ui__warning("Too many events are opened.\n" | 966 | ui__error("Too many events are opened.\n" |
967 | "Try again after reducing the number of events\n"); | 967 | "Try again after reducing the number of events\n"); |
968 | goto out_err; | 968 | goto out_err; |
969 | } | 969 | } |
970 | 970 | ||
971 | ui__warning("The sys_perf_event_open() syscall " | 971 | ui__error("The sys_perf_event_open() syscall " |
972 | "returned with %d (%s). /bin/dmesg " | 972 | "returned with %d (%s). /bin/dmesg " |
973 | "may provide additional information.\n" | 973 | "may provide additional information.\n" |
974 | "No CONFIG_PERF_EVENTS=y kernel support " | 974 | "No CONFIG_PERF_EVENTS=y kernel support " |
@@ -978,7 +978,7 @@ try_again: | |||
978 | } | 978 | } |
979 | 979 | ||
980 | if (perf_evlist__mmap(evlist, top->mmap_pages, false) < 0) { | 980 | if (perf_evlist__mmap(evlist, top->mmap_pages, false) < 0) { |
981 | ui__warning("Failed to mmap with %d (%s)\n", | 981 | ui__error("Failed to mmap with %d (%s)\n", |
982 | errno, strerror(errno)); | 982 | errno, strerror(errno)); |
983 | goto out_err; | 983 | goto out_err; |
984 | } | 984 | } |
@@ -994,12 +994,12 @@ static int perf_top__setup_sample_type(struct perf_top *top) | |||
994 | { | 994 | { |
995 | if (!top->sort_has_symbols) { | 995 | if (!top->sort_has_symbols) { |
996 | if (symbol_conf.use_callchain) { | 996 | if (symbol_conf.use_callchain) { |
997 | ui__warning("Selected -g but \"sym\" not present in --sort/-s."); | 997 | ui__error("Selected -g but \"sym\" not present in --sort/-s."); |
998 | return -EINVAL; | 998 | return -EINVAL; |
999 | } | 999 | } |
1000 | } else if (!top->dont_use_callchains && callchain_param.mode != CHAIN_NONE) { | 1000 | } else if (!top->dont_use_callchains && callchain_param.mode != CHAIN_NONE) { |
1001 | if (callchain_register_param(&callchain_param) < 0) { | 1001 | if (callchain_register_param(&callchain_param) < 0) { |
1002 | ui__warning("Can't register callchain params.\n"); | 1002 | ui__error("Can't register callchain params.\n"); |
1003 | return -EINVAL; | 1003 | return -EINVAL; |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
@@ -1041,7 +1041,7 @@ static int __cmd_top(struct perf_top *top) | |||
1041 | 1041 | ||
1042 | if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui : | 1042 | if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui : |
1043 | display_thread), top)) { | 1043 | display_thread), top)) { |
1044 | printf("Could not create display thread.\n"); | 1044 | ui__error("Could not create display thread.\n"); |
1045 | exit(-1); | 1045 | exit(-1); |
1046 | } | 1046 | } |
1047 | 1047 | ||
@@ -1050,7 +1050,7 @@ static int __cmd_top(struct perf_top *top) | |||
1050 | 1050 | ||
1051 | param.sched_priority = top->realtime_prio; | 1051 | param.sched_priority = top->realtime_prio; |
1052 | if (sched_setscheduler(0, SCHED_FIFO, ¶m)) { | 1052 | if (sched_setscheduler(0, SCHED_FIFO, ¶m)) { |
1053 | printf("Could not set realtime priority.\n"); | 1053 | ui__error("Could not set realtime priority.\n"); |
1054 | exit(-1); | 1054 | exit(-1); |
1055 | } | 1055 | } |
1056 | } | 1056 | } |
@@ -1274,7 +1274,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1274 | int saved_errno = errno; | 1274 | int saved_errno = errno; |
1275 | 1275 | ||
1276 | perf_target__strerror(&top.target, status, errbuf, BUFSIZ); | 1276 | perf_target__strerror(&top.target, status, errbuf, BUFSIZ); |
1277 | ui__warning("%s", errbuf); | 1277 | ui__error("%s", errbuf); |
1278 | 1278 | ||
1279 | status = -saved_errno; | 1279 | status = -saved_errno; |
1280 | goto out_delete_evlist; | 1280 | goto out_delete_evlist; |
@@ -1288,7 +1288,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1288 | 1288 | ||
1289 | if (!top.evlist->nr_entries && | 1289 | if (!top.evlist->nr_entries && |
1290 | perf_evlist__add_default(top.evlist) < 0) { | 1290 | perf_evlist__add_default(top.evlist) < 0) { |
1291 | pr_err("Not enough memory for event selector list\n"); | 1291 | ui__error("Not enough memory for event selector list\n"); |
1292 | return -ENOMEM; | 1292 | return -ENOMEM; |
1293 | } | 1293 | } |
1294 | 1294 | ||
@@ -1305,7 +1305,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1305 | else if (top.freq) { | 1305 | else if (top.freq) { |
1306 | top.default_interval = top.freq; | 1306 | top.default_interval = top.freq; |
1307 | } else { | 1307 | } else { |
1308 | fprintf(stderr, "frequency and count are zero, aborting\n"); | 1308 | ui__error("frequency and count are zero, aborting\n"); |
1309 | exit(EXIT_FAILURE); | 1309 | exit(EXIT_FAILURE); |
1310 | } | 1310 | } |
1311 | 1311 | ||