aboutsummaryrefslogtreecommitdiffstats
path: root/trace-view.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-12-02 21:23:17 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-17 21:43:47 -0500
commit064e10948d40840c8521f7f94cc3275eb8075b07 (patch)
treed4029da9e8ba72e7eefdab569014a6744aabe02e /trace-view.c
parentac9d350897a5a6fec7b0e10cc421dc9a0aa995eb (diff)
Add paging of large data files
Loading a large (100,000+ entry) data file can take a very long time, and is quite annoying to wait for. This patch breaks the data up into pages (10,000 rows per page). Then it lets the user move about the pages with a scroll button. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-view.c')
-rw-r--r--trace-view.c72
1 files changed, 70 insertions, 2 deletions
diff --git a/trace-view.c b/trace-view.c
index ac71c7c..555f1aa 100644
--- a/trace-view.c
+++ b/trace-view.c
@@ -80,6 +80,44 @@ cpus_clicked (gpointer data)
80 trace_filter_cpu_dialog(trace_tree); 80 trace_filter_cpu_dialog(trace_tree);
81} 81}
82 82
83#if 0
84static GtkTreeModel *
85create_combo_box_model(void)
86{
87 GtkListStore *store;
88 GtkTreeIter iter;
89
90 store = gtk_list_store_new(1, G_TYPE_STRING);
91 gtk_list_store_append(store, &iter);
92 gtk_list_store_set(store, &iter, 0, "1", -1);
93
94 return GTK_TREE_MODEL(store);
95}
96#endif
97
98static void
99spin_changed(gpointer data, GtkWidget *spin)
100{
101 GtkTreeView *tree = data;
102 GtkTreeModel *model;
103 gint val, page;
104
105 val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
106
107 model = gtk_tree_view_get_model(tree);
108 page = trace_view_store_get_page(TRACE_VIEW_STORE(model));
109 if (page == val)
110 return;
111
112 g_object_ref(model);
113 gtk_tree_view_set_model(tree, NULL);
114
115 trace_view_store_set_page(TRACE_VIEW_STORE(model), val);
116
117 gtk_tree_view_set_model(tree, model);
118 g_object_unref(model);
119}
120
83static GtkTreeModel * 121static GtkTreeModel *
84create_trace_view_model(struct tracecmd_input *handle) 122create_trace_view_model(struct tracecmd_input *handle)
85{ 123{
@@ -91,7 +129,8 @@ create_trace_view_model(struct tracecmd_input *handle)
91} 129}
92 130
93static void 131static void
94load_trace_view(GtkWidget *view, struct tracecmd_input *handle) 132load_trace_view(GtkWidget *view, struct tracecmd_input *handle,
133 GtkWidget *spin)
95{ 134{
96 GtkTreeViewColumn *col; 135 GtkTreeViewColumn *col;
97 GtkCellRenderer *renderer; 136 GtkCellRenderer *renderer;
@@ -155,6 +194,9 @@ load_trace_view(GtkWidget *view, struct tracecmd_input *handle)
155 194
156 model = create_trace_view_model(handle); 195 model = create_trace_view_model(handle);
157 196
197 trace_view_store_set_spin_button(TRACE_VIEW_STORE(model), spin);
198 g_object_unref(spin);
199
158 gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); 200 gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
159 201
160 g_object_unref(model); /* destroy model automatically with view */ 202 g_object_unref(model); /* destroy model automatically with view */
@@ -171,6 +213,8 @@ void trace_view(int argc, char **argv)
171 GtkWidget *menu_item; 213 GtkWidget *menu_item;
172 GtkWidget *sub_item; 214 GtkWidget *sub_item;
173 GtkWidget *scrollwin; 215 GtkWidget *scrollwin;
216 GtkWidget *label;
217 GtkWidget *spin;
174 218
175 handle = read_trace_header(); 219 handle = read_trace_header();
176 if (!handle) 220 if (!handle)
@@ -279,6 +323,29 @@ void trace_view(int argc, char **argv)
279 /* --- End Filter Options --- */ 323 /* --- End Filter Options --- */
280 gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); 324 gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu);
281 325
326
327 /* --- Paging Hbox --- */
328
329 hbox = gtk_hbox_new(FALSE, 0);
330 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
331 gtk_widget_show(hbox);
332
333 /* --- Page Spin Button --- */
334
335 label = gtk_label_new("Page");
336 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
337 gtk_widget_show(label);
338
339 spin = gtk_spin_button_new(NULL, 1.0, 0);
340 gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin), 1, 1);
341 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
342 gtk_widget_show(spin);
343
344 g_signal_connect_swapped (G_OBJECT (spin), "value-changed",
345 G_CALLBACK (spin_changed),
346 (gpointer) trace_tree);
347
348
282 /* --- Top Level Hbox --- */ 349 /* --- Top Level Hbox --- */
283 350
284 hbox = gtk_hbox_new(FALSE, 0); 351 hbox = gtk_hbox_new(FALSE, 0);
@@ -295,7 +362,8 @@ void trace_view(int argc, char **argv)
295 362
296 /* --- Set up Trace Tree --- */ 363 /* --- Set up Trace Tree --- */
297 364
298 load_trace_view(trace_tree, handle); 365 load_trace_view(trace_tree, handle, spin);
366
299 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollwin), 367 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollwin),
300 trace_tree); 368 trace_tree);
301 gtk_widget_show(trace_tree); 369 gtk_widget_show(trace_tree);