diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2016-02-01 22:07:21 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-02-09 22:12:14 -0500 |
commit | 584bb2e69fa2123c6e36f34878b0fa0fe679f20f (patch) | |
tree | 588ab6e971c6dcdff74ad6a6c0f2626557badd11 | |
parent | ccdd17d99e3976167ad59dfb98256c6ef193f469 (diff) | |
download | trace-cmd-584bb2e69fa2123c6e36f34878b0fa0fe679f20f.tar.gz |
kernelshark: Add event and box info struct to plot struct
Instead of passing in an info structure to the plot_event() code, have
the structure part of the plot structure itself. Then it can have
static data across calls.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-graph.c | 23 | ||||
-rw-r--r-- | trace-graph.h | 9 | ||||
-rw-r--r-- | trace-plot-cpu.c | 4 | ||||
-rw-r--r-- | trace-plot-task.c | 4 | ||||
-rw-r--r-- | trace-plot.c | 8 |
5 files changed, 25 insertions, 23 deletions
diff --git a/trace-graph.c b/trace-graph.c index 0a808636..3c981d7e 100644 --- a/trace-graph.c +++ b/trace-graph.c @@ -1742,7 +1742,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, static PangoFontDescription *font; PangoLayout *layout; static gint width_16; - struct plot_info info; + struct plot_info *info; gint x; /* Calculate the size of 16 characters */ @@ -1760,25 +1760,26 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, g_object_unref(layout); } - trace_graph_plot_event(ginfo, plot, record, &info); + trace_graph_plot_event(ginfo, plot, record); + info = &plot->info; - if (info.box) { - if (info.bcolor != plot->last_color) { - plot->last_color = info.bcolor; + if (info->box) { + if (info->bcolor != plot->last_color) { + plot->last_color = info->bcolor; set_color(ginfo->draw, plot->gc, plot->last_color); } - draw_plot_box(ginfo, plot->pos, info.bstart, info.bend, - info.bfill, plot->gc); + draw_plot_box(ginfo, plot->pos, info->bstart, info->bend, + info->bfill, plot->gc); } - if (info.line) { - if (info.lcolor != plot->last_color) { - plot->last_color = info.lcolor; + if (info->line) { + if (info->lcolor != plot->last_color) { + plot->last_color = info->lcolor; set_color(ginfo->draw, plot->gc, plot->last_color); } - x = draw_plot_line(ginfo, plot->pos, info.ltime, plot->gc); + x = draw_plot_line(ginfo, plot->pos, info->ltime, plot->gc); /* Figure out if we can show the text for the previous record */ diff --git a/trace-graph.h b/trace-graph.h index 122124f3..25f8f885 100644 --- a/trace-graph.h +++ b/trace-graph.h @@ -101,8 +101,7 @@ struct plot_callbacks { unsigned long long time); int (*plot_event)(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record, - struct plot_info *info); + struct pevent_record *record); void (*end)(struct graph_info *, struct graph_plot *); int (*display_last_event)(struct graph_info *ginfo, struct graph_plot *plot, struct trace_seq *s, unsigned long long time); @@ -122,7 +121,8 @@ struct graph_plot { void *private; /* Used for drawing */ - gint last_color; + struct plot_info info; + gint last_color; gint p1, p2, p3; GdkGC *gc; }; @@ -362,8 +362,7 @@ void trace_graph_plot_start(struct graph_info *ginfo, int trace_graph_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record, - struct plot_info *info); + struct pevent_record *record); void trace_graph_plot_end(struct graph_info *ginfo, struct graph_plot *plot); diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c index a14712e3..eab5656c 100644 --- a/trace-plot-cpu.c +++ b/trace-plot-cpu.c @@ -236,10 +236,10 @@ static void update_last_record(struct graph_info *ginfo, static int cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record, - struct plot_info *info) + struct pevent_record *record) { struct cpu_plot_info *cpu_info = plot->private; + struct plot_info *info = &plot->info; int sched_pid; int orig_pid; int is_sched_switch; diff --git a/trace-plot-task.c b/trace-plot-task.c index f6677860..78f40923 100644 --- a/trace-plot-task.c +++ b/trace-plot-task.c @@ -413,10 +413,10 @@ static void update_last_record(struct graph_info *ginfo, static int task_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record, - struct plot_info *info) + struct pevent_record *record) { struct task_plot_info *task_info = plot->private; + struct plot_info *info = &plot->info; gboolean match; int sched_pid; int rec_pid; diff --git a/trace-plot.c b/trace-plot.c index 47c7f18c..ac8cffd1 100644 --- a/trace-plot.c +++ b/trace-plot.c @@ -336,9 +336,11 @@ void trace_graph_plot_start(struct graph_info *ginfo, int trace_graph_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record, - struct plot_info *info) + struct pevent_record *record) + { + struct plot_info *info = &plot->info; + info->line = FALSE; info->box = FALSE; info->bfill = TRUE; @@ -346,7 +348,7 @@ int trace_graph_plot_event(struct graph_info *ginfo, if (!plot->cb->plot_event) return 0; - return plot->cb->plot_event(ginfo, plot, record, info); + return plot->cb->plot_event(ginfo, plot, record); } void trace_graph_plot_end(struct graph_info *ginfo, |