diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-02-10 20:52:44 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-10 20:52:44 -0500 |
| commit | bdeeb2a879e2df29cb32c3fed17131df3fdebe03 (patch) | |
| tree | 710944b482ca9c2fc514c8daf9e83963df100db5 | |
| parent | 650478a7ae8e3b59970e7ebbed066701d09b1ea7 (diff) | |
trace-graph: Have the graph control the start stop records
Move the code from initializing the start cursor locations of the
CPUs.
Also control when a record is passed to the plot based on its
timestamp.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | trace-graph.c | 19 | ||||
| -rw-r--r-- | trace-plot-cpu.c | 24 | ||||
| -rw-r--r-- | trace-plot-task.c | 2 |
3 files changed, 19 insertions, 26 deletions
diff --git a/trace-graph.c b/trace-graph.c index 2214141..d62882c 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -1510,6 +1510,9 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
| 1510 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1510 | set_color(ginfo->draw, plot->gc, plot->last_color); |
| 1511 | } | 1511 | } |
| 1512 | 1512 | ||
| 1513 | tracecmd_set_all_cpus_to_timestamp(ginfo->handle, | ||
| 1514 | ginfo->view_start_time); | ||
| 1515 | |||
| 1513 | /* Shortcut if we don't have any task plots */ | 1516 | /* Shortcut if we don't have any task plots */ |
| 1514 | if (!ginfo->nr_task_hash && !ginfo->all_recs) { | 1517 | if (!ginfo->nr_task_hash && !ginfo->all_recs) { |
| 1515 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { | 1518 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { |
| @@ -1518,6 +1521,14 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
| 1518 | continue; | 1521 | continue; |
| 1519 | 1522 | ||
| 1520 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { | 1523 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { |
| 1524 | if (record->ts < ginfo->view_start_time) { | ||
| 1525 | free_record(record); | ||
| 1526 | continue; | ||
| 1527 | } | ||
| 1528 | if (record->ts > ginfo->view_end_time) { | ||
| 1529 | free_record(record); | ||
| 1530 | break; | ||
| 1531 | } | ||
| 1521 | for (list = hash->plots; list; list = list->next) | 1532 | for (list = hash->plots; list; list = list->next) |
| 1522 | draw_plot(ginfo, list->plot, record); | 1533 | draw_plot(ginfo, list->plot, record); |
| 1523 | free_record(record); | 1534 | free_record(record); |
| @@ -1527,6 +1538,14 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
| 1527 | } | 1538 | } |
| 1528 | 1539 | ||
| 1529 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1540 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
| 1541 | if (record->ts < ginfo->view_start_time) { | ||
| 1542 | free_record(record); | ||
| 1543 | continue; | ||
| 1544 | } | ||
| 1545 | if (record->ts > ginfo->view_end_time) { | ||
| 1546 | free_record(record); | ||
| 1547 | break; | ||
| 1548 | } | ||
| 1530 | hash = trace_graph_plot_find_cpu(ginfo, cpu); | 1549 | hash = trace_graph_plot_find_cpu(ginfo, cpu); |
| 1531 | if (hash) { | 1550 | if (hash) { |
| 1532 | for (list = hash->plots; list; list = list->next) | 1551 | for (list = hash->plots; list; list = list->next) |
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c index ccc2bff..5f28e18 100644 --- a/trace-plot-cpu.c +++ b/trace-plot-cpu.c | |||
| @@ -171,35 +171,11 @@ static void cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 171 | unsigned long long time) | 171 | unsigned long long time) |
| 172 | { | 172 | { |
| 173 | struct cpu_plot_info *cpu_info = plot->private; | 173 | struct cpu_plot_info *cpu_info = plot->private; |
| 174 | struct record *last_record = NULL; | ||
| 175 | struct record *record; | ||
| 176 | int cpu; | 174 | int cpu; |
| 177 | 175 | ||
| 178 | cpu = cpu_info->cpu; | 176 | cpu = cpu_info->cpu; |
| 179 | cpu_info->last_time = 0ULL; | 177 | cpu_info->last_time = 0ULL; |
| 180 | cpu_info->last_pid = -1; | 178 | cpu_info->last_pid = -1; |
| 181 | |||
| 182 | tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); | ||
| 183 | |||
| 184 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { | ||
| 185 | if (record->ts >= time) | ||
| 186 | break; | ||
| 187 | |||
| 188 | free_record(last_record); | ||
| 189 | last_record = record; | ||
| 190 | } | ||
| 191 | |||
| 192 | free_record(record); | ||
| 193 | /* reset so the next record read is the first record */ | ||
| 194 | if (last_record) { | ||
| 195 | record = tracecmd_read_at(ginfo->handle, | ||
| 196 | last_record->offset, | ||
| 197 | NULL); | ||
| 198 | free_record(record); | ||
| 199 | free_record(last_record); | ||
| 200 | } else | ||
| 201 | tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); | ||
| 202 | |||
| 203 | } | 179 | } |
| 204 | 180 | ||
| 205 | static int cpu_plot_event(struct graph_info *ginfo, | 181 | static int cpu_plot_event(struct graph_info *ginfo, |
diff --git a/trace-plot-task.c b/trace-plot-task.c index 2770384..a42202f 100644 --- a/trace-plot-task.c +++ b/trace-plot-task.c | |||
| @@ -251,8 +251,6 @@ static void task_plot_start(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 251 | { | 251 | { |
| 252 | struct task_plot_info *task_info = plot->private; | 252 | struct task_plot_info *task_info = plot->private; |
| 253 | 253 | ||
| 254 | set_cpus_to_time(ginfo, time); | ||
| 255 | |||
| 256 | task_info->last_time = 0ULL; | 254 | task_info->last_time = 0ULL; |
| 257 | task_info->last_cpu = -1; | 255 | task_info->last_cpu = -1; |
| 258 | } | 256 | } |
