diff options
| author | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 14:27:14 -0500 |
|---|---|---|
| committer | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 14:27:14 -0500 |
| commit | ecf6f04712ac9d917bae11064ca10d86d4ab05cf (patch) | |
| tree | 58f51690253ad76f2752c2484073bd8260ae7d46 | |
| parent | 0164fce222ab4582bf9a61cdcb0ee5e87af018d6 (diff) | |
rt-graph: real-time task labels
| -rw-r--r-- | rt-plot-task.c | 19 | ||||
| -rw-r--r-- | trace-graph.c | 48 | ||||
| -rw-r--r-- | trace-graph.h | 3 | ||||
| -rw-r--r-- | trace-plot.c | 4 |
4 files changed, 43 insertions, 31 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c index b6d794d..557bfff 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
| @@ -298,11 +298,9 @@ static int try_release(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
| 298 | update_job(rtt_info, job); | 298 | update_job(rtt_info, job); |
| 299 | info->release = TRUE; | 299 | info->release = TRUE; |
| 300 | info->rtime = release; | 300 | info->rtime = release; |
| 301 | info->rlabel = rtt_info->label; | ||
| 302 | 301 | ||
| 303 | info->deadline = TRUE; | 302 | info->deadline = TRUE; |
| 304 | info->dtime = deadline; | 303 | info->dtime = deadline; |
| 305 | info->dlabel = rtt_info->label; | ||
| 306 | 304 | ||
| 307 | if (job <= 3) | 305 | if (job <= 3) |
| 308 | rtt_info->first_rels[job - 1] = release; | 306 | rtt_info->first_rels[job - 1] = release; |
| @@ -328,7 +326,6 @@ static int try_completion(struct graph_info *ginfo, | |||
| 328 | update_job(rtt_info, job); | 326 | update_job(rtt_info, job); |
| 329 | info->completion = TRUE; | 327 | info->completion = TRUE; |
| 330 | info->ctime = ts; | 328 | info->ctime = ts; |
| 331 | info->clabel = rtt_info->label; | ||
| 332 | dprintf(3, "Completion for %d:%d on %d at %llu\n", | 329 | dprintf(3, "Completion for %d:%d on %d at %llu\n", |
| 333 | pid, job, record->cpu, ts); | 330 | pid, job, record->cpu, ts); |
| 334 | ret = 1; | 331 | ret = 1; |
| @@ -627,35 +624,37 @@ static int rt_task_plot_display_info(struct graph_info *ginfo, | |||
| 627 | &job, &release, &deadline, &record); | 624 | &job, &release, &deadline, &record); |
| 628 | restore_offsets(ginfo, offsets); | 625 | restore_offsets(ginfo, offsets); |
| 629 | 626 | ||
| 630 | /* Show real-time data about time */ | ||
| 631 | pid = rtt_info->pid; | 627 | pid = rtt_info->pid; |
| 632 | comm = pevent_data_comm_from_pid(ginfo->pevent, pid); | 628 | comm = pevent_data_comm_from_pid(ginfo->pevent, pid); |
| 633 | trace_seq_printf(s, "%s - %d:%d\n", comm, pid, job); | 629 | trace_seq_printf(s, "%s-%d:%d\n", comm, pid, job); |
| 634 | 630 | ||
| 635 | if (record) { | 631 | if (record) { |
| 636 | rts = get_rts(ginfo, record); | 632 | rts = get_rts(ginfo, record); |
| 637 | eid = pevent_data_type(ginfo->pevent, record); | 633 | eid = pevent_data_type(ginfo->pevent, record); |
| 638 | 634 | ||
| 639 | if (in_res(ginfo, deadline, time)) { | 635 | if (in_res(ginfo, deadline, time)) { |
| 640 | trace_seq_printf(s, "litmus_deadline for %d:%d at %llu\n", | 636 | trace_seq_printf(s, "\nlitmus_deadline\n" |
| 637 | "deadline(job(%d,%d)): %llu\n", | ||
| 641 | pid, job, deadline); | 638 | pid, job, deadline); |
| 642 | } | 639 | } |
| 643 | if (in_res(ginfo, release, time)) { | 640 | if (in_res(ginfo, release, time)) { |
| 644 | trace_seq_printf(s, "litmus_release for %d:%d at %llu\n", | 641 | trace_seq_printf(s, "\nlitmus_release\n" |
| 642 | "release(job(%d,%d)): %llu\n", | ||
| 645 | pid, job, release); | 643 | pid, job, release); |
| 646 | } | 644 | } |
| 647 | 645 | ||
| 648 | if (in_res(ginfo, rts, time)) { | 646 | if (in_res(ginfo, rts, time)) { |
| 649 | event = pevent_data_event_from_type(ginfo->pevent, eid); | 647 | event = pevent_data_event_from_type(ginfo->pevent, eid); |
| 650 | if (event) { | 648 | if (event) { |
| 649 | trace_seq_putc(s, '\n'); | ||
| 651 | trace_seq_puts(s, event->name); | 650 | trace_seq_puts(s, event->name); |
| 652 | trace_seq_putc(s, '\n'); | 651 | trace_seq_putc(s, '\n'); |
| 653 | pevent_event_info(s, event, record); | 652 | pevent_event_info(s, event, record); |
| 654 | trace_seq_putc(s, '\n'); | ||
| 655 | } else | 653 | } else |
| 656 | trace_seq_printf(s, "UNKNOWN EVENT %d\n", eid); | 654 | trace_seq_printf(s, "\nUNKNOWN EVENT %d\n", eid); |
| 657 | } | 655 | } |
| 658 | convert_nano(get_rts(ginfo, record), &sec, &usec); | 656 | trace_seq_putc(s, '\n'); |
| 657 | convert_nano(time, &sec, &usec); | ||
| 659 | trace_seq_printf(s, "%lu.%06lu CPU: %03d", | 658 | trace_seq_printf(s, "%lu.%06lu CPU: %03d", |
| 660 | sec, usec, record->cpu); | 659 | sec, usec, record->cpu); |
| 661 | free_record(record); | 660 | free_record(record); |
diff --git a/trace-graph.c b/trace-graph.c index 10e1d65..f63c202 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -1638,16 +1638,36 @@ static gint draw_plot_line(struct graph_info *ginfo, int i, | |||
| 1638 | return x; | 1638 | return x; |
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | static void draw_plot_label(struct graph_info *ginfo, char *label, | ||
| 1642 | gint x, gint y, gint max_width) | ||
| 1643 | { | ||
| 1644 | PangoLayout *layout; | ||
| 1645 | gint text_width, text_height; | ||
| 1646 | static PangoFontDescription *font = NULL; | ||
| 1647 | |||
| 1648 | if (!font) { | ||
| 1649 | font = pango_font_description_from_string("Sans 6"); | ||
| 1650 | } | ||
| 1651 | |||
| 1652 | layout = gtk_widget_create_pango_layout(ginfo->draw, label); | ||
| 1653 | pango_layout_set_font_description(layout, font); | ||
| 1654 | pango_layout_get_pixel_size(layout, &text_width, &text_height); | ||
| 1655 | |||
| 1656 | if (text_width <= max_width) { | ||
| 1657 | gdk_draw_layout(ginfo->curr_pixmap, | ||
| 1658 | ginfo->draw->style->black_gc, | ||
| 1659 | x, y, layout); | ||
| 1660 | } | ||
| 1661 | g_object_unref(layout); | ||
| 1662 | } | ||
| 1663 | |||
| 1641 | static void draw_plot_box(struct graph_info *ginfo, int i, | 1664 | static void draw_plot_box(struct graph_info *ginfo, int i, |
| 1642 | unsigned long long start, | 1665 | unsigned long long start, |
| 1643 | unsigned long long end, | 1666 | unsigned long long end, |
| 1644 | gboolean fill, gboolean thin, | 1667 | gboolean fill, gboolean thin, |
| 1645 | char *label, GdkGC *gc) | 1668 | char *label, GdkGC *gc) |
| 1646 | { | 1669 | { |
| 1647 | gint x1; | 1670 | gint x1, x2, y, size; |
| 1648 | gint x2; | ||
| 1649 | gint y; | ||
| 1650 | gint size; | ||
| 1651 | 1671 | ||
| 1652 | x1 = convert_time_to_x(ginfo, start); | 1672 | x1 = convert_time_to_x(ginfo, start); |
| 1653 | x2 = convert_time_to_x(ginfo, end); | 1673 | x2 = convert_time_to_x(ginfo, end); |
| @@ -1659,10 +1679,12 @@ static void draw_plot_box(struct graph_info *ginfo, int i, | |||
| 1659 | fill, | 1679 | fill, |
| 1660 | x1, y, | 1680 | x1, y, |
| 1661 | x2 - x1, size); | 1681 | x2 - x1, size); |
| 1682 | if (label) | ||
| 1683 | draw_plot_label(ginfo, label, x1 + 1, y + 1, x2 - x1 - 2); | ||
| 1662 | } | 1684 | } |
| 1663 | 1685 | ||
| 1664 | static void draw_plot_release(struct graph_info *ginfo, int i, | 1686 | static void draw_plot_release(struct graph_info *ginfo, int i, |
| 1665 | unsigned long long time, char *label, GdkGC *gc) | 1687 | unsigned long long time, GdkGC *gc) |
| 1666 | { | 1688 | { |
| 1667 | 1689 | ||
| 1668 | int tbase = PLOT_TOP(i) + PLOT_TRI_SIZE; | 1690 | int tbase = PLOT_TOP(i) + PLOT_TRI_SIZE; |
| @@ -1681,7 +1703,7 @@ static void draw_plot_release(struct graph_info *ginfo, int i, | |||
| 1681 | } | 1703 | } |
| 1682 | 1704 | ||
| 1683 | static void draw_plot_deadline(struct graph_info *ginfo, int i, | 1705 | static void draw_plot_deadline(struct graph_info *ginfo, int i, |
| 1684 | unsigned long long time, char *label, GdkGC *gc) | 1706 | unsigned long long time, GdkGC *gc) |
| 1685 | { | 1707 | { |
| 1686 | int tbase = PLOT_BOX_BOTTOM(i); | 1708 | int tbase = PLOT_BOX_BOTTOM(i); |
| 1687 | int x = convert_time_to_x(ginfo, time); | 1709 | int x = convert_time_to_x(ginfo, time); |
| @@ -1699,8 +1721,7 @@ static void draw_plot_deadline(struct graph_info *ginfo, int i, | |||
| 1699 | } | 1721 | } |
| 1700 | 1722 | ||
| 1701 | static void draw_plot_completion(struct graph_info *ginfo, int i, | 1723 | static void draw_plot_completion(struct graph_info *ginfo, int i, |
| 1702 | unsigned long long time, char *label, | 1724 | unsigned long long time, GdkGC *gc) |
| 1703 | GdkGC *gc) | ||
| 1704 | { | 1725 | { |
| 1705 | int tbase = PLOT_BOX_BOTTOM(i) + PLOT_BTRI_SIZE; | 1726 | int tbase = PLOT_BOX_BOTTOM(i) + PLOT_BTRI_SIZE; |
| 1706 | int x = convert_time_to_x(ginfo, time); | 1727 | int x = convert_time_to_x(ginfo, time); |
| @@ -1748,7 +1769,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 1748 | } | 1769 | } |
| 1749 | 1770 | ||
| 1750 | draw_plot_box(ginfo, plot->pos, info.bstart, info.bend, | 1771 | draw_plot_box(ginfo, plot->pos, info.bstart, info.bend, |
| 1751 | info.bfill, info.bthin, info.blabel, plot->gc); | 1772 | info.bfill, info.bthin, info.blabel, plot->gc); |
| 1752 | } | 1773 | } |
| 1753 | 1774 | ||
| 1754 | if (info.release) { | 1775 | if (info.release) { |
| @@ -1756,8 +1777,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 1756 | plot->last_color = 0; | 1777 | plot->last_color = 0; |
| 1757 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1778 | set_color(ginfo->draw, plot->gc, plot->last_color); |
| 1758 | } | 1779 | } |
| 1759 | draw_plot_release(ginfo, plot->pos, | 1780 | draw_plot_release(ginfo, plot->pos, info.rtime, plot->gc); |
| 1760 | info.rtime, info.rlabel, plot->gc); | ||
| 1761 | } | 1781 | } |
| 1762 | 1782 | ||
| 1763 | if (info.deadline) { | 1783 | if (info.deadline) { |
| @@ -1765,8 +1785,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 1765 | plot->last_color = 0; | 1785 | plot->last_color = 0; |
| 1766 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1786 | set_color(ginfo->draw, plot->gc, plot->last_color); |
| 1767 | } | 1787 | } |
| 1768 | draw_plot_deadline(ginfo, plot->pos, | 1788 | draw_plot_deadline(ginfo, plot->pos, info.dtime, plot->gc); |
| 1769 | info.dtime, info.dlabel, plot->gc); | ||
| 1770 | } | 1789 | } |
| 1771 | 1790 | ||
| 1772 | if (info.completion) { | 1791 | if (info.completion) { |
| @@ -1774,8 +1793,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 1774 | plot->last_color = 0; | 1793 | plot->last_color = 0; |
| 1775 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1794 | set_color(ginfo->draw, plot->gc, plot->last_color); |
| 1776 | } | 1795 | } |
| 1777 | draw_plot_completion(ginfo, plot->pos, | 1796 | draw_plot_completion(ginfo, plot->pos, info.ctime, plot->gc); |
| 1778 | info.ctime, info.dlabel, plot->gc); | ||
| 1779 | } | 1797 | } |
| 1780 | 1798 | ||
| 1781 | 1799 | ||
diff --git a/trace-graph.h b/trace-graph.h index 788c77d..5d7c247 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
| @@ -61,15 +61,12 @@ struct plot_info { | |||
| 61 | 61 | ||
| 62 | gboolean release; | 62 | gboolean release; |
| 63 | unsigned long long rtime; | 63 | unsigned long long rtime; |
| 64 | char *rlabel; | ||
| 65 | 64 | ||
| 66 | gboolean deadline; | 65 | gboolean deadline; |
| 67 | unsigned long long dtime; | 66 | unsigned long long dtime; |
| 68 | char *dlabel; | ||
| 69 | 67 | ||
| 70 | gboolean completion; | 68 | gboolean completion; |
| 71 | unsigned long long ctime; | 69 | unsigned long long ctime; |
| 72 | char *clabel; | ||
| 73 | }; | 70 | }; |
| 74 | 71 | ||
| 75 | /* | 72 | /* |
diff --git a/trace-plot.c b/trace-plot.c index 2621034..e459969 100644 --- a/trace-plot.c +++ b/trace-plot.c | |||
| @@ -345,12 +345,10 @@ int trace_graph_plot_event(struct graph_info *ginfo, | |||
| 345 | info->bfill = TRUE; | 345 | info->bfill = TRUE; |
| 346 | 346 | ||
| 347 | info->blabel = NULL; | 347 | info->blabel = NULL; |
| 348 | info->bthin = FALSE; | ||
| 348 | info->release = FALSE; | 349 | info->release = FALSE; |
| 349 | info->rlabel = NULL; | ||
| 350 | info->deadline = FALSE; | 350 | info->deadline = FALSE; |
| 351 | info->dlabel = NULL; | ||
| 352 | info->completion = FALSE; | 351 | info->completion = FALSE; |
| 353 | info->clabel = NULL; | ||
| 354 | 352 | ||
| 355 | if (!plot->cb->plot_event) | 353 | if (!plot->cb->plot_event) |
| 356 | return 0; | 354 | return 0; |
