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; 323 info->completion = TRUE;
323 info->ctime = ts; 324 info->ctime = ts;
325 update_job(rtt_info, job);
326
324 dprintf(3, "Completion for %d:%d on %d at %llu\n", 327 dprintf(3, "Completion for %d:%d on %d at %llu\n",
325 pid, job, record->cpu, ts); 328 pid, job, record->cpu, ts);
326 ret = 1; 329 ret = 1;
@@ -386,7 +389,8 @@ try_switch_away(struct graph_info *ginfo, struct rt_task_info *rtt_info,
386 if (match && pid == rtt_info->pid) { 389 if (match && pid == rtt_info->pid) {
387 update_job(rtt_info, job); 390 update_job(rtt_info, job);
388 391
389 if (rtt_info->run_time && rtt_info->run_time < ts) { 392 if (rtt_info->run_time && rtt_info->run_time < ts &&
393 job != 1) {
390 dprintf(3, "Box for %d:%d, %llu to %llu on CPU %d\n", 394 dprintf(3, "Box for %d:%d, %llu to %llu on CPU %d\n",
391 rtt_info->pid, rtt_info->last_job, 395 rtt_info->pid, rtt_info->last_job,
392 rtt_info->run_time, ts, record->cpu); 396 rtt_info->run_time, ts, record->cpu);
@@ -430,7 +434,7 @@ static int try_switch_to(struct graph_info *ginfo, struct rt_task_info *rtt_info
430static int try_other(struct graph_info *ginfo, struct rt_task_info *rtt_info, 434static int try_other(struct graph_info *ginfo, struct rt_task_info *rtt_info,
431 struct record *record, struct plot_info *info) 435 struct record *record, struct plot_info *info)
432{ 436{
433 int pid, eid, epid, my_pid, my_cpu, not_sa, ret = 0; 437 int pid, eid, epid, my_pid, my_cpu, not_sa, not_ss, ret = 0;
434 unsigned long long ts; 438 unsigned long long ts;
435 439
436 pid = rtt_info->pid; 440 pid = rtt_info->pid;
@@ -440,8 +444,9 @@ static int try_other(struct graph_info *ginfo, struct rt_task_info *rtt_info,
440 my_pid = (pid == epid); 444 my_pid = (pid == epid);
441 my_cpu = (rtt_info->run_time && record->cpu == rtt_info->run_cpu); 445 my_cpu = (rtt_info->run_time && record->cpu == rtt_info->run_cpu);
442 not_sa = (eid != ginfo->rtg_info.switch_away_id); 446 not_sa = (eid != ginfo->rtg_info.switch_away_id);
443 if (not_sa && (my_pid || my_cpu) && 447 not_ss = (eid != ginfo->event_sched_switch_id);
444 eid != ginfo->event_sched_switch_id) { 448
449 if ((my_pid || my_cpu) && not_ss && not_sa) {
445 info->line = TRUE; 450 info->line = TRUE;
446 info->lcolor = hash_pid(record->cpu); 451 info->lcolor = hash_pid(record->cpu);
447 info->ltime = ts; 452 info->ltime = ts;
diff --git a/trace-graph.c b/trace-graph.c
index 9ce0853..42a0b27 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1632,14 +1632,20 @@ static gint draw_event_label(struct graph_info *ginfo, gint i,
1632} 1632}
1633 1633
1634static gint draw_plot_line(struct graph_info *ginfo, int i, 1634static gint draw_plot_line(struct graph_info *ginfo, int i,
1635 unsigned long long time, GdkGC *gc) 1635 unsigned long long time, gboolean small,
1636 GdkGC *gc)
1636{ 1637{
1637 gint x; 1638 gint x;
1639 gint y;
1638 1640
1639 x = convert_time_to_x(ginfo, time); 1641 x = convert_time_to_x(ginfo, time);
1642 /* y = (small) ? PLOT_BOX_TOP(i) : PLOT_TOP(i); */
1643 y = PLOT_TOP(i);
1640 1644
1641 gdk_draw_line(ginfo->curr_pixmap, gc, 1645 if (!small || convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) {
1642 x, PLOT_TOP(i), x, PLOT_BOTTOM(i)); 1646 gdk_draw_line(ginfo->curr_pixmap, gc,
1647 x, y, x, PLOT_BOTTOM(i));
1648 }
1643 1649
1644 return x; 1650 return x;
1645} 1651}
@@ -1815,7 +1821,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
1815 set_color(ginfo->draw, plot->gc, plot->last_color); 1821 set_color(ginfo->draw, plot->gc, plot->last_color);
1816 } 1822 }
1817 1823
1818 x = draw_plot_line(ginfo, plot->pos, info.ltime, plot->gc); 1824 x = draw_plot_line(ginfo, plot->pos, info.ltime, info.lsmall, plot->gc);
1819 1825
1820 /* Figure out if we can show the text for the previous record */ 1826 /* Figure out if we can show the text for the previous record */
1821 1827
diff --git a/trace-graph.h b/trace-graph.h
index d3d4cba..4bfef4d 100644
--- a/trace-graph.h
+++ b/trace-graph.h
@@ -58,6 +58,7 @@ struct graph_plot;
58 58
59struct plot_info { 59struct plot_info {
60 gboolean line; 60 gboolean line;
61 gboolean lsmall;
61 int lcolor; 62 int lcolor;
62 unsigned long long ltime; 63 unsigned long long ltime;
63 64
diff --git a/trace-plot.c b/trace-plot.c
index 5629e47..8551a34 100644
--- a/trace-plot.c
+++ b/trace-plot.c
@@ -348,6 +348,7 @@ int trace_graph_plot_event(struct graph_info *ginfo,
348 info->line = FALSE; 348 info->line = FALSE;
349 info->box = FALSE; 349 info->box = FALSE;
350 info->bfill = TRUE; 350 info->bfill = TRUE;
351 info->lsmall = FALSE;
351 352
352 info->blabel = NULL; 353 info->blabel = NULL;
353 info->bthin = FALSE; 354 info->bthin = FALSE;