aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2016-02-09 22:19:59 -0500
committerSteven Rostedt <rostedt@goodmis.org>2016-02-09 22:19:59 -0500
commit7f4a8d17ea6e5b92bbd3ab12ae9d1353d63e0735 (patch)
tree3f91a5ee10348b5e90276839116ede2e2b4f40c1
parent0999a66c81dd056ae791b259704c1d616a26c8ca (diff)
downloadtrace-cmd-7f4a8d17ea6e5b92bbd3ab12ae9d1353d63e0735.tar.gz
kernelshark: Don't draw overlapping event lines
When drawing the graph, if the resolution is so low that more than one event are on the same pixels, don't bother drawing the lines. This is a 30% speed up. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-graph.c20
-rw-r--r--trace-graph.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 4e0dd6ed..eee1979e 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1747,7 +1747,9 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
PangoLayout *layout;
static gint width_16;
struct plot_info *info;
- gint x;
+ gboolean skip = FALSE;
+ gint x = 0;
+ gint x2;
/* Calculate the size of 16 characters */
if (!width_16) {
@@ -1768,6 +1770,13 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
info = &plot->info;
if (info->box) {
+ x = convert_time_to_x(ginfo, info->bend);
+ x2 = convert_time_to_x(ginfo, info->bstart);
+ skip = (x == x2 && x == info->last_box_x);
+ info->last_box_x = x;
+ }
+
+ if (info->box && !skip) {
if (info->bcolor != plot->last_color) {
plot->last_color = info->bcolor;
set_color(ginfo->draw, plot->gc, plot->last_color);
@@ -1778,6 +1787,13 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
}
if (info->line) {
+ x = convert_time_to_x(ginfo, info->ltime);
+ skip = x == info->last_line_x;
+ info->last_line_x = x;
+ }
+
+ if (info->line && !skip) {
+
if (info->lcolor != plot->last_color) {
plot->last_color = info->lcolor;
set_color(ginfo->draw, plot->gc, plot->last_color);
@@ -1828,6 +1844,8 @@ static void draw_plots(struct graph_info *ginfo, gint new_width)
plot->p2 = 0;
plot->p3 = 0;
plot->last_color = -1;
+ plot->info.last_line_x = -1;
+ plot->info.last_box_x = -1;
gdk_draw_line(ginfo->curr_pixmap, ginfo->draw->style->black_gc,
0, PLOT_LINE(i), new_width, PLOT_LINE(i));
diff --git a/trace-graph.h b/trace-graph.h
index 25f8f885..f45294f6 100644
--- a/trace-graph.h
+++ b/trace-graph.h
@@ -50,6 +50,8 @@ struct plot_info {
unsigned long long bstart;
unsigned long long bend;
gboolean bfill;
+ gint last_box_x;
+ gint last_line_x;
};
/*