diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-02-11 09:37:03 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-11 09:37:03 -0500 |
| commit | 233e681fb3e062b4c220d50ae70ff0f7f41e26de (patch) | |
| tree | 59d90b956ca337a8e6ef65803db04686c81bc5fc | |
| parent | b680c7a6397c359bfc3d99037e8bf1766c46a0ae (diff) | |
kernelshark: Add checkbox to make graph follow list cursor
Add a check box, that when set, the graph will follow the cursor
of the list. This makes moving the graph with searches nicer.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | kernel-shark.c | 57 | ||||
| -rw-r--r-- | kernel-shark.h | 1 |
2 files changed, 53 insertions, 5 deletions
diff --git a/kernel-shark.c b/kernel-shark.c index e6851e8..50e2659 100644 --- a/kernel-shark.c +++ b/kernel-shark.c | |||
| @@ -294,12 +294,10 @@ cpus_clicked (gpointer data) | |||
| 294 | trace_view_cpu_filter_callback, trace_tree); | 294 | trace_view_cpu_filter_callback, trace_tree); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | static void row_double_clicked(GtkTreeView *treeview, | 297 | static void graph_follows_tree(struct shark_info *info, |
| 298 | GtkTreePath *path, | 298 | GtkTreeView *treeview, |
| 299 | GtkTreeViewColumn *col, | 299 | GtkTreePath *path) |
| 300 | gpointer data) | ||
| 301 | { | 300 | { |
| 302 | struct shark_info *info = data; | ||
| 303 | TraceViewRecord *rec; | 301 | TraceViewRecord *rec; |
| 304 | GtkTreeModel *model; | 302 | GtkTreeModel *model; |
| 305 | gchar *spath; | 303 | gchar *spath; |
| @@ -320,6 +318,35 @@ static void row_double_clicked(GtkTreeView *treeview, | |||
| 320 | trace_graph_select_by_time(info->ginfo, time); | 318 | trace_graph_select_by_time(info->ginfo, time); |
| 321 | } | 319 | } |
| 322 | 320 | ||
| 321 | static void row_double_clicked(GtkTreeView *treeview, | ||
| 322 | GtkTreePath *path, | ||
| 323 | GtkTreeViewColumn *col, | ||
| 324 | gpointer data) | ||
| 325 | { | ||
| 326 | struct shark_info *info = data; | ||
| 327 | |||
| 328 | graph_follows_tree(info, treeview, path); | ||
| 329 | } | ||
| 330 | |||
| 331 | static void cursor_changed(GtkTreeView *treeview, | ||
| 332 | gpointer data) | ||
| 333 | { | ||
| 334 | struct shark_info *info = data; | ||
| 335 | GtkTreePath *path; | ||
| 336 | |||
| 337 | if (!info->graph_follows) | ||
| 338 | return; | ||
| 339 | |||
| 340 | gtk_tree_view_get_cursor(treeview, &path, NULL); | ||
| 341 | |||
| 342 | if (!path) | ||
| 343 | return; | ||
| 344 | |||
| 345 | graph_follows_tree(info, treeview, path); | ||
| 346 | |||
| 347 | gtk_tree_path_free(path); | ||
| 348 | } | ||
| 349 | |||
| 323 | static void | 350 | static void |
| 324 | filter_graph_enable_clicked (gpointer data) | 351 | filter_graph_enable_clicked (gpointer data) |
| 325 | { | 352 | { |
| @@ -376,6 +403,13 @@ filter_clear_tasks_clicked (gpointer data) | |||
| 376 | info->list_filter_enabled = 0; | 403 | info->list_filter_enabled = 0; |
| 377 | } | 404 | } |
| 378 | 405 | ||
| 406 | static void graph_check_toggle(gpointer data, GtkWidget *widget) | ||
| 407 | { | ||
| 408 | struct shark_info *info = data; | ||
| 409 | |||
| 410 | info->graph_follows = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | ||
| 411 | } | ||
| 412 | |||
| 379 | static gboolean | 413 | static gboolean |
| 380 | do_tree_popup(GtkWidget *widget, GdkEventButton *event, gpointer data) | 414 | do_tree_popup(GtkWidget *widget, GdkEventButton *event, gpointer data) |
| 381 | { | 415 | { |
| @@ -552,6 +586,7 @@ void kernel_shark(int argc, char **argv) | |||
| 552 | GtkWidget *widget; | 586 | GtkWidget *widget; |
| 553 | GtkWidget *label; | 587 | GtkWidget *label; |
| 554 | GtkWidget *spin; | 588 | GtkWidget *spin; |
| 589 | GtkWidget *check; | ||
| 555 | int ret; | 590 | int ret; |
| 556 | int c; | 591 | int c; |
| 557 | 592 | ||
| @@ -807,6 +842,15 @@ void kernel_shark(int argc, char **argv) | |||
| 807 | 842 | ||
| 808 | trace_view_search_setup(GTK_BOX(hbox), GTK_TREE_VIEW(info->treeview)); | 843 | trace_view_search_setup(GTK_BOX(hbox), GTK_TREE_VIEW(info->treeview)); |
| 809 | 844 | ||
| 845 | check = gtk_check_button_new_with_label("graph follows"); | ||
| 846 | gtk_box_pack_start(GTK_BOX(hbox), check, TRUE, TRUE, 0); | ||
| 847 | gtk_widget_show(check); | ||
| 848 | |||
| 849 | g_signal_connect_swapped (check, "toggled", | ||
| 850 | G_CALLBACK (graph_check_toggle), | ||
| 851 | (gpointer) info); | ||
| 852 | |||
| 853 | |||
| 810 | /* --- Top Level Trace View Paging Hbox --- */ | 854 | /* --- Top Level Trace View Paging Hbox --- */ |
| 811 | 855 | ||
| 812 | hbox = gtk_hbox_new(FALSE, 0); | 856 | hbox = gtk_hbox_new(FALSE, 0); |
| @@ -826,6 +870,9 @@ void kernel_shark(int argc, char **argv) | |||
| 826 | g_signal_connect(info->treeview, "row-activated", | 870 | g_signal_connect(info->treeview, "row-activated", |
| 827 | (GCallback)row_double_clicked, info); | 871 | (GCallback)row_double_clicked, info); |
| 828 | 872 | ||
| 873 | g_signal_connect(info->treeview, "cursor-changed", | ||
| 874 | (GCallback)cursor_changed, info); | ||
| 875 | |||
| 829 | gtk_container_add(GTK_CONTAINER(scrollwin), info->treeview); | 876 | gtk_container_add(GTK_CONTAINER(scrollwin), info->treeview); |
| 830 | 877 | ||
| 831 | gtk_signal_connect(GTK_OBJECT(info->treeview), "button_press_event", | 878 | gtk_signal_connect(GTK_OBJECT(info->treeview), "button_press_event", |
diff --git a/kernel-shark.h b/kernel-shark.h index f04e902..461f0a2 100644 --- a/kernel-shark.h +++ b/kernel-shark.h | |||
| @@ -13,6 +13,7 @@ struct shark_info { | |||
| 13 | struct graph_callbacks graph_cbs; | 13 | struct graph_callbacks graph_cbs; |
| 14 | gint selected_task; | 14 | gint selected_task; |
| 15 | gboolean list_filter_enabled; | 15 | gboolean list_filter_enabled; |
| 16 | gboolean graph_follows; | ||
| 16 | }; | 17 | }; |
| 17 | 18 | ||
| 18 | #define offset_of(type, field) (long)(&((type *)0)->field) | 19 | #define offset_of(type, field) (long)(&((type *)0)->field) |
