diff options
Diffstat (limited to 'trace-plot-cpu.c')
| -rw-r--r-- | trace-plot-cpu.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c index 2690155..ccc2bff 100644 --- a/trace-plot-cpu.c +++ b/trace-plot-cpu.c | |||
| @@ -204,14 +204,10 @@ static void cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 204 | 204 | ||
| 205 | static int cpu_plot_event(struct graph_info *ginfo, | 205 | static int cpu_plot_event(struct graph_info *ginfo, |
| 206 | struct graph_plot *plot, | 206 | struct graph_plot *plot, |
| 207 | gboolean *line, int *lcolor, | 207 | struct record *record, |
| 208 | unsigned long long *ltime, | 208 | struct plot_info *info) |
| 209 | gboolean *box, int *bcolor, | ||
| 210 | unsigned long long *bstart, | ||
| 211 | unsigned long long *bend) | ||
| 212 | { | 209 | { |
| 213 | struct cpu_plot_info *cpu_info = plot->private; | 210 | struct cpu_plot_info *cpu_info = plot->private; |
| 214 | struct record *record; | ||
| 215 | int sched_pid; | 211 | int sched_pid; |
| 216 | int orig_pid; | 212 | int orig_pid; |
| 217 | int is_sched_switch; | 213 | int is_sched_switch; |
| @@ -222,14 +218,13 @@ static int cpu_plot_event(struct graph_info *ginfo, | |||
| 222 | int ret = 1; | 218 | int ret = 1; |
| 223 | 219 | ||
| 224 | cpu = cpu_info->cpu; | 220 | cpu = cpu_info->cpu; |
| 225 | record = tracecmd_read_data(ginfo->handle, cpu); | ||
| 226 | 221 | ||
| 227 | if (!record) { | 222 | if (!record) { |
| 228 | /* Finish a box if the last record was not idle */ | 223 | /* Finish a box if the last record was not idle */ |
| 229 | if (cpu_info->last_pid > 0) { | 224 | if (cpu_info->last_pid > 0) { |
| 230 | *box = TRUE; | 225 | info->box = TRUE; |
| 231 | *bstart = cpu_info->last_time; | 226 | info->bstart = cpu_info->last_time; |
| 232 | *bend = ginfo->view_end_time; | 227 | info->bend = ginfo->view_end_time; |
| 233 | } | 228 | } |
| 234 | return 0; | 229 | return 0; |
| 235 | } | 230 | } |
| @@ -255,19 +250,19 @@ static int cpu_plot_event(struct graph_info *ginfo, | |||
| 255 | box_filter = trace_graph_filter_on_task(ginfo, orig_pid); | 250 | box_filter = trace_graph_filter_on_task(ginfo, orig_pid); |
| 256 | 251 | ||
| 257 | if (!box_filter && cpu_info->last_pid) { | 252 | if (!box_filter && cpu_info->last_pid) { |
| 258 | *bcolor = hash_pid(cpu_info->last_pid); | 253 | info->bcolor = hash_pid(cpu_info->last_pid); |
| 259 | *box = TRUE; | 254 | info->box = TRUE; |
| 260 | *bstart = cpu_info->last_time; | 255 | info->bstart = cpu_info->last_time; |
| 261 | *bend = record->ts; | 256 | info->bend = record->ts; |
| 262 | } | 257 | } |
| 263 | 258 | ||
| 264 | cpu_info->last_time = record->ts; | 259 | cpu_info->last_time = record->ts; |
| 265 | } | 260 | } |
| 266 | 261 | ||
| 267 | if (!filter && !trace_graph_filter_on_event(ginfo, record)) { | 262 | if (!filter && !trace_graph_filter_on_event(ginfo, record)) { |
| 268 | *line = TRUE; | 263 | info->line = TRUE; |
| 269 | *ltime = record->ts; | 264 | info->ltime = record->ts; |
| 270 | *lcolor = hash_pid(pid); | 265 | info->lcolor = hash_pid(pid); |
| 271 | } | 266 | } |
| 272 | 267 | ||
| 273 | cpu_info->last_pid = pid; | 268 | cpu_info->last_pid = pid; |
| @@ -275,8 +270,6 @@ static int cpu_plot_event(struct graph_info *ginfo, | |||
| 275 | if (record->ts > ginfo->view_end_time) | 270 | if (record->ts > ginfo->view_end_time) |
| 276 | ret = 0; | 271 | ret = 0; |
| 277 | 272 | ||
| 278 | free_record(record); | ||
| 279 | |||
| 280 | return ret; | 273 | return ret; |
| 281 | } | 274 | } |
| 282 | 275 | ||
