aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan <hermanjl@hermanjl-Aspire-5553G.(none)>2012-03-08 21:55:37 -0500
committerJonathan <hermanjl@hermanjl-Aspire-5553G.(none)>2012-03-08 21:55:37 -0500
commit70441ec3cb97aa058fe44f1918172ee989aee245 (patch)
tree2f3f362b80320bfa58bc73ad08233da38f9ef44d
parent0afbf80728003d445305e32b3174ff149890dd77 (diff)
rt-graph: cleanup of graph display
-rw-r--r--rt-plot-cpu.c74
-rw-r--r--rt-plot-task.c25
-rw-r--r--trace-graph.c14
-rw-r--r--trace-graph.h1
-rw-r--r--trace-plot.c1
5 files changed, 85 insertions, 30 deletions
diff --git a/rt-plot-cpu.c b/rt-plot-cpu.c
index bc37df7..82d03e6 100644
--- a/rt-plot-cpu.c
+++ b/rt-plot-cpu.c
@@ -44,20 +44,53 @@ next_sa_record(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
44 return ret; 44 return ret;
45} 45}
46 46
47static inline int
48is_displayed(struct graph_info *ginfo, int eid)
49{
50 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
51 return !(eid == rtg_info->switch_away_id ||
52 eid == rtg_info->switch_to_id ||
53 eid == rtg_info->task_completion_id ||
54 eid == rtg_info->task_block_id ||
55 eid == rtg_info->task_resume_id ||
56 eid == rtg_info->task_release_id ||
57 eid == ginfo->event_sched_switch_id);
58}
59
47static struct record* 60static struct record*
48find_record(struct graph_info *ginfo, int cpu, unsigned long long time) 61__find_record(struct graph_info *ginfo, int cpu, unsigned long long time,
62 int display)
49{ 63{
50 struct record *record = NULL; 64 struct record *record;
65 int eid, ignored;
66
51 set_cpu_to_rts(ginfo, time, cpu); 67 set_cpu_to_rts(ginfo, time, cpu);
52 68
53 while ((record = tracecmd_read_data(ginfo->handle, cpu))) { 69 while ((record = tracecmd_read_data(ginfo->handle, cpu))) {
54 if (get_rts(ginfo, record) >= time) 70 ignored = 0;
71 if (display) {
72 eid = pevent_data_type(ginfo->pevent, record);
73 ignored = !is_displayed(ginfo, eid);
74 }
75 if (get_rts(ginfo, record) >= time && !ignored)
55 break; 76 break;
56 free_record(record); 77 free_record(record);
57 } 78 }
58 return record; 79 return record;
59} 80}
60 81
82static inline struct record*
83find_record(struct graph_info *ginfo, int cpu, guint64 time)
84{
85 return __find_record(ginfo, cpu, time, 0);
86}
87
88static inline struct record*
89find_display_record(struct graph_info *ginfo, int cpu, guint64 time)
90{
91 return __find_record(ginfo, cpu, time, 1);
92}
93
61 94
62static void update_pid(struct rt_cpu_info *rtc_info, int pid) 95static void update_pid(struct rt_cpu_info *rtc_info, int pid)
63{ 96{
@@ -79,7 +112,8 @@ try_switch_away(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
79 record, &pid, &job, &ts); 112 record, &pid, &job, &ts);
80 if (match) { 113 if (match) {
81 update_pid(rtc_info, pid); 114 update_pid(rtc_info, pid);
82 if (rtc_info->rt_run_time && rtc_info->rt_run_time < ts) { 115 if (rtc_info->rt_run_time && rtc_info->rt_run_time < ts &&
116 job != 1) {
83 info->box = TRUE; 117 info->box = TRUE;
84 info->bcolor = hash_pid(rtc_info->run_pid); 118 info->bcolor = hash_pid(rtc_info->run_pid);
85 info->bfill = TRUE; 119 info->bfill = TRUE;
@@ -220,8 +254,8 @@ static void rt_cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot,
220static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot, 254static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
221 struct record *record, struct plot_info *info) 255 struct record *record, struct plot_info *info)
222{ 256{
223 int pid, eid, match; 257 int pid, eid, match, dint;
224 unsigned long long ts; 258 unsigned long long ts, dull;
225 struct rt_cpu_info *rtc_info = plot->private; 259 struct rt_cpu_info *rtc_info = plot->private;
226 struct rt_graph_info *rtg_info = &ginfo->rtg_info; 260 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
227 261
@@ -239,11 +273,20 @@ static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
239 try_sched_switch(ginfo, rtc_info, record, info); 273 try_sched_switch(ginfo, rtc_info, record, info);
240 274
241 if (!match) { 275 if (!match) {
242 rt_graph_check_any(rtg_info, ginfo->pevent, record, 276 /* Have to call checks to ensure ids are loaded. Otherwise,
243 &pid, &eid, &ts); 277 * is_displayed will not work in any methods.
244 info->line = TRUE; 278 */
245 info->lcolor = hash_pid(pid); 279#define ARG rtg_info, ginfo->pevent, record, &pid
246 info->ltime = ts; 280 rt_graph_check_task_release(ARG, &dint, &dull, &dull);
281 rt_graph_check_task_block(ARG, &dull);
282 rt_graph_check_task_resume(ARG, &dull);
283 rt_graph_check_any(ARG, &eid, &ts);
284#undef ARG
285 if (is_displayed(ginfo, eid)) {
286 info->line = TRUE;
287 info->lcolor = hash_pid(pid);
288 info->ltime = ts;
289 }
247 } 290 }
248 return 1; 291 return 1;
249} 292}
@@ -263,7 +306,7 @@ rt_cpu_plot_display_last_event(struct graph_info *ginfo, struct graph_plot *plot
263 if (record) 306 if (record)
264 offset = record->offset; 307 offset = record->offset;
265 308
266 record = find_record(ginfo, cpu, time); 309 record = find_display_record(ginfo, cpu, time);
267 310
268 if (offset) 311 if (offset)
269 tracecmd_set_cursor(ginfo->handle, cpu, offset); 312 tracecmd_set_cursor(ginfo->handle, cpu, offset);
@@ -351,7 +394,7 @@ rt_cpu_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
351 394
352 if (is_running) { 395 if (is_running) {
353 comm = pevent_data_comm_from_pid(ginfo->pevent, pid); 396 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
354 trace_seq_printf(s, "%s-%d:%d\n", comm, pid, job); 397 trace_seq_printf(s, "%s-%d:%d\n\n", comm, pid, job);
355 } 398 }
356 399
357 if (record) { 400 if (record) {
@@ -360,16 +403,15 @@ rt_cpu_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
360 eid = pevent_data_type(ginfo->pevent, record); 403 eid = pevent_data_type(ginfo->pevent, record);
361 event = pevent_data_event_from_type(ginfo->pevent, eid); 404 event = pevent_data_event_from_type(ginfo->pevent, eid);
362 if (event) { 405 if (event) {
363 trace_seq_putc(s, '\n');
364 trace_seq_puts(s, event->name); 406 trace_seq_puts(s, event->name);
365 trace_seq_putc(s, '\n'); 407 trace_seq_putc(s, '\n');
366 pevent_event_info(s, event, record); 408 pevent_event_info(s, event, record);
409 trace_seq_putc(s, '\n');
367 } else 410 } else
368 trace_seq_printf(s, "\nUNKNOWN EVENT %d\n", eid); 411 trace_seq_printf(s, "UNKNOWN EVENT %d\n", eid);
369 } 412 }
370 free_record(record); 413 free_record(record);
371 } 414 }
372 trace_seq_putc(s, '\n');
373 nano_to_milli(time, &msec, &nsec); 415 nano_to_milli(time, &msec, &nsec);
374 trace_seq_printf(s, "%llu.%06llu ms CPU: %03d", 416 trace_seq_printf(s, "%llu.%06llu ms CPU: %03d",
375 msec, nsec, rtc_info->cpu); 417 msec, nsec, rtc_info->cpu);
diff --git a/rt-plot-task.c b/rt-plot-task.c
index f8d29ed..947e2e9 100644
--- a/rt-plot-task.c
+++ b/rt-plot-task.c
@@ -83,18 +83,18 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info,
83 83
84/* 84/*
85 * Return first relevant record after @time. 85 * Return first relevant record after @time.
86 * @display: If set, only considers records which are plotted in some way 86 * @display: If set, only considers records which aren't plotted
87 */ 87 */
88static struct record* 88static struct record*
89__find_record(struct graph_info *ginfo, gint pid, guint64 time, int display) 89__find_record(struct graph_info *ginfo, gint pid, guint64 time, int display)
90{ 90{
91 int next_cpu, match, eid, ignored= 0; 91 int next_cpu, match, eid, ignored;
92 struct record *record = NULL; 92 struct record *record;
93 struct rt_graph_info *rtg_info = &ginfo->rtg_info; 93 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
94 94
95 set_cpus_to_rts(ginfo, time); 95 set_cpus_to_rts(ginfo, time);
96 while ((record = tracecmd_read_next_data(ginfo->handle, &next_cpu))) { 96 while ((record = tracecmd_read_next_data(ginfo->handle, &next_cpu))) {
97 free_record(record); 97 ignored = 0;
98 match = record_matches_pid(ginfo, record, pid); 98 match = record_matches_pid(ginfo, record, pid);
99 if (display) { 99 if (display) {
100 eid = pevent_data_type(ginfo->pevent, record); 100 eid = pevent_data_type(ginfo->pevent, record);
@@ -105,9 +105,10 @@ __find_record(struct graph_info *ginfo, gint pid, guint64 time, int display)
105 eid == rtg_info->task_resume_id || 105 eid == rtg_info->task_resume_id ||
106 eid == rtg_info->task_release_id); 106 eid == rtg_info->task_release_id);
107 } 107 }
108 ignored = ignored && eid == ginfo->event_sched_switch_id; 108 ignored = ignored || eid == ginfo->event_sched_switch_id;
109 if (get_rts(ginfo, record) >= time && match && !ignored) 109 if (get_rts(ginfo, record) >= time && match && !ignored)
110 break; 110 break;
111 free_record(record);
111 }; 112 };
112 113
113 return record; 114 return record;
@@ -318,9 +319,11 @@ static int try_completion(struct graph_info *ginfo,
318 match = rt_graph_check_task_completion(&ginfo->rtg_info, ginfo->pevent, 319 match = rt_graph_check_task_completion(&ginfo->rtg_info, ginfo->pevent,
319 record, &pid, &job, &ts); 320 record, &pid, &job, &ts);
320 if (match && pid == rtt_info->pid) { 321 if (match && pid == rtt_info->pid) {
321 update_job(rtt_info, job); 322
322 info->completion = TRUE;