diff options
| author | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-05 00:50:01 -0500 |
|---|---|---|
| committer | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-05 00:50:01 -0500 |
| commit | f69435260fd14ef8d9ba13774da0fcba4b5d212c (patch) | |
| tree | afd260970136bfee4e189525fc4b3476e6c945b4 | |
| parent | 2485bc49f922449ac5de596b7810b8a47a002be1 (diff) | |
Initial work generating event caches
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | rt-graph.c | 216 | ||||
| -rw-r--r-- | rt-graph.h | 45 | ||||
| -rw-r--r-- | trace-graph.h | 3 |
4 files changed, 266 insertions, 1 deletions
| @@ -300,10 +300,11 @@ TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-lis | |||
| 300 | trace-stack.o trace-options.o | 300 | trace-stack.o trace-options.o |
| 301 | TRACE_VIEW_OBJS = trace-view.o trace-view-store.o | 301 | TRACE_VIEW_OBJS = trace-view.o trace-view-store.o |
| 302 | TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o | 302 | TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o |
| 303 | RT_GRAPH_OBJS = rt-graph.o | ||
| 303 | TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) | 304 | TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) |
| 304 | TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) | 305 | TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) |
| 305 | KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ | 306 | KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ |
| 306 | trace-capture.o kernel-shark.o | 307 | $(RT_GRAPH_OBJS) trace-capture.o kernel-shark.o |
| 307 | 308 | ||
| 308 | PEVENT_LIB_OBJS = parse-events.o trace-seq.o parse-filter.o parse-utils.o | 309 | PEVENT_LIB_OBJS = parse-events.o trace-seq.o parse-filter.o parse-utils.o |
| 309 | TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ | 310 | TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ |
diff --git a/rt-graph.c b/rt-graph.c new file mode 100644 index 0000000..6eab52f --- /dev/null +++ b/rt-graph.c | |||
| @@ -0,0 +1,216 @@ | |||
| 1 | #include "rt-graph.h" | ||
| 2 | |||
| 3 | /** | ||
| 4 | * rt_graph_check_task_param - check for litmus_task_param record | ||
| 5 | * Return 1 and @pid, @wcet, and @period if the record matches | ||
| 6 | */ | ||
| 7 | int rt_graph_check_task_param(struct rt_graph_info *rtinfo, | ||
| 8 | struct pevent *pevent, struct record *record, | ||
| 9 | gint *pid, unsigned long long *wcet, | ||
| 10 | unsigned long long *period) | ||
| 11 | { | ||
| 12 | struct event_format *event; | ||
| 13 | unsigned long long val; | ||
| 14 | gint id; | ||
| 15 | int ret = 0; | ||
| 16 | |||
| 17 | /* Attempt to update record cache. It can only be updated | ||
| 18 | * after the pevent has "seen" its first litmus_task_param | ||
| 19 | * event. | ||
| 20 | */ | ||
| 21 | if (rtinfo->task_param_id < 0) { | ||
| 22 | event = pevent_find_event_by_name(pevent, "litmus", | ||
| 23 | "litmus_task_param"); | ||
| 24 | if (!event) | ||
| 25 | return 0; | ||
| 26 | rtinfo->task_param_id = event->id; | ||
| 27 | rtinfo->param_pid_field = pevent_find_field(event, "pid"); | ||
| 28 | rtinfo->param_wcet_field = pevent_find_field(event, "wcet"); | ||
| 29 | rtinfo->param_period_field = pevent_find_field(event, "period"); | ||
| 30 | } | ||
| 31 | |||
| 32 | id = pevent_data_type(pevent, record); | ||
| 33 | if (id == rtinfo->task_param_id) { | ||
| 34 | pevent_read_number_field(rtinfo->param_pid_field, | ||
| 35 | record->data, &val); | ||
| 36 | *pid = val; | ||
| 37 | pevent_read_number_field(rtinfo->param_wcet_field, | ||
| 38 | record->data, wcet); | ||
| 39 | pevent_read_number_field(rtinfo->param_period_field, | ||
| 40 | record->data, period); | ||
| 41 | ret = 1; | ||
| 42 | } | ||
| 43 | |||
| 44 | return ret; | ||
| 45 | } | ||
| 46 | |||
| 47 | /** | ||
| 48 | * rt_graph_check_task_release - check for litmus_task_release record | ||
| 49 | * Return 1 and @pid, @job, and @deadline if the record matches | ||
| 50 | */ | ||
| 51 | int rt_graph_check_task_release(struct rt_graph_info *rtinfo, | ||
| 52 | struct pevent *pevent, struct record *record, | ||
| 53 | gint *pid, gint *job, | ||
| 54 | unsigned long long *deadline) | ||
| 55 | { | ||
| 56 | struct event_format *event; | ||
| 57 | unsigned long long val; | ||
| 58 | gint id; | ||
| 59 | int ret = 0; | ||
| 60 | |||
| 61 | if (rtinfo->task_release_id < 0) { | ||
| 62 | event = pevent_find_event_by_name(pevent, "litmus", | ||
| 63 | "litmus_task_release"); | ||
| 64 | if (!event) | ||
| 65 | return 0; | ||
| 66 | rtinfo->task_release_id = event->id; | ||
| 67 | rtinfo->release_pid_field = pevent_find_field(event, "pid"); | ||
| 68 | rtinfo->release_job_field = pevent_find_field(event, "job"); | ||
| 69 | rtinfo->release_deadline_field = pevent_find_field(event, "deadline"); | ||
| 70 | } | ||
| 71 | |||
| 72 | id = pevent_data_type(pevent, record); | ||
| 73 | if (id == rtinfo->task_release_id) { | ||
| 74 | pevent_read_number_field(rtinfo->release_pid_field, | ||
| 75 | record->data, &val); | ||
| 76 | *pid = val; | ||
| 77 | pevent_read_number_field(rtinfo->release_job_field, | ||
| 78 | record->data, &val); | ||
| 79 | *job = val; | ||
| 80 | pevent_read_number_field(rtinfo->release_deadline_field, | ||
| 81 | record->data, deadline); | ||
| 82 | ret = 1; | ||
| 83 | } | ||
| 84 | |||
| 85 | return ret; | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * rt_graph_check_task_completion - check for litmus_task_completion record | ||
| 90 | * Return 1 and @pid, @job if the record matches | ||
| 91 | */ | ||
| 92 | int rt_graph_check_task_completion(struct rt_graph_info *rtinfo, | ||
| 93 | struct pevent *pevent, struct record *record, | ||
| 94 | gint *pid, gint *job) | ||
| 95 | { | ||
| 96 | struct event_format *event; | ||
| 97 | unsigned long long val; | ||
| 98 | gint id; | ||
| 99 | int ret = 0; | ||
| 100 | |||
| 101 | if (rtinfo->task_param_id < 0) { | ||
| 102 | event = pevent_find_event_by_name(pevent, "litmus", | ||
| 103 | "litmus_task_completion"); | ||
| 104 | if (!event) | ||
| 105 | return 0; | ||
| 106 | rtinfo->task_completion_id = event->id; | ||
| 107 | rtinfo->completion_pid_field = pevent_find_field(event, "pid"); | ||
| 108 | rtinfo->completion_job_field = pevent_find_field(event, "job"); | ||
| 109 | } | ||
| 110 | |||
| 111 | id = pevent_data_type(pevent, record); | ||
| 112 | if (id == rtinfo->task_completion_id) { | ||
| 113 | pevent_read_number_field(rtinfo->completion_pid_field, | ||
| 114 | record->data, &val); | ||
| 115 | *pid = val; | ||
| 116 | pevent_read_number_field(rtinfo->completion_job_field, | ||
| 117 | record->data, &val); | ||
| 118 | *job = val; | ||
| 119 | ret = 1; | ||
| 120 | } | ||
| 121 | |||
| 122 | return ret; | ||
| 123 | } | ||
| 124 | |||
| 125 | /** | ||
| 126 | * rt_graph_check_task_block - check for litmus_task_block record | ||
| 127 | * Return 1 and @pid if the record matches | ||
| 128 | */ | ||
| 129 | int rt_graph_check_task_block(struct rt_graph_info *rtinfo, | ||
| 130 | struct pevent *pevent, struct record *record, | ||
| 131 | gint *pid) | ||
| 132 | { | ||
| 133 | struct event_format *event; | ||
| 134 | unsigned long long val; | ||
| 135 | gint id; | ||
| 136 | int ret = 0; | ||
| 137 | |||
| 138 | if (rtinfo->task_block_id < 0) { | ||
| 139 | event = pevent_find_event_by_name(pevent, "litmus", | ||
| 140 | "litmus_task_block"); | ||
| 141 | if (!event) | ||
| 142 | return 0; | ||
| 143 | rtinfo->task_block_id = event->id; | ||
| 144 | rtinfo->block_pid_field = pevent_find_field(event, "pid"); | ||
| 145 | } | ||
| 146 | |||
| 147 | id = pevent_data_type(pevent, record); | ||
| 148 | if (id == rtinfo->task_block_id) { | ||
| 149 | pevent_read_number_field(rtinfo->block_pid_field, | ||
| 150 | record->data, &val); | ||
| 151 | *pid = val; | ||
| 152 | ret = 1; | ||
| 153 | } | ||
| 154 | |||
| 155 | return ret; | ||
| 156 | } | ||
| 157 | |||
| 158 | /** | ||
| 159 | * rt_graph_check_task_release - check for litmus_task_release record | ||
| 160 | * Return 1 and @pid if the record matches | ||
| 161 | */ | ||
| 162 | int rt_graph_check_task_resume(struct rt_graph_info *rtinfo, | ||
| 163 | struct pevent *pevent, struct record *record, | ||
| 164 | gint *pid) | ||
| 165 | { | ||
| 166 | struct event_format *event; | ||
| 167 | unsigned long long val; | ||
| 168 | gint id; | ||
| 169 | int ret = 0; | ||
| 170 | |||
| 171 | if (rtinfo->task_resume_id < 0) { | ||
| 172 | event = pevent_find_event_by_name(pevent, "litmus", | ||
| 173 | "litmus_task_resume"); | ||
| 174 | if (!event) | ||
| 175 | return 0; | ||
| 176 | rtinfo->task_resume_id = event->id; | ||
| 177 | rtinfo->resume_pid_field = pevent_find_field(event, "pid"); | ||
| 178 | } | ||
| 179 | |||
| 180 | id = pevent_data_type(pevent, record); | ||
| 181 | if (id == rtinfo->task_resume_id) { | ||
| 182 | pevent_read_number_field(rtinfo->resume_pid_field, | ||
| 183 | record->data, &val); | ||
| 184 | *pid = val; | ||
| 185 | ret = 1; | ||
| 186 | } | ||
| 187 | |||
| 188 | return ret; | ||
| 189 | } | ||
| 190 | |||
| 191 | /** | ||
| 192 | * init_rt_event_cache - reset cached field values | ||
| 193 | */ | ||
| 194 | void init_rt_event_cache(struct rt_graph_info *rtinfo) | ||
| 195 | { | ||
| 196 | print("hello"); | ||
| 197 | rtinfo->task_param_id = -1; | ||
| 198 | rtinfo->task_release_id = -1; | ||
| 199 | rtinfo->task_completion_id = -1; | ||
| 200 | rtinfo->task_block_id = -1; | ||
| 201 | rtinfo->task_resume_id = -1; | ||
| 202 | |||
| 203 | rtinfo->param_pid_field = NULL; | ||
| 204 | rtinfo->param_wcet_field = NULL; | ||
| 205 | rtinfo->param_period_field = NULL; | ||
| 206 | |||
| 207 | rtinfo->release_pid_field = NULL; | ||
| 208 | rtinfo->release_job_field = NULL; | ||
| 209 | rtinfo->release_deadline_field = NULL; | ||
| 210 | |||
| 211 | rtinfo->completion_pid_field = NULL; | ||
| 212 | rtinfo->completion_job_field = NULL; | ||
| 213 | |||
| 214 | rtinfo->block_pid_field = NULL; | ||
| 215 | rtinfo->resume_pid_field = NULL; | ||
| 216 | } | ||
diff --git a/rt-graph.h b/rt-graph.h new file mode 100644 index 0000000..0ea921a --- /dev/null +++ b/rt-graph.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #ifndef _RT_GRAPH_H | ||
| 2 | #define _RT_GRAPH_H | ||
| 3 | |||
| 4 | #include <gtk/gtk.h> | ||
| 5 | #include "trace-cmd.h" | ||
| 6 | |||
| 7 | struct rt_graph_info { | ||
| 8 | |||
| 9 | /* Cache of event fields so that they don't need to be located | ||
| 10 | * during each access. | ||
| 11 | */ | ||
| 12 | gint task_param_id; | ||
| 13 | struct format_field *param_pid_field; | ||
| 14 | struct format_field *param_wcet_field; | ||
| 15 | struct format_field *param_period_field; | ||
| 16 | gint task_release_id; | ||
| 17 | struct format_field *release_pid_field; | ||
| 18 | struct format_field *release_job_field; | ||
| 19 | struct format_field *release_deadline_field; | ||
| 20 | gint task_completion_id; | ||
| 21 | struct format_field *completion_pid_field; | ||
| 22 | struct format_field *completion_job_field; | ||
| 23 | gint task_block_id; | ||
| 24 | struct format_field *block_pid_field; | ||
| 25 | gint task_resume_id; | ||
| 26 | struct format_field *resume_pid_field; | ||
| 27 | |||
| 28 | }; | ||
| 29 | |||
| 30 | int rt_graph_check_task_param(struct rt_graph_info *rtinfo, struct pevent *pevent, | ||
| 31 | struct record *record, gint *pid, | ||
| 32 | unsigned long long *wcet, | ||
| 33 | unsigned long long *period); | ||
| 34 | int rt_graph_check_task_release(struct rt_graph_info *rtinfo, struct pevent *pevent, | ||
| 35 | struct record *record, gint *pid, gint *job, | ||
| 36 | unsigned long long *deadline); | ||
| 37 | int rt_graph_check_task_completion(struct rt_graph_info *rtinfo, struct pevent *pevent, | ||
| 38 | struct record *record, gint *pid, gint *job); | ||
| 39 | int rt_graph_check_task_block(struct rt_graph_info *rtinfo, struct pevent *pevent, | ||
| 40 | struct record *record, gint *pid); | ||
| 41 | int rt_graph_check_task_resume(struct rt_graph_info *rtinfo, struct pevent *pevent, | ||
| 42 | struct record *record, gint *pid); | ||
| 43 | void init_rt_event_cache(struct rt_graph_info *rtinfo); | ||
| 44 | |||
| 45 | #endif | ||
diff --git a/trace-graph.h b/trace-graph.h index 3344894..c3ae5a3 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include "trace-cmd.h" | 25 | #include "trace-cmd.h" |
| 26 | #include "trace-hash.h" | 26 | #include "trace-hash.h" |
| 27 | #include "trace-xml.h" | 27 | #include "trace-xml.h" |
| 28 | #include "rt-graph.h" | ||
| 28 | 29 | ||
| 29 | struct graph_info; | 30 | struct graph_info; |
| 30 | 31 | ||
| @@ -229,6 +230,8 @@ struct graph_info { | |||
| 229 | struct format_field *wakeup_new_pid_field; | 230 | struct format_field *wakeup_new_pid_field; |
| 230 | struct format_field *wakeup_new_success_field; | 231 | struct format_field *wakeup_new_success_field; |
| 231 | 232 | ||
| 233 | struct rt_graph_info rt_info; | ||
| 234 | |||
| 232 | gboolean read_comms; /* Read all comms on first load */ | 235 | gboolean read_comms; /* Read all comms on first load */ |
| 233 | 236 | ||
| 234 | struct filter_task *task_filter; | 237 | struct filter_task *task_filter; |
