diff options
| author | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 13:00:37 -0500 |
|---|---|---|
| committer | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 13:00:37 -0500 |
| commit | 0164fce222ab4582bf9a61cdcb0ee5e87af018d6 (patch) | |
| tree | 64ed94c6d17da3d21b85bc659d5f7f664d2f6e18 | |
| parent | e15cf27a6fb6f8498def2a4e036483fd7089a530 (diff) | |
rt-graph: added real-time shapes to graph
| -rw-r--r-- | rt-plot-task.c | 51 | ||||
| -rw-r--r-- | trace-graph.c | 98 | ||||
| -rw-r--r-- | trace-plot.c | 8 |
3 files changed, 143 insertions, 14 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c index 9e8ffe7..b6d794d 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
| @@ -93,7 +93,7 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 93 | static struct record* | 93 | static struct record* |
| 94 | __find_record(struct graph_info *ginfo, gint pid, guint64 time, int display) | 94 | __find_record(struct graph_info *ginfo, gint pid, guint64 time, int display) |
| 95 | { | 95 | { |
| 96 | int next_cpu, match, eid, is_sa = 0; | 96 | int next_cpu, match, eid, ignored= 0; |
| 97 | struct record *record = NULL; | 97 | struct record *record = NULL; |
| 98 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; | 98 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; |
| 99 | 99 | ||
| @@ -106,9 +106,15 @@ __find_record(struct graph_info *ginfo, gint pid, guint64 time, int display) | |||
| 106 | match = record_matches_pid(ginfo, record, pid); | 106 | match = record_matches_pid(ginfo, record, pid); |
| 107 | if (display) { | 107 | if (display) { |
| 108 | eid = pevent_data_type(ginfo->pevent, record); | 108 | eid = pevent_data_type(ginfo->pevent, record); |
| 109 | is_sa = (eid == rtg_info->switch_away_id); | 109 | ignored = (eid == rtg_info->switch_away_id || |
| 110 | eid == rtg_info->switch_to_id || | ||
| 111 | eid == rtg_info->task_completion_id || | ||
| 112 | eid == rtg_info->task_block_id || | ||
| 113 | eid == rtg_info->task_resume_id || | ||
| 114 | eid == rtg_info->task_release_id); | ||
| 110 | } | 115 | } |
| 111 | } while (!(get_rts(ginfo, record) > time && match && !is_sa)); | 116 | ignored = ignored && eid == ginfo->event_sched_switch_id; |
| 117 | } while (!(get_rts(ginfo, record) > time && match && !ignored)); | ||
| 112 | 118 | ||
| 113 | return record; | 119 | return record; |
| 114 | } | 120 | } |
| @@ -358,12 +364,12 @@ static int try_resume(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 358 | match = rt_graph_check_task_resume(&ginfo->rtg_info, ginfo->pevent, | 364 | match = rt_graph_check_task_resume(&ginfo->rtg_info, ginfo->pevent, |
| 359 | record, &pid, &ts); | 365 | record, &pid, &ts); |
| 360 | if (match && pid == rtt_info->pid) { | 366 | if (match && pid == rtt_info->pid) { |
| 361 | /* info->box = TRUE; */ | 367 | info->box = TRUE; |
| 362 | /* info->bcolor = 0x0; */ | 368 | info->bcolor = 0x0; |
| 363 | /* info->bfill = TRUE; */ | 369 | info->bfill = TRUE; |
| 364 | /* info->bthin = TRUE; */ | 370 | info->bthin = TRUE; |
| 365 | /* info->bstart = rtt_info->block_time; */ | 371 | info->bstart = rtt_info->block_time; |
| 366 | /* info->bend = ts; */ | 372 | info->bend = ts; |
| 367 | rtt_info->fresh = FALSE; | 373 | rtt_info->fresh = FALSE; |
| 368 | 374 | ||
| 369 | rtt_info->block_time = 0ULL; | 375 | rtt_info->block_time = 0ULL; |
| @@ -442,7 +448,8 @@ static int try_other(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 442 | my_pid = (pid == epid); | 448 | my_pid = (pid == epid); |
| 443 | my_cpu = (rtt_info->run_time && record->cpu == rtt_info->run_cpu); | 449 | my_cpu = (rtt_info->run_time && record->cpu == rtt_info->run_cpu); |
| 444 | not_sa = (eid != ginfo->rtg_info.switch_away_id); | 450 | not_sa = (eid != ginfo->rtg_info.switch_away_id); |
| 445 | if (not_sa && (my_pid || my_cpu)) { | 451 | if (not_sa && (my_pid || my_cpu) && |
| 452 | eid != ginfo->event_sched_switch_id) { | ||
| 446 | info->line = TRUE; | 453 | info->line = TRUE; |
| 447 | info->lcolor = hash_pid(record->cpu); | 454 | info->lcolor = hash_pid(record->cpu); |
| 448 | info->ltime = ts; | 455 | info->ltime = ts; |
| @@ -469,6 +476,13 @@ static void do_plot_end(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 469 | info->blabel = rtt_info->label; | 476 | info->blabel = rtt_info->label; |
| 470 | } else if (rtt_info->block_time && rtt_info->block_cpu != NO_CPU) { | 477 | } else if (rtt_info->block_time && rtt_info->block_cpu != NO_CPU) { |
| 471 | /* Blocking happened */ | 478 | /* Blocking happened */ |
| 479 | info->box = TRUE; | ||
| 480 | info->bcolor = 0x0; | ||
| 481 | info->bfill = TRUE; | ||
| 482 | info->bthin = TRUE; | ||
| 483 | info->bstart = rtt_info->block_time; | ||
| 484 | info->bend = ginfo->view_end_time; | ||
| 485 | rtt_info->fresh = FALSE; | ||
| 472 | } else if (rtt_info->fresh) { | 486 | } else if (rtt_info->fresh) { |
| 473 | /* Nothing happened!*/ | 487 | /* Nothing happened!*/ |
| 474 | record = next_box_record(ginfo, rtt_info, | 488 | record = next_box_record(ginfo, rtt_info, |
| @@ -484,6 +498,13 @@ static void do_plot_end(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 484 | info->bend = ginfo->view_end_time; | 498 | info->bend = ginfo->view_end_time; |
| 485 | } else if (eid == rtg_info->task_resume_id) { | 499 | } else if (eid == rtg_info->task_resume_id) { |
| 486 | /* In a block */ | 500 | /* In a block */ |
| 501 | info->box = TRUE; | ||
| 502 | info->bcolor = 0x0; | ||
| 503 | info->bfill = TRUE; | ||
| 504 | info->bthin = TRUE; | ||
| 505 | info->bstart = ginfo->view_start_time; | ||
| 506 | info->bend = ginfo->view_end_time; | ||
| 507 | rtt_info->fresh = FALSE; | ||
| 487 | } | 508 | } |
| 488 | free_record(record); | 509 | free_record(record); |
| 489 | } | 510 | } |
| @@ -614,6 +635,16 @@ static int rt_task_plot_display_info(struct graph_info *ginfo, | |||
| 614 | if (record) { | 635 | if (record) { |
| 615 | rts = get_rts(ginfo, record); | 636 | rts = get_rts(ginfo, record); |
| 616 | eid = pevent_data_type(ginfo->pevent, record); | 637 | eid = pevent_data_type(ginfo->pevent, record); |
| 638 | |||
| 639 | if (in_res(ginfo, deadline, time)) { | ||
| 640 | trace_seq_printf(s, "litmus_deadline for %d:%d at %llu\n", | ||
| 641 | pid, job, deadline); | ||
| 642 | } | ||
| 643 | if (in_res(ginfo, release, time)) { | ||
| 644 | trace_seq_printf(s, "litmus_release for %d:%d at %llu\n", | ||
| 645 | pid, job, release); | ||
| 646 | } | ||
| 647 | |||
| 617 | if (in_res(ginfo, rts, time)) { | 648 | if (in_res(ginfo, rts, time)) { |
| 618 | event = pevent_data_event_from_type(ginfo->pevent, eid); | 649 | event = pevent_data_event_from_type(ginfo->pevent, eid); |
| 619 | if (event) { | 650 | if (event) { |
diff --git a/trace-graph.c b/trace-graph.c index f3a5916..10e1d65 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -50,6 +50,8 @@ | |||
| 50 | 50 | ||
| 51 | #define PLOT_SIZE 10 | 51 | #define PLOT_SIZE 10 |
| 52 | #define PLOT_BOX_SIZE PLOT_SIZE | 52 | #define PLOT_BOX_SIZE PLOT_SIZE |
| 53 | #define PLOT_TRI_SIZE PLOT_BOX_SIZE / 2 | ||
| 54 | #define PLOT_BTRI_SIZE .75 * PLOT_BOX_SIZE | ||
| 53 | #define PLOT_GIVE 2 | 55 | #define PLOT_GIVE 2 |
| 54 | #define PLOT_BEGIN 80 | 56 | #define PLOT_BEGIN 80 |
| 55 | #define PLOT_SEP 50 | 57 | #define PLOT_SEP 50 |
| @@ -1639,18 +1641,78 @@ static gint draw_plot_line(struct graph_info *ginfo, int i, | |||
| 1639 | static void draw_plot_box(struct graph_info *ginfo, int i, | 1641 | static void draw_plot_box(struct graph_info *ginfo, int i, |
| 1640 | unsigned long long start, | 1642 | unsigned long long start, |
| 1641 | unsigned long long end, | 1643 | unsigned long long end, |
| 1642 | gboolean fill, GdkGC *gc) | 1644 | gboolean fill, gboolean thin, |
| 1645 | char *label, GdkGC *gc) | ||
| 1643 | { | 1646 | { |
| 1644 | gint x1; | 1647 | gint x1; |
| 1645 | gint x2; | 1648 | gint x2; |
| 1649 | gint y; | ||
| 1650 | gint size; | ||
| 1646 | 1651 | ||
| 1647 | x1 = convert_time_to_x(ginfo, start); | 1652 | x1 = convert_time_to_x(ginfo, start); |
| 1648 | x2 = convert_time_to_x(ginfo, end); | 1653 | x2 = convert_time_to_x(ginfo, end); |
| 1649 | 1654 | ||
| 1655 | size = (thin) ? PLOT_BOX_SIZE/4 : PLOT_BOX_SIZE; | ||
| 1656 | y = PLOT_BOX_TOP(i) + (PLOT_BOX_SIZE - size)/2; | ||
| 1657 | |||
| 1650 | gdk_draw_rectangle(ginfo->curr_pixmap, gc, | 1658 | gdk_draw_rectangle(ginfo->curr_pixmap, gc, |
| 1651 | fill, | 1659 | fill, |
| 1652 | x1, PLOT_BOX_TOP(i), | 1660 | x1, y, |
| 1653 | x2 - x1, PLOT_BOX_SIZE); | 1661 | x2 - x1, size); |
| 1662 | } | ||
| 1663 | |||
| 1664 | static void draw_plot_release(struct graph_info *ginfo, int i, | ||
| 1665 | unsigned long long time, char *label, GdkGC *gc) | ||
| 1666 | { | ||
| 1667 | |||
| 1668 | int tbase = PLOT_TOP(i) + PLOT_TRI_SIZE; | ||
| 1669 | int x = convert_time_to_x(ginfo, time); | ||
| 1670 | GdkPoint tpoints[3]; | ||
| 1671 | tpoints[0].x = x; | ||
| 1672 | tpoints[0].y = PLOT_TOP(i); | ||
| 1673 | tpoints[1].x = x - PLOT_TRI_SIZE/2; | ||
| 1674 | tpoints[1].y = tbase; | ||
| 1675 | tpoints[2].x = x + PLOT_TRI_SIZE/2; | ||
| 1676 | tpoints[2].y = tbase; | ||
| 1677 | |||
| 1678 | gdk_draw_line(ginfo->curr_pixmap, gc, | ||
| 1679 | x, tbase, x, PLOT_BOX_BOTTOM(i)); | ||
| 1680 | gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3); | ||
| 1681 | } | ||
| 1682 | |||
| 1683 | static void draw_plot_deadline(struct graph_info *ginfo, int i, | ||
| 1684 | unsigned long long time, char *label, GdkGC *gc) | ||
| 1685 | { | ||
| 1686 | int tbase = PLOT_BOX_BOTTOM(i); | ||
| 1687 | int x = convert_time_to_x(ginfo, time); | ||
| 1688 | GdkPoint tpoints[3]; | ||
| 1689 | tpoints[0].x = x; | ||
| 1690 | tpoints[0].y = tbase + PLOT_TRI_SIZE; | ||
| 1691 | tpoints[1].x = x - PLOT_TRI_SIZE/2; | ||
| 1692 | tpoints[1].y = tbase; | ||
| 1693 | tpoints[2].x = x + PLOT_TRI_SIZE/2; | ||
| 1694 | tpoints[2].y = tbase; | ||
| 1695 | |||
| 1696 | gdk_draw_line(ginfo->curr_pixmap, gc, | ||
| 1697 | x, PLOT_BOX_TOP(i), x, tbase); | ||
| 1698 | gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3); | ||
| 1699 | } | ||
| 1700 | |||
| 1701 | static void draw_plot_completion(struct graph_info *ginfo, int i, | ||
| 1702 | unsigned long long time, char *label, | ||
| 1703 | GdkGC *gc) | ||
| 1704 | { | ||
| 1705 | int tbase = PLOT_BOX_BOTTOM(i) + PLOT_BTRI_SIZE; | ||
| 1706 | int x = convert_time_to_x(ginfo, time); | ||
| 1707 | GdkPoint tpoints[3]; | ||
| 1708 | tpoints[0].x = x; | ||
| 1709 | tpoints[0].y = tbase - PLOT_BTRI_SIZE; | ||
| 1710 | tpoints[1].x = x - PLOT_BTRI_SIZE/2; | ||
| 1711 | tpoints[1].y = tbase; | ||
| 1712 | tpoints[2].x = x + PLOT_BTRI_SIZE/2; | ||
| 1713 | tpoints[2].y = tbase; | ||
| 1714 | |||
| 1715 | gdk_draw_polygon(ginfo->curr_pixmap, gc, TRUE, tpoints, 3); | ||
| 1654 | } | 1716 | } |
| 1655 | 1717 | ||
| 1656 | static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | 1718 | static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, |
| @@ -1686,9 +1748,37 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 1686 | } | 1748 | } |
| 1687 | 1749 | ||
| 1688 | draw_plot_box(ginfo, plot->pos, info.bstart, info.bend, | 1750 | draw_plot_box(ginfo, plot->pos, info.bstart, info.bend, |
| 1689 | info.bfill, plot->gc); | 1751 | info.bfill, info.bthin, info.blabel, plot->gc); |
| 1752 | } | ||
| 1753 | |||
| 1754 | if (info.release) { | ||
| 1755 | if (plot->last_color != 0) { | ||
| 1756 | plot->last_color = 0; | ||
| 1757 | set_color(ginfo->draw, plot->gc, plot->last_color); | ||
| 1758 | } | ||
| 1759 | draw_plot_release(ginfo, plot->pos, | ||
| 1760 | info.rtime, info.rlabel, plot->gc); | ||
| 1761 | } | ||
| 1762 | |||
| 1763 | if (info.deadline) { | ||
| 1764 | if (plot->last_color != 0) { | ||
| 1765 | plot->last_color = 0; | ||
| 1766 | set_color(ginfo->draw, plot->gc, plot->last_color); | ||
| 1767 | } | ||
| 1768 | draw_plot_deadline(ginfo, plot->pos, | ||
| 1769 | info.dtime, info.dlabel, plot->gc); | ||
| 1690 | } | 1770 | } |
| 1691 | 1771 | ||
| 1772 | if (info.completion) { | ||
| 1773 | if (plot->last_color != 0) { | ||
| 1774 | plot->last_color = 0; | ||
| 1775 | set_color(ginfo->draw, plot->gc, plot->last_color); | ||
| 1776 | } | ||
| 1777 | draw_plot_completion(ginfo, plot->pos, | ||
| 1778 | info.ctime, info.dlabel, plot->gc); | ||
| 1779 | } | ||
| 1780 | |||
| 1781 | |||
| 1692 | if (info.line) { | 1782 | if (info.line) { |
| 1693 | if (info.lcolor != plot->last_color) { | 1783 | if (info.lcolor != plot->last_color) { |
| 1694 | plot->last_color = info.lcolor; | 1784 | plot->last_color = info.lcolor; |
diff --git a/trace-plot.c b/trace-plot.c index 2fcd92f..2621034 100644 --- a/trace-plot.c +++ b/trace-plot.c | |||
| @@ -344,6 +344,14 @@ int trace_graph_plot_event(struct graph_info *ginfo, | |||
| 344 | info->box = FALSE; | 344 | info->box = FALSE; |
| 345 | info->bfill = TRUE; | 345 | info->bfill = TRUE; |
| 346 | 346 | ||
| 347 | info->blabel = NULL; | ||
| 348 | info->release = FALSE; | ||
| 349 | info->rlabel = NULL; | ||
| 350 | info->deadline = FALSE; | ||
| 351 | info->dlabel = NULL; | ||
| 352 | info->completion = FALSE; | ||
| 353 | info->clabel = NULL; | ||
| 354 | |||
| 347 | if (!plot->cb->plot_event) | 355 | if (!plot->cb->plot_event) |
| 348 | return 0; | 356 | return 0; |
| 349 | 357 | ||
