aboutsummaryrefslogtreecommitdiffstats
path: root/rt-plot-cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt-plot-cpu.c')
-rw-r--r--rt-plot-cpu.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/rt-plot-cpu.c b/rt-plot-cpu.c
index 4c98a95..e32f085 100644
--- a/rt-plot-cpu.c
+++ b/rt-plot-cpu.c
@@ -1,3 +1,4 @@
1#include <string.h>
1#include "trace-graph.h" 2#include "trace-graph.h"
2#include "cpu.h" 3#include "cpu.h"
3 4
@@ -35,7 +36,7 @@ next_sa_record(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
35 free_record(record); 36 free_record(record);
36 break; 37 break;
37 } 38 }
38 match = rt_graph_check_switch_away(rtg_info, pevent, record, 39 match = rt_graph_check_switch_away(ginfo, record,
39 &pid, &dint, &dull); 40 &pid, &dint, &dull);
40 if (match) { 41 if (match) {
41 ret = record; 42 ret = record;
@@ -149,7 +150,7 @@ static int get_time_info(struct graph_info *ginfo,
149 if (get_rts(ginfo, record) > max_ts) 150 if (get_rts(ginfo, record) > max_ts)
150 break; 151 break;
151 152
152#define ARG rtg_info, ginfo->pevent, record, &pid, &job, &dull 153#define ARG ginfo, record, &pid, &job, &dull
153 if (rt_graph_check_switch_to(ARG) && pid) { 154 if (rt_graph_check_switch_to(ARG) && pid) {
154 goto out; 155 goto out;
155 } else if (rt_graph_check_switch_away(ARG) && pid) { 156 } else if (rt_graph_check_switch_away(ARG) && pid) {
@@ -184,8 +185,7 @@ try_switch_away(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
184 int job, pid, match; 185 int job, pid, match;
185 unsigned long long ts; 186 unsigned long long ts;
186 187
187 match = rt_graph_check_switch_away(&ginfo->rtg_info, ginfo->pevent, 188 match = rt_graph_check_switch_away(ginfo, record, &pid, &job, &ts);
188 record, &pid, &job, &ts);
189 match = match && pid; 189 match = match && pid;
190 if (match) { 190 if (match) {
191 update_pid(rtc_info, pid); 191 update_pid(rtc_info, pid);
@@ -212,10 +212,8 @@ try_switch_to(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
212 int job, pid, match; 212 int job, pid, match;
213 unsigned long long ts; 213 unsigned long long ts;
214 214
215 match = rt_graph_check_switch_to(&ginfo->rtg_info, ginfo->pevent, 215 match = rt_graph_check_switch_to(ginfo, record, &pid, &job, &ts);
216 record, &pid, &job, &ts);
217 match = match && pid; 216 match = match && pid;
218
219 if (match) { 217 if (match) {
220 update_pid(rtc_info, pid); 218 update_pid(rtc_info, pid);
221 rtc_info->rt_run_time = ts; 219 rtc_info->rt_run_time = ts;
@@ -231,8 +229,7 @@ try_completion(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
231 int pid, job, match; 229 int pid, job, match;
232 unsigned long long ts; 230 unsigned long long ts;
233 231
234 match = rt_graph_check_task_completion(&ginfo->rtg_info, ginfo->pevent, 232 match = rt_graph_check_task_completion(ginfo, record, &pid, &job, &ts);
235 record, &pid, &job, &ts);
236 if (match) { 233 if (match) {
237 info->completion = TRUE; 234 info->completion = TRUE;
238 info->ctime = ts; 235 info->ctime = ts;
@@ -336,7 +333,6 @@ static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
336 int pid, eid, match, dint; 333 int pid, eid, match, dint;
337 unsigned long long ts, dull; 334 unsigned long long ts, dull;
338 struct rt_cpu_info *rtc_info = plot->private; 335 struct rt_cpu_info *rtc_info = plot->private;
339 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
340 336
341 if (!record) { 337 if (!record) {
342 do_plot_end(ginfo, rtc_info, info); 338 do_plot_end(ginfo, rtc_info, info);
@@ -355,7 +351,7 @@ static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
355 /* Have to call checks to ensure ids are loaded. Otherwise, 351 /* Have to call checks to ensure ids are loaded. Otherwise,
356 * is_displayed will not work here or in any other methods. 352 * is_displayed will not work here or in any other methods.
357 */ 353 */
358#define ARG rtg_info, ginfo->pevent, record, &pid 354#define ARG ginfo,record, &pid
359 rt_graph_check_task_param(ARG, &dull, &dull); 355 rt_graph_check_task_param(ARG, &dull, &dull);
360 rt_graph_check_task_release(ARG, &dint, &dull, &dull); 356 rt_graph_check_task_release(ARG, &dint, &dull, &dull);
361 rt_graph_check_task_block(ARG, &dull); 357 rt_graph_check_task_block(ARG, &dull);
@@ -559,26 +555,33 @@ void rt_plot_cpus_plotted(struct graph_info *ginfo,
559} 555}
560 556
561/** 557/**
562 * rt_plot_cpu - create a plot for @cpu. 558 * rt_plot_cpu_label - create a plot for @cpu with @label.
563 */ 559 */
564void rt_plot_cpu(struct graph_info *ginfo, int cpu) 560void rt_plot_cpu_label(struct graph_info *ginfo, int cpu, char* label)
565{ 561{
566 struct rt_cpu_info *rtc_info; 562 struct rt_cpu_info *rtc_info;
567 struct graph_plot *plot; 563 struct graph_plot *plot;
568 char label[100];
569 564
570 rtc_info = malloc_or_die(sizeof(*rtc_info)); 565 rtc_info = malloc_or_die(sizeof(*rtc_info));
571 memset(rtc_info, 0, sizeof(*rtc_info)); 566 memset(rtc_info, 0, sizeof(*rtc_info));
572 rtc_info->cpu = cpu; 567 rtc_info->cpu = cpu;
573 rtc_info->label = malloc_or_die(LLABEL); 568 rtc_info->label = label;
574
575 snprintf(label, 100, "RT-CPU %d", cpu);
576 569
577 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_RT_CPU, 570 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_RT_CPU,
578 TIME_TYPE_RT, &rt_cpu_cb, rtc_info); 571 TIME_TYPE_RT, &rt_cpu_cb, rtc_info);
579 trace_graph_plot_add_all_recs(ginfo, plot); 572 trace_graph_plot_add_all_recs(ginfo, plot);
580} 573}
581 574
575/**
576 * rt_plot_cpu - create a plot for @cpu.
577 */
578void rt_plot_cpu(struct graph_info *ginfo, int cpu)
579{
580 char *label = malloc_or_die(LLABEL);
581 snprintf(label, 100, "RT-CPU %d", cpu);
582 rt_plot_cpu_label(ginfo, cpu, label);
583}
584
582void rt_plot_init_cpus(struct graph_info *ginfo, int cpus) 585void rt_plot_init_cpus(struct graph_info *ginfo, int cpus)
583{ 586{
584 long cpu; 587 long cpu;