aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2012-05-29 00:22:57 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-29 10:53:42 -0400
commit3780f4883b2f3319afe88bf3ddc73ef426851d49 (patch)
tree240a22d02b4ba502e5e68c1a6526db6338acc782 /tools
parent21f0d423b989284f82004d0f80c75581fec91fb2 (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')
-rw-r--r--tools/perf/builtin-annotate.c2
-rw-r--r--tools/perf/builtin-record.c14
-rw-r--r--tools/perf/builtin-report.c14
-rw-r--r--tools/perf/builtin-top.c22
4 files changed, 25 insertions, 27 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 806e0a286634..67522cf87405 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -215,7 +215,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
215 } 215 }
216 216
217 if (total_nr_samples == 0) { 217 if (total_nr_samples == 0) {
218 ui__warning("The %s file has no samples!\n", session->filename); 218 ui__error("The %s file has no samples!\n", session->filename);
219 goto out_delete; 219 goto out_delete;
220 } 220 }
221out_delete: 221out_delete:
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e5cb08427e13..f95840d04e4c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -264,7 +264,7 @@ try_again:
264 } 264 }
265 265
266 if (err == ENOENT) { 266 if (err == ENOENT) {
267 ui__warning("The %s event is not supported.\n", 267 ui__error("The %s event is not supported.\n",
268 event_name(pos)); 268 event_name(pos));
269 exit(EXIT_FAILURE); 269 exit(EXIT_FAILURE);
270 } 270 }
@@ -858,8 +858,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
858 usage_with_options(record_usage, record_options); 858 usage_with_options(record_usage, record_options);
859 859
860 if (rec->force && rec->append_file) { 860 if (rec->force && rec->append_file) {
861 fprintf(stderr, "Can't overwrite and append at the same time." 861 ui__error("Can't overwrite and append at the same time."
862 " You need to choose between -f and -A"); 862 " You need to choose between -f and -A");
863 usage_with_options(record_usage, record_options); 863 usage_with_options(record_usage, record_options);
864 } else if (rec->append_file) { 864 } else if (rec->append_file) {
865 rec->write_mode = WRITE_APPEND; 865 rec->write_mode = WRITE_APPEND;
@@ -868,8 +868,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
868 } 868 }
869 869
870 if (nr_cgroups && !rec->opts.target.system_wide) { 870 if (nr_cgroups && !rec->opts.target.system_wide) {
871 fprintf(stderr, "cgroup monitoring only available in" 871 ui__error("cgroup monitoring only available in"
872 " system-wide mode\n"); 872 " system-wide mode\n");
873 usage_with_options(record_usage, record_options); 873 usage_with_options(record_usage, record_options);
874 } 874 }
875 875
@@ -905,7 +905,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
905 int saved_errno = errno; 905 int saved_errno = errno;
906 906
907 perf_target__strerror(&rec->opts.target, err, errbuf, BUFSIZ); 907 perf_target__strerror(&rec->opts.target, err, errbuf, BUFSIZ);
908 ui__warning("%s", errbuf); 908 ui__error("%s", errbuf);
909 909
910 err = -saved_errno; 910 err = -saved_errno;
911 goto out_free_fd; 911 goto out_free_fd;
@@ -933,7 +933,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
933 else if (rec->opts.freq) { 933 else if (rec->opts.freq) {
934 rec->opts.default_interval = rec->opts.freq; 934 rec->opts.default_interval = rec->opts.freq;
935 } else { 935 } else {
936 fprintf(stderr, "frequency and count are zero, aborting\n"); 936 ui__error("frequency and count are zero, aborting\n");
937 err = -EINVAL; 937 err = -EINVAL;
938 goto out_free_fd; 938 goto out_free_fd;
939 } 939 }
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d58e41445d0d..8c767c6bca91 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -251,13 +251,13 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
251 251
252 if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) { 252 if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
253 if (sort__has_parent) { 253 if (sort__has_parent) {
254 ui__warning("Selected --sort parent, but no " 254 ui__error("Selected --sort parent, but no "
255 "callchain data. Did you call " 255 "callchain data. Did you call "
256 "'perf record' without -g?\n"); 256 "'perf record' without -g?\n");
257 return -EINVAL; 257 return -EINVAL;
258 } 258 }
259 if (symbol_conf.use_callchain) { 259 if (symbol_conf.use_callchain) {
260 ui__warning("Selected -g but no callchain data. Did " 260 ui__error("Selected -g but no callchain data. Did "
261 "you call 'perf record' without -g?\n"); 261 "you call 'perf record' without -g?\n");
262 return -1; 262 return -1;
263 } 263 }
@@ -266,17 +266,15 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
266 !symbol_conf.use_callchain) { 266 !symbol_conf.use_callchain) {
267 symbol_conf.use_callchain = true; 267 symbol_conf.use_callchain = true;
268 if (callchain_register_param(&callchain_param) < 0) { 268 if (callchain_register_param(&callchain_param) < 0) {
269 ui__warning("Can't register callchain " 269 ui__error("Can't register callchain params.\n");
270 "params.\n");
271 return -EINVAL; 270 return -EINVAL;
272 } 271 }
273 } 272 }
274 273
275 if (sort__branch_mode == 1) { 274 if (sort__branch_mode == 1) {
276 if (!(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) { 275 if (!(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
277 fprintf(stderr, "selected -b but no branch data." 276 ui__error("Selected -b but no branch data. "
278 " Did you call perf record without" 277 "Did you call perf record without -b?\n");
279 " -b?\n");
280 return -1; 278 return -1;
281 } 279 }
282 } 280 }
@@ -420,7 +418,7 @@ static int __cmd_report(struct perf_report *rep)
420 } 418 }
421 419
422 if (nr_samples == 0) { 420 if (nr_samples == 0) {
423 ui__warning("The %s file has no samples!\n", session->filename); 421 ui__error("The %s file has no samples!\n", session->filename);
424 goto out_delete; 422 goto out_delete;
425 } 423 }
426 424
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, &param)) { 1052 if (sched_setscheduler(0, SCHED_FIFO, &param)) {
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