diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-09-17 14:44:08 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-09-17 14:44:08 -0400 |
commit | a12a227df2a7a93a7f037d3b33183eadc7254591 (patch) | |
tree | 09fd24c6083e2da63fced20da47cfea00d3c92f1 /trace-plot-cpu.c | |
parent | e34749ef3e83e155e4e6ed4cc6034c81305c3896 (diff) |
trace-graph: Fix plots to show start bars in zoomed views.
Currently, if a zoomed view has events before the start of the view,
those events are not examined to determine if the bar of a graph should
be shown at the start.
This patch adds code to the cpu and task plots to look for events
that happened before the view to determine if a bar should be shown
or not.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-plot-cpu.c')
-rw-r--r-- | trace-plot-cpu.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c index 09b1690..d6800ef 100644 --- a/trace-plot-cpu.c +++ b/trace-plot-cpu.c | |||
@@ -27,6 +27,7 @@ struct cpu_plot_info { | |||
27 | int cpu; | 27 | int cpu; |
28 | unsigned long long last_time; | 28 | unsigned long long last_time; |
29 | int last_pid; | 29 | int last_pid; |
30 | struct record *last_record; | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | static gint hash_pid(gint val) | 33 | static gint hash_pid(gint val) |
@@ -192,6 +193,7 @@ static void cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot, | |||
192 | cpu = cpu_info->cpu; | 193 | cpu = cpu_info->cpu; |
193 | cpu_info->last_time = 0ULL; | 194 | cpu_info->last_time = 0ULL; |
194 | cpu_info->last_pid = -1; | 195 | cpu_info->last_pid = -1; |
196 | cpu_info->last_record = NULL; | ||
195 | } | 197 | } |
196 | 198 | ||
197 | static int cpu_plot_event(struct graph_info *ginfo, | 199 | static int cpu_plot_event(struct graph_info *ginfo, |
@@ -200,6 +202,7 @@ static int cpu_plot_event(struct graph_info *ginfo, | |||
200 | struct plot_info *info) | 202 | struct plot_info *info) |
201 | { | 203 | { |
202 | struct cpu_plot_info *cpu_info = plot->private; | 204 | struct cpu_plot_info *cpu_info = plot->private; |
205 | struct tracecmd_input *handle = ginfo->handle; | ||
203 | int sched_pid; | 206 | int sched_pid; |
204 | int orig_pid; | 207 | int orig_pid; |
205 | int is_sched_switch; | 208 | int is_sched_switch; |
@@ -212,6 +215,11 @@ static int cpu_plot_event(struct graph_info *ginfo, | |||
212 | cpu = cpu_info->cpu; | 215 | cpu = cpu_info->cpu; |
213 | 216 | ||
214 | if (!record) { | 217 | if (!record) { |
218 | if (cpu_info->last_record) { | ||
219 | free_record(cpu_info->last_record); | ||
220 | cpu_info->last_record = NULL; | ||
221 | } | ||
222 | |||
215 | /* Finish a box if the last record was not idle */ | 223 | /* Finish a box if the last record was not idle */ |
216 | if (cpu_info->last_pid > 0) { | 224 | if (cpu_info->last_pid > 0) { |
217 | info->box = TRUE; | 225 | info->box = TRUE; |
@@ -222,6 +230,30 @@ static int cpu_plot_event(struct graph_info *ginfo, | |||
222 | return 0; | 230 | return 0; |
223 | } | 231 | } |
224 | 232 | ||
233 | /* | ||
234 | * If last record is NULL, then it may exist off the | ||
235 | * viewable range. Search to see if one exists. | ||
236 | */ | ||
237 | if (!cpu_info->last_record) { | ||
238 | struct record *trecord; | ||
239 | |||
240 | trecord = tracecmd_read_prev(handle, record); | ||
241 | if (trecord) { | ||
242 | filter = filter_record(ginfo, trecord, | ||
243 | &orig_pid, &sched_pid, | ||
244 | &is_sched_switch); | ||
245 | cpu_info->last_pid = is_sched_switch ? sched_pid : orig_pid; | ||
246 | } | ||
247 | cpu_info->last_record = trecord; | ||
248 | /* We moved the cursor, put it back */ | ||
249 | trecord = tracecmd_read_data(handle, record->cpu); | ||
250 | free_record(trecord); | ||
251 | } | ||
252 | |||
253 | free_record(cpu_info->last_record); | ||
254 | cpu_info->last_record = record; | ||
255 | tracecmd_record_ref(record); | ||
256 | |||
225 | cpu = cpu_info->cpu; | 257 | cpu = cpu_info->cpu; |
226 | 258 | ||
227 | filter = filter_record(ginfo, record, &orig_pid, &sched_pid, &is_sched_switch); | 259 | filter = filter_record(ginfo, record, &orig_pid, &sched_pid, &is_sched_switch); |