aboutsummaryrefslogtreecommitdiffstats
path: root/trace-plot-cpu.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-08 15:02:13 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-10 10:58:45 -0500
commitb391d4e5acbf1f243b316f6f024137fa614a0d2d (patch)
tree8b6f777c9e8d87e8dde6fe41463b97624cd7a818 /trace-plot-cpu.c
parent7d359f826170f08cc97a683cb48e4051c7a79117 (diff)
trace-graph: Add find_record to plots for popup windows
The popup needs a record to use to determin if a task should be added to the filter or not. Add the method find_record to the plot callback structure. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-plot-cpu.c')
-rw-r--r--trace-plot-cpu.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c
index b1adb91..5d37950 100644
--- a/trace-plot-cpu.c
+++ b/trace-plot-cpu.c
@@ -275,12 +275,49 @@ static int cpu_plot_event(struct graph_info *ginfo,
275 return ret; 275 return ret;
276} 276}
277 277
278static struct record *
279find_record_on_cpu(struct graph_info *ginfo, gint cpu, guint64 time)
280{
281 struct record *record = NULL;
282 guint64 offset = 0;
283
284 tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time);
285 do {
286 if (record) {
287 offset = record->offset;
288 free_record(record);
289 }
290 record = tracecmd_read_data(ginfo->handle, cpu);
291 } while (record && record->ts <= (time - 1 / ginfo->resolution));
292
293 if (record) {
294 if (record->ts > (time + 1 / ginfo->resolution) && offset) {
295 free_record(record);
296 record = tracecmd_read_at(ginfo->handle, offset, NULL);
297 }
298 }
299
300 return record;
301}
302
303static struct record *
304cpu_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot,
305 unsigned long long time)
306{
307 struct cpu_plot_info *cpu_info = plot->private;
308 int cpu;
309
310 cpu = cpu_info->cpu;
311
312 return find_record_on_cpu(ginfo, cpu, time);
313}
278 314
279static const struct plot_callbacks cpu_plot_cb = { 315static const struct plot_callbacks cpu_plot_cb = {
280 .match_time = cpu_plot_match_time, 316 .match_time = cpu_plot_match_time,
281 .plot_event = cpu_plot_event, 317 .plot_event = cpu_plot_event,
282 .start = cpu_plot_start, 318 .start = cpu_plot_start,
283 .display_last_event = cpu_plot_display_last_event 319 .display_last_event = cpu_plot_display_last_event,
320 .find_record = cpu_plot_find_record,
284}; 321};
285 322
286void graph_plot_init_cpus(struct graph_info *ginfo, int cpus) 323void graph_plot_init_cpus(struct graph_info *ginfo, int cpus)