aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2016-02-09 23:00:36 -0500
committerSteven Rostedt <rostedt@goodmis.org>2016-02-10 13:39:19 -0500
commitbcbd60c123e07c92032d71345dd9ec36bf4713c7 (patch)
treea4dffba931baa54fae4e753613607dc6ecebf820
parent4eb0d0c29f302c926d91cd23a075a50e96f7b507 (diff)
downloadtrace-cmd-bcbd60c123e07c92032d71345dd9ec36bf4713c7.tar.gz
kernelshark: Do not calculate the graph the first time
It appears that showing the window widget calls the configure event for the graph, which does the calculation of all the events. Then in gtk_main() that is called again, with a slightly different width (perhaps the window manager changed it?). This causes the same calculations to happen again. When it takes 15 seconds (or more) to draw the graph due to millions of events, doubling the time is quite annoying. Add a flag to not draw the events the first time through. Then draw them from then on. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel-shark.c8
-rw-r--r--trace-graph-main.c2
-rw-r--r--trace-graph.c3
-rw-r--r--trace-graph.h2
4 files changed, 14 insertions, 1 deletions
diff --git a/kernel-shark.c b/kernel-shark.c
index bd30d4fd..3100bf34 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -2372,8 +2372,16 @@ void kernel_shark(int argc, char **argv)
gtk_widget_set_size_request(window, TRACE_WIDTH, TRACE_HEIGHT);
gdk_threads_enter();
+
+ /*
+ * The showing of the window will configure the graph and it will
+ * waste time drawing the events. But after the window appears and
+ * a border is displayed, the graph gets shown again.
+ */
+ info->ginfo->no_draw = TRUE;
gtk_widget_show (window);
+ info->ginfo->no_draw = FALSE;
gtk_main ();
gdk_threads_leave();
}
diff --git a/trace-graph-main.c b/trace-graph-main.c
index 36542958..7215d9a9 100644
--- a/trace-graph-main.c
+++ b/trace-graph-main.c
@@ -481,7 +481,9 @@ void trace_graph(int argc, char **argv)
gtk_widget_set_size_request(window, TRACE_WIDTH, TRACE_HEIGHT);
+ ginfo->no_draw = TRUE;
gtk_widget_show (window);
+ ginfo->no_draw = FALSE;
gtk_main ();
}
diff --git a/trace-graph.c b/trace-graph.c
index d28977f5..736800bb 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -2263,7 +2263,8 @@ configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height);
- redraw_pixmap_backend(ginfo);
+ if (!ginfo->no_draw)
+ redraw_pixmap_backend(ginfo);
/* debug */
ginfo->hadj_value = gtk_adjustment_get_value(ginfo->hadj);
diff --git a/trace-graph.h b/trace-graph.h
index f45294f6..8ea0514e 100644
--- a/trace-graph.h
+++ b/trace-graph.h
@@ -185,6 +185,8 @@ struct graph_info {
guint64 view_end_time; /* visible end time */
gint start_x; /* virutal start of visible area */
+ gboolean no_draw; /* skip drawing the events */
+
guint64 cursor; /* time of cursor (double clicked) */
gdouble resolution; /* pixels / time */