aboutsummaryrefslogtreecommitdiffstats
path: root/rt-plot-task.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt-plot-task.c')
-rw-r--r--rt-plot-task.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c
index a5b475f..524b1f9 100644
--- a/rt-plot-task.c
+++ b/rt-plot-task.c
@@ -1,3 +1,5 @@
1#include <stdio.h>
2#include <string.h>
1#include "trace-graph.h" 3#include "trace-graph.h"
2#include "trace-filter.h" 4#include "trace-filter.h"
3 5
@@ -21,12 +23,11 @@ static gboolean record_matches_pid(struct graph_info *ginfo,
21{ 23{
22 gint dint, pid = 0, match; 24 gint dint, pid = 0, match;
23 unsigned long long dull; 25 unsigned long long dull;
24 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
25 26
26 /* Must use check_* in case record has not been found yet, 27 /* Must use check_* in case record has not been found yet,
27 * this macro was the best of many terrible options. 28 * this macro was the best of many terrible options.
28 */ 29 */
29#define ARG rtg_info, ginfo->pevent, record, &pid 30#define ARG ginfo, record, &pid
30 match = rt_graph_check_switch_to(ARG, &dint, &dull) || 31 match = rt_graph_check_switch_to(ARG, &dint, &dull) ||
31 rt_graph_check_switch_away(ARG, &dint, &dull) || 32 rt_graph_check_switch_away(ARG, &dint, &dull) ||
32 rt_graph_check_task_release(ARG, &dint, &dull, &dull) || 33 rt_graph_check_task_release(ARG, &dint, &dull, &dull) ||
@@ -63,10 +64,10 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info,
63 } 64 }
64 65
65 /* Sorry mother */ 66 /* Sorry mother */
66#define ARG rtg_info, pevent, record, &pid 67#define ARG ginfo, record, &pid
67 match = rt_graph_check_switch_to(ARG, &dint, &dull) || 68 match = rt_graph_check_switch_to(ARG, &dint, &dull) ||
68 rt_graph_check_switch_away(ARG, &dint, &dull) || 69 rt_graph_check_switch_away(ARG, &dint, &dull) ||
69 rt_graph_check_task_block(ARG, &dull) || 70 rt_graph_check_task_block(ARG, &dull) ||
70 rt_graph_check_task_resume(ARG, &dull); 71 rt_graph_check_task_resume(ARG, &dull);
71#undef ARG 72#undef ARG
72 eid = (match) ? pevent_data_type(pevent, record) : 0; 73 eid = (match) ? pevent_data_type(pevent, record) : 0;
@@ -164,7 +165,6 @@ get_previous_release(struct graph_info *ginfo, struct rt_task_info *rtt_info,
164 int pid, job, match; 165 int pid, job, match;
165 unsigned long long release, deadline; 166 unsigned long long release, deadline;
166 struct record *last_record, *record, *ret = NULL; 167 struct record *last_record, *record, *ret = NULL;
167 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
168 168
169 last_record = tracecmd_peek_data(ginfo->handle, cpu); 169 last_record = tracecmd_peek_data(ginfo->handle, cpu);
170 *out_job = *out_release = *out_deadline = 0; 170 *out_job = *out_release = *out_deadline = 0;
@@ -177,8 +177,7 @@ get_previous_release(struct graph_info *ginfo, struct rt_task_info *rtt_info,
177 free_record(record); 177 free_record(record);
178 goto out; 178 goto out;
179 } 179 }
180 match = rt_graph_check_task_release(rtg_info, ginfo->pevent, 180 match = rt_graph_check_task_release(ginfo, record, &pid, &job,
181 record, &pid, &job,
182 &release, &deadline); 181 &release, &deadline);
183 free_record(last_record); 182 free_record(last_record);
184 last_record = record; 183 last_record = record;
@@ -267,8 +266,7 @@ static int try_param(struct graph_info *ginfo, struct rt_task_info *rtt_info,
267 if (rtt_info->params_found) 266 if (rtt_info->params_found)
268 goto out; 267 goto out;
269 268
270 match = rt_graph_check_task_param(&ginfo->rtg_info, ginfo->pevent, 269 match = rt_graph_check_task_param(ginfo, record, &pid, &wcet, &period);
271 record, &pid, &wcet, &period);
272 if (match && pid == rtt_info->pid) { 270 if (match && pid == rtt_info->pid) {
273 update_job(rtt_info, 0); 271 update_job(rtt_info, 0);
274 rtt_info->wcet = wcet; 272 rtt_info->wcet = wcet;
@@ -290,8 +288,7 @@ static int try_release(struct graph_info *ginfo, struct rt_task_info *rtt_info,
290 int pid, job, match, ret = 0; 288 int pid, job, match, ret = 0;
291 unsigned long long release, deadline; 289 unsigned long long release, deadline;
292 290
293 match = rt_graph_check_task_release(&ginfo->rtg_info, ginfo->pevent, 291 match = rt_graph_check_task_release(ginfo, record, &pid, &job,
294 record, &pid, &job,
295 &release, &deadline); 292 &release, &deadline);
296 if (match && pid == rtt_info->pid) { 293 if (match && pid == rtt_info->pid) {
297 update_job(rtt_info, job); 294 update_job(rtt_info, job);
@@ -320,8 +317,7 @@ static int try_completion(struct graph_info *ginfo,
320 int pid, job, match, ret = 0; 317 int pid, job, match, ret = 0;
321 unsigned long long ts; 318 unsigned long long ts;
322 319
323 match = rt_graph_check_task_completion(&ginfo->rtg_info, ginfo->pevent, 320 match = rt_graph_check_task_completion(ginfo, record, &pid, &job, &ts);
324 record, &pid, &job, &ts);
325 if (match && pid == rtt_info->pid) { 321 if (match && pid == rtt_info->pid) {
326 322
327 info->completion = TRUE; 323 info->completion = TRUE;
@@ -341,8 +337,7 @@ static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info,
341 int pid, match, ret = 0; 337 int pid, match, ret = 0;
342 unsigned long long ts; 338 unsigned long long ts;
343 339
344 match = rt_graph_check_task_block(&ginfo->rtg_info, ginfo->pevent, 340 match = rt_graph_check_task_block(ginfo, record, &pid, &ts);
345 record, &pid, &ts);
346 if (match && pid == rtt_info->pid) { 341 if (match && pid == rtt_info->pid) {
347 rtt_info->fresh = FALSE; 342 rtt_info->fresh = FALSE;
348 rtt_info->block_time = ts; 343 rtt_info->block_time = ts;
@@ -360,8 +355,7 @@ static int try_resume(struct graph_info *ginfo, struct rt_task_info *rtt_info,
360 int pid, match, ret = 0; 355 int pid, match, ret = 0;
361 unsigned long long ts; 356 unsigned long long ts;
362 357
363 match = rt_graph_check_task_resume(&ginfo->rtg_info, ginfo->pevent, 358 match = rt_graph_check_task_resume(ginfo, record, &pid, &ts);
364 record, &pid, &ts);
365 if (match && pid == rtt_info->pid) { 359 if (match && pid == rtt_info->pid) {
366 info->box = TRUE; 360 info->box = TRUE;
367 info->bcolor = 0x0; 361 info->bcolor = 0x0;
@@ -388,8 +382,7 @@ try_switch_away(struct graph_info *ginfo, struct rt_task_info *rtt_info,
388 int job, pid, match, ret = 0; 382 int job, pid, match, ret = 0;
389 unsigned long long ts; 383 unsigned long long ts;
390 384
391 match = rt_graph_check_switch_away(&ginfo->rtg_info, ginfo->pevent, 385 match = rt_graph_check_switch_away(ginfo, record, &pid, &job, &ts);
392 record, &pid, &job, &ts);
393 if (match && pid == rtt_info->pid) { 386 if (match && pid == rtt_info->pid) {
394 update_job(rtt_info, job); 387 update_job(rtt_info, job);
395 388
@@ -422,8 +415,7 @@ static int try_switch_to(struct graph_info *ginfo, struct rt_task_info *rtt_info
422 int job, pid, match, ret = 0; 415 int job, pid, match, ret = 0;
423 unsigned long long ts; 416 unsigned long long ts;
424 417
425 match = rt_graph_check_switch_to(&ginfo->rtg_info, ginfo->pevent, 418 match = rt_graph_check_switch_to(ginfo, record, &pid, &job, &ts);
426 record, &pid, &job, &ts);
427 if (match && pid == rtt_info->pid) { 419 if (match && pid == rtt_info->pid) {
428 update_job(rtt_info, job); 420 update_job(rtt_info, job);
429 rtt_info->run_time = ts; 421 rtt_info->run_time = ts;
@@ -442,8 +434,7 @@ static int try_other(struct graph_info *ginfo, struct rt_task_info *rtt_info,
442 unsigned long long ts; 434 unsigned long long ts;
443 435
444 pid = rtt_info->pid; 436 pid = rtt_info->pid;
445 rt_graph_check_any(&ginfo->rtg_info, ginfo->pevent, record, 437 rt_graph_check_any(ginfo, record, &epid, &eid, &ts);
446 &epid, &eid, &ts);
447 438
448 my_pid = (pid == epid); 439 my_pid = (pid == epid);
449 my_cpu = (rtt_info->run_time && record->cpu == rtt_info->run_cpu); 440 my_cpu = (rtt_info->run_time && record->cpu == rtt_info->run_cpu);
@@ -801,7 +792,7 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos)
801 struct graph_plot *plot; 792 struct graph_plot *plot;
802 struct task_list *list; 793 struct task_list *list;
803 const char *comm; 794 const char *comm;
804 unsigned long long wm, wn, pm, pn; 795 float ms_wcet, ms_period;
805 char *plot_label; 796 char *plot_label;
806 int len; 797 int len;
807 798
@@ -816,16 +807,16 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos)
816 rtt_info->pid = pid; 807 rtt_info->pid = pid;
817 rtt_info->label = malloc_or_die(LLABEL); 808 rtt_info->label = malloc_or_die(LLABEL);
818 809
819 nano_to_milli(params->wcet, &wm, &wn); 810 ms_wcet = nano_as_milli(params->wcet);
820 nano_to_milli(params->period, &pm, &pn); 811 ms_period = nano_as_milli(params->period);
821 812
822 /* Create plot */ 813 /* Create plot */
823 comm = pevent_data_comm_from_pid(ginfo->pevent, pid); 814 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
824 len = strlen(comm) + 100; 815 len = strlen(comm) + 100;
825 plot_label = malloc_or_die(len); 816 plot_label = malloc_or_die(len);
826 snprintf(plot_label, len, 817 snprintf(plot_label, len,
827 "%s-%d\n(%llu.%1llu, %llu.%1llu)", 818 "%s-%d\n(%1.1f, %1.1f)",
828 comm, pid, wm, wn, pm, pn); 819 comm, pid, ms_wcet, ms_period);
829 plot = trace_graph_plot_insert(ginfo, pos, plot_label, PLOT_TYPE_RT_TASK, 820 plot = trace_graph_plot_insert(ginfo, pos, plot_label, PLOT_TYPE_RT_TASK,
830 TIME_TYPE_RT, 821 TIME_TYPE_RT,
831 &rt_task_cb, rtt_info); 822 &rt_task_cb, rtt_info);