aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-06-16 16:29:16 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-06-16 16:35:59 -0400
commit22be8b7ddcb744cc206bc369ab4c2e2a4e16f45d (patch)
tree9f05d629020a92d5d2ed45da0ec7a813f18c2f10
parentb4c297ef8fb24e1b3923a16d3e7267320a3d0f83 (diff)
kernelshark: Show only one pop up warning message after loading file
Instead of showing every little error that happened while loading a trace file, show only one message at the end. Have the warnings go to the display status and the user can reference them there. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel-shark.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel-shark.c b/kernel-shark.c
index 0c50849..87e4c40 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -65,6 +65,8 @@ void usage(char *prog)
65 printf(" -i input_file, default is %s\n", default_input_file); 65 printf(" -i input_file, default is %s\n", default_input_file);
66} 66}
67 67
68static gboolean display_warnings;
69
68/* 70/*
69 * trace_sync_select_menu - helper function to the syncing of list and graph filters 71 * trace_sync_select_menu - helper function to the syncing of list and graph filters
70 * 72 *
@@ -284,6 +286,12 @@ static void sync_event_filters(struct shark_info *info)
284 gtk_widget_hide(info->list_adv_events_menu); 286 gtk_widget_hide(info->list_adv_events_menu);
285} 287}
286 288
289static void alt_warn(const char *fmt, va_list ap)
290{
291 display_warnings = TRUE;
292 vpr_stat(fmt, ap);
293}
294
287/** 295/**
288 * kernelshark_load_file - load a new file into kernelshark 296 * kernelshark_load_file - load a new file into kernelshark
289 * @info: the kernelshark descriptor 297 * @info: the kernelshark descriptor
@@ -295,7 +303,20 @@ int kernelshark_load_file(struct shark_info *info, const char *file)
295{ 303{
296 struct tracecmd_input *handle; 304 struct tracecmd_input *handle;
297 305
306 /*
307 * Have warnings go into the status bar. If we had any
308 * warnings, pop up a message at the end.
309 */
310 display_warnings = 0;
311 pr_stat("\nLoading file %s", file);
312 trace_dialog_register_alt_warning(alt_warn);
298 handle = tracecmd_open(file); 313 handle = tracecmd_open(file);
314 trace_dialog_register_alt_warning(NULL);
315 if (display_warnings) {
316 errno = 0;
317 warning("Warnings occurred on loading.\n"
318 "See display status for details");
319 }
299 if (!handle) 320 if (!handle)
300 return -1; 321 return -1;
301 322