diff options
| author | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 15:51:19 -0500 |
|---|---|---|
| committer | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 15:51:19 -0500 |
| commit | 974e24aaa13b710713b1654b11ffeefafef3723e (patch) | |
| tree | ce375b05851cd01658393402fbe9e7ce724eb725 | |
| parent | ecf6f04712ac9d917bae11064ca10d86d4ab05cf (diff) | |
rt-graph: added parameters to tasks
| -rw-r--r-- | rt-graph.c | 16 | ||||
| -rw-r--r-- | rt-graph.h | 13 | ||||
| -rw-r--r-- | rt-plot-task.c | 25 | ||||
| -rw-r--r-- | task-list.c | 2 | ||||
| -rw-r--r-- | task-list.h | 1 |
5 files changed, 50 insertions, 7 deletions
| @@ -94,6 +94,8 @@ int rt_graph_check_task_param(struct rt_graph_info *rtg_info, | |||
| 94 | unsigned long long *period) | 94 | unsigned long long *period) |
| 95 | { | 95 | { |
| 96 | struct event_format *event; | 96 | struct event_format *event; |
| 97 | struct rt_task_params *params; | ||
| 98 | struct task_list *list; | ||
| 97 | unsigned long long val; | 99 | unsigned long long val; |
| 98 | gint id; | 100 | gint id; |
| 99 | int ret = 0; | 101 | int ret = 0; |
| @@ -127,7 +129,19 @@ int rt_graph_check_task_param(struct rt_graph_info *rtg_info, | |||
| 127 | dprintf(3, "Read task_param (%d) record for task %d " | 129 | dprintf(3, "Read task_param (%d) record for task %d " |
| 128 | "(%llu, %llu)\n", id, *pid, *wcet, *period); | 130 | "(%llu, %llu)\n", id, *pid, *wcet, *period); |
| 129 | 131 | ||
| 130 | add_task_hash(rtg_info->tasks, *pid); | 132 | list = add_task_hash(rtg_info->tasks, *pid); |
| 133 | if (!list->data) { | ||
| 134 | /* If this pid is plotted, sections of time might later | ||
| 135 | * be viewed which are after this _param event. In this | ||
| 136 | * case, that plot would never read a _param event and | ||
| 137 | * would not know about the task's wcet and deadline. | ||
| 138 | * Store them with the task to avoid this issue. | ||
| 139 | */ | ||
| 140 | params = malloc_or_die(sizeof(*params)); | ||
| 141 | params->wcet = *wcet; | ||
| 142 | params->period = *period; | ||
| 143 | list->data = params; | ||
| 144 | } | ||
| 131 | 145 | ||
| 132 | if (*period > rtg_info->max_period) | 146 | if (*period > rtg_info->max_period) |
| 133 | rtg_info->max_period = *period; | 147 | rtg_info->max_period = *period; |
| @@ -12,6 +12,11 @@ | |||
| 12 | #define TS_HASH_SIZE 12 | 12 | #define TS_HASH_SIZE 12 |
| 13 | struct ts_list; | 13 | struct ts_list; |
| 14 | 14 | ||
| 15 | struct rt_task_params { | ||
| 16 | unsigned long long wcet; | ||
| 17 | unsigned long long period; | ||
| 18 | }; | ||
| 19 | |||
| 15 | struct rt_graph_info { | 20 | struct rt_graph_info { |
| 16 | 21 | ||
| 17 | /* List of all real-time tasks */ | 22 | /* List of all real-time tasks */ |
| @@ -105,4 +110,12 @@ void set_cpu_to_rts(struct graph_info *ginfo, | |||
| 105 | void set_cpus_to_rts(struct graph_info *ginfo, | 110 | void set_cpus_to_rts(struct graph_info *ginfo, |
| 106 | unsigned long long rt_target); | 111 | unsigned long long rt_target); |
| 107 | 112 | ||
| 113 | static inline void nano_to_milli(unsigned long long time, | ||
| 114 | unsigned long long *msec, | ||
| 115 | unsigned long long *nsec) | ||
| 116 | { | ||
| 117 | *msec = time / 1000000ULL; | ||
| 118 | *nsec = time % 1000000ULL; | ||
| 119 | } | ||
| 120 | |||
| 108 | #endif | 121 | #endif |
diff --git a/rt-plot-task.c b/rt-plot-task.c index 557bfff..57662b7 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
| @@ -296,6 +296,7 @@ static int try_release(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 296 | &release, &deadline); | 296 | &release, &deadline); |
| 297 | if (match && pid == rtt_info->pid) { | 297 | if (match && pid == rtt_info->pid) { |
| 298 | update_job(rtt_info, job); | 298 | update_job(rtt_info, job); |
| 299 | |||
| 299 | info->release = TRUE; | 300 | info->release = TRUE; |
| 300 | info->rtime = release; | 301 | info->rtime = release; |
| 301 | 302 | ||
| @@ -612,7 +613,7 @@ static int rt_task_plot_display_info(struct graph_info *ginfo, | |||
| 612 | int pid, job, eid; | 613 | int pid, job, eid; |
| 613 | struct record *record; | 614 | struct record *record; |
| 614 | struct event_format *event; | 615 | struct event_format *event; |
| 615 | unsigned long usec, sec; | 616 | unsigned long long msec, nsec; |
| 616 | unsigned long long release, deadline, rts; | 617 | unsigned long long release, deadline, rts; |
| 617 | struct rt_task_info *rtt_info = plot->private; | 618 | struct rt_task_info *rtt_info = plot->private; |
| 618 | struct offset_cache *offsets; | 619 | struct offset_cache *offsets; |
| @@ -654,9 +655,9 @@ static int rt_task_plot_display_info(struct graph_info *ginfo, | |||
| 654 | trace_seq_printf(s, "\nUNKNOWN EVENT %d\n", eid); | 655 | trace_seq_printf(s, "\nUNKNOWN EVENT %d\n", eid); |
| 655 | } | 656 | } |
| 656 | trace_seq_putc(s, '\n'); | 657 | trace_seq_putc(s, '\n'); |
| 657 | convert_nano(time, &sec, &usec); | 658 | nano_to_milli(time, &msec, &nsec); |
| 658 | trace_seq_printf(s, "%lu.%06lu CPU: %03d", | 659 | trace_seq_printf(s, "%llu.%06llu ms CPU: %03d", |
| 659 | sec, usec, record->cpu); | 660 | msec, nsec, record->cpu); |
| 660 | free_record(record); | 661 | free_record(record); |
| 661 | } | 662 | } |
| 662 | 663 | ||
| @@ -740,23 +741,35 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
| 740 | { | 741 | { |
| 741 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; | 742 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; |
| 742 | struct rt_task_info *rtt_info; | 743 | struct rt_task_info *rtt_info; |
| 744 | struct rt_task_params *params; | ||
| 743 | struct graph_plot *plot; | 745 | struct graph_plot *plot; |
| 746 | struct task_list *list; | ||
| 744 | const char *comm; | 747 | const char *comm; |
| 748 | unsigned long long wm, wn, pm, pn; | ||
| 745 | char *plot_label; | 749 | char *plot_label; |
| 746 | int len; | 750 | int len; |
| 747 | 751 | ||
| 748 | if (!find_task_list(rtg_info->tasks, pid)) | 752 | list = find_task_list(rtg_info->tasks, pid); |
| 753 | if (!list) | ||
| 749 | die("Cannot create RT plot of non-RT task %d!\n", pid); | 754 | die("Cannot create RT plot of non-RT task %d!\n", pid); |
| 750 | 755 | ||
| 756 | params = list->data; | ||
| 757 | if (!params) | ||
| 758 | die ("RT task %d added without RT params!\n", pid); | ||
| 751 | rtt_info = malloc_or_die(sizeof(*rtt_info)); | 759 | rtt_info = malloc_or_die(sizeof(*rtt_info)); |
| 752 | rtt_info->pid = pid; | 760 | rtt_info->pid = pid; |
| 753 | rtt_info->label = malloc_or_die(LLABEL); | 761 | rtt_info->label = malloc_or_die(LLABEL); |
| 754 | 762 | ||
| 763 | nano_to_milli(params->wcet, &wm, &wn); | ||
| 764 | nano_to_milli(params->period, &pm, &pn); | ||
| 765 | |||
| 755 | /* Create plot */ | 766 | /* Create plot */ |
| 756 | comm = pevent_data_comm_from_pid(ginfo->pevent, pid); | 767 | comm = pevent_data_comm_from_pid(ginfo->pevent, pid); |
| 757 | len = strlen(comm) + 100; | 768 | len = strlen(comm) + 100; |
| 758 | plot_label = malloc_or_die(len); | 769 | plot_label = malloc_or_die(len); |
| 759 | snprintf(plot_label, len, "*%s-%d", comm, pid); | 770 | snprintf(plot_label, len, |
| 771 | "*%s-%d\n(%llu.%1llu, %llu.%1llu)", | ||
| 772 | comm, pid, wm, wn, pm, pn); | ||
| 760 | plot = trace_graph_plot_insert(ginfo, pos, plot_label, PLOT_TYPE_RT_TASK, | 773 | plot = trace_graph_plot_insert(ginfo, pos, plot_label, PLOT_TYPE_RT_TASK, |
| 761 | &rt_task_cb, rtt_info); | 774 | &rt_task_cb, rtt_info); |
| 762 | free(plot_label); | 775 | free(plot_label); |
diff --git a/task-list.c b/task-list.c index 4c820bf..669020c 100644 --- a/task-list.c +++ b/task-list.c | |||
| @@ -46,6 +46,7 @@ struct task_list *add_task_hash(struct task_list **tasks, int pid) | |||
| 46 | list = malloc_or_die(sizeof(*list)); | 46 | list = malloc_or_die(sizeof(*list)); |
| 47 | list->pid = pid; | 47 | list->pid = pid; |
| 48 | list->next = tasks[key]; | 48 | list->next = tasks[key]; |
| 49 | list->data = NULL; | ||
| 49 | tasks[key] = list; | 50 | tasks[key] = list; |
| 50 | 51 | ||
| 51 | return list; | 52 | return list; |
| @@ -63,6 +64,7 @@ void free_task_hash(struct task_list **tasks) | |||
| 63 | while (tasks[i]) { | 64 | while (tasks[i]) { |
| 64 | list = tasks[i]; | 65 | list = tasks[i]; |
| 65 | tasks[i] = list->next; | 66 | tasks[i] = list->next; |
| 67 | free(list->data); | ||
| 66 | free(list); | 68 | free(list); |
| 67 | } | 69 | } |
| 68 | } | 70 | } |
diff --git a/task-list.h b/task-list.h index eb1213b..ae3dae2 100644 --- a/task-list.h +++ b/task-list.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | struct task_list { | 10 | struct task_list { |
| 11 | struct task_list *next; | 11 | struct task_list *next; |
| 12 | gint pid; | 12 | gint pid; |
| 13 | void *data; | ||
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | struct task_list* find_task_list(struct task_list **tasks, int pid); | 16 | struct task_list* find_task_list(struct task_list **tasks, int pid); |
