From 810abc5b84f2855cc328cb709e75046a646be463 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 30 Mar 2010 16:45:31 -0400 Subject: kernelshark: Created trace_get_file_dialog() to ask for filename Added shortcut trace_get_file_dialog() to simplify the asking for a file name. Signed-off-by: Steven Rostedt --- trace-graph-main.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'trace-graph-main.c') diff --git a/trace-graph-main.c b/trace-graph-main.c index b373dd2..303f342 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c @@ -29,6 +29,7 @@ #include "trace-cmd.h" #include "trace-graph.h" #include "trace-filter.h" +#include "trace-gui.h" #define version "0.1.1" @@ -52,26 +53,19 @@ load_clicked (gpointer data) { struct graph_info *ginfo = data; struct tracecmd_input *handle; - GtkWidget *dialog; gchar *filename; - dialog = gtk_file_chooser_dialog_new("Load File", - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { - filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - handle = tracecmd_open(filename); - if (handle) { - trace_graph_load_handle(ginfo, handle); - /* Free handle when freeing graph */ - tracecmd_close(handle); - } - g_free(filename); + filename = trace_get_file_dialog("Load File"); + if (!filename) + return; + + handle = tracecmd_open(filename); + if (handle) { + trace_graph_load_handle(ginfo, handle); + /* Free handle when freeing graph */ + tracecmd_close(handle); } - gtk_widget_destroy(dialog); + g_free(filename); } /* Callback for the clicked signal of the Exit button */ -- cgit v1.2.2 From 38b92d6b993327de864ef7182cebe530abc5f5c7 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Mon, 5 Apr 2010 21:30:53 -0400 Subject: trace-graph: Add loading and saving of task and event filters Add the filter loading and saving to trace-graph. Most of the work was done already to get trace-view working. This just hooks into that framework. Signed-off-by: Steven Rostedt --- trace-graph-main.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'trace-graph-main.c') diff --git a/trace-graph-main.c b/trace-graph-main.c index 303f342..4a9fed1 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c @@ -152,6 +152,50 @@ plot_tasks_clicked (gpointer data) free(selected); } +/* Callback for the clicked signal of the Load Filters button */ +static void +load_filters_clicked (gpointer data) +{ + struct graph_info *ginfo = data; + struct tracecmd_xml_handle *handle; + gchar *filename; + + filename = trace_get_file_dialog("Load Filters"); + if (!filename) + return; + + handle = tracecmd_xml_open(filename); + if (!handle) + warning("Could not open %s", filename); + g_free(filename); + + trace_graph_load_filters(ginfo, handle); + + tracecmd_xml_close(handle); +} + +/* Callback for the clicked signal of the Save Filters button */ +static void +save_filters_clicked (gpointer data) +{ + struct graph_info *ginfo = data; + struct tracecmd_xml_handle *handle; + gchar *filename; + + filename = trace_get_file_dialog("Save Filters"); + if (!filename) + return; + + handle = tracecmd_xml_create(filename); + if (!handle) + warning("Could not create %s", filename); + g_free(filename); + + trace_graph_save_filters(ginfo, handle); + + tracecmd_xml_close(handle); +} + void trace_graph(int argc, char **argv) { struct tracecmd_input *handle = NULL; @@ -247,6 +291,35 @@ void trace_graph(int argc, char **argv) gtk_widget_show(sub_item); + /* --- File - Load Filter Option --- */ + + sub_item = gtk_menu_item_new_with_label("Load filters"); + + /* Add them to the menu */ + gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); + + g_signal_connect_swapped (G_OBJECT (sub_item), "activate", + G_CALLBACK (load_filters_clicked), + (gpointer) ginfo); + + /* We do need to show menu items */ + gtk_widget_show(sub_item); + + + /* --- File - Save Filter Option --- */ + + sub_item = gtk_menu_item_new_with_label("Save filters"); + + /* Add them to the menu */ + gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); + + g_signal_connect_swapped (G_OBJECT (sub_item), "activate", + G_CALLBACK (save_filters_clicked), + (gpointer) ginfo); + + /* We do need to show menu items */ + gtk_widget_show(sub_item); + /* --- File - Quit Option --- */ sub_item = gtk_menu_item_new_with_label("Quit"); -- cgit v1.2.2 From 20359fdc358744dee36b8e59c234e965fc7d2a69 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Mon, 5 Apr 2010 22:40:54 -0400 Subject: kernelshark: Make all saved filters under KernelShark Make the xml doc under ... for trace-view and trace-graph. Also pull out the task filters since the view and graph in kernelshark share the same filters. Signed-off-by: Steven Rostedt --- trace-graph-main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'trace-graph-main.c') diff --git a/trace-graph-main.c b/trace-graph-main.c index 4a9fed1..0490a86 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c @@ -31,6 +31,8 @@ #include "trace-filter.h" #include "trace-gui.h" +#include "version.h" + #define version "0.1.1" #define TRACE_WIDTH 800 @@ -169,6 +171,9 @@ load_filters_clicked (gpointer data) warning("Could not open %s", filename); g_free(filename); + trace_filter_load_filters(handle, ginfo->task_filter, + ginfo->hide_tasks); + trace_graph_load_filters(ginfo, handle); tracecmd_xml_close(handle); @@ -186,11 +191,14 @@ save_filters_clicked (gpointer data) if (!filename) return; - handle = tracecmd_xml_create(filename); + handle = tracecmd_xml_create(filename, VERSION_STRING); if (!handle) warning("Could not create %s", filename); g_free(filename); + trace_filter_save_filters(handle, ginfo->task_filter, + ginfo->hide_tasks); + trace_graph_save_filters(ginfo, handle); tracecmd_xml_close(handle); -- cgit v1.2.2 From b75d856e313af97226686e3ada78b633874ded29 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 6 Apr 2010 12:33:46 -0400 Subject: kernelshark: Move status bar to general code for trace-view and trace-graph Move the code for the status bar to trace-dialog.c and have trace-view and trace-graph have access to it too. Signed-off-by: Steven Rostedt --- trace-graph-main.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'trace-graph-main.c') diff --git a/trace-graph-main.c b/trace-graph-main.c index 0490a86..286e417 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c @@ -216,6 +216,7 @@ void trace_graph(int argc, char **argv) GtkWidget *menu_item; GtkWidget *sub_item; GtkWidget *widget; + GtkWidget *statusbar; int c; int ret; @@ -455,6 +456,14 @@ void trace_graph(int argc, char **argv) gtk_widget_show(widget); + /* --- Set up Status Bar --- */ + + statusbar = trace_status_bar_new(); + + gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0); + gtk_widget_show(statusbar); + + /********************************************** * Main Window **********************************************/ -- cgit v1.2.2 From 0af521a7ba132afbc83aff1216ce3457f97cc09c Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 6 Apr 2010 14:48:18 -0400 Subject: kernelshark: Add warning dialogs When a warning happens, show it with a dialog instead of printing to the console. Signed-off-by: Steven Rostedt --- trace-graph-main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'trace-graph-main.c') diff --git a/trace-graph-main.c b/trace-graph-main.c index 286e417..2ba9447 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c @@ -262,6 +262,8 @@ void trace_graph(int argc, char **argv) window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + trace_dialog_register_window(window); + /* --- Top Level Vbox --- */ vbox = gtk_vbox_new(FALSE, 0); -- cgit v1.2.2 From ce6dcdc247fc6194566360e74fcb986fa656043a Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 10 Jun 2010 16:15:19 -0400 Subject: kernelshark: Fix the xml save/load to handle separate task filters Update the save/load of the filters to handle the change to make the List and Graph have separate task filters. Signed-off-by: Steven Rostedt --- trace-graph-main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'trace-graph-main.c') diff --git a/trace-graph-main.c b/trace-graph-main.c index 2ba9447..b4f05fb 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c @@ -171,7 +171,9 @@ load_filters_clicked (gpointer data) warning("Could not open %s", filename); g_free(filename); - trace_filter_load_filters(handle, ginfo->task_filter, + trace_filter_load_filters(handle, + "GraphTaskFilter", + ginfo->task_filter, ginfo->hide_tasks); trace_graph_load_filters(ginfo, handle); @@ -196,7 +198,9 @@ save_filters_clicked (gpointer data) warning("Could not create %s", filename); g_free(filename); - trace_filter_save_filters(handle, ginfo->task_filter, + trace_filter_save_filters(handle, + "GraphTaskFilter", + ginfo->task_filter, ginfo->hide_tasks); trace_graph_save_filters(ginfo, handle); -- cgit v1.2.2