diff options
Diffstat (limited to 'trace-graph.c')
-rw-r--r-- | trace-graph.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/trace-graph.c b/trace-graph.c index 42a0b27..76420d6 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #define PLOT_GIVE 2 | 55 | #define PLOT_GIVE 2 |
56 | #define PLOT_BEGIN 80 | 56 | #define PLOT_BEGIN 80 |
57 | #define PLOT_SEP 50 | 57 | #define PLOT_SEP 50 |
58 | #define MAX_TRI_TIME 50000000 | 58 | #define MAX_TRI_TIME 20000000 |
59 | #define PLOT_LINE(plot) (PLOT_SEP * (plot) + PLOT_BEGIN + PLOT_SIZE) | 59 | #define PLOT_LINE(plot) (PLOT_SEP * (plot) + PLOT_BEGIN + PLOT_SIZE) |
60 | #define PLOT_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE * 2) | 60 | #define PLOT_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE * 2) |
61 | #define PLOT_BOX_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE) | 61 | #define PLOT_BOX_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE) |
@@ -92,6 +92,12 @@ static int convert_dist_to_time(struct graph_info *ginfo, int dist) | |||
92 | return convert_x_to_time(ginfo, dist) - convert_x_to_time(ginfo, 0); | 92 | return convert_x_to_time(ginfo, dist) - convert_x_to_time(ginfo, 0); |
93 | } | 93 | } |
94 | 94 | ||
95 | static int is_high_res(struct graph_info *ginfo) | ||
96 | { | ||
97 | return convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME; | ||
98 | } | ||
99 | |||
100 | |||
95 | static void print_time(unsigned long long time) | 101 | static void print_time(unsigned long long time) |
96 | { | 102 | { |
97 | unsigned long sec, usec; | 103 | unsigned long sec, usec; |
@@ -126,7 +132,6 @@ static void init_event_cache(struct graph_info *ginfo) | |||
126 | * it into the pevent command line list. | 132 | * it into the pevent command line list. |
127 | */ | 133 | */ |
128 | ginfo->read_comms = TRUE; | 134 | ginfo->read_comms = TRUE; |
129 | |||
130 | init_rt_event_cache(&ginfo->rtg_info); | 135 | init_rt_event_cache(&ginfo->rtg_info); |
131 | } | 136 | } |
132 | 137 | ||
@@ -1642,7 +1647,7 @@ static gint draw_plot_line(struct graph_info *ginfo, int i, | |||
1642 | /* y = (small) ? PLOT_BOX_TOP(i) : PLOT_TOP(i); */ | 1647 | /* y = (small) ? PLOT_BOX_TOP(i) : PLOT_TOP(i); */ |
1643 | y = PLOT_TOP(i); | 1648 | y = PLOT_TOP(i); |
1644 | 1649 | ||
1645 | if (!small || convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) { | 1650 | if (!small || is_high_res(ginfo)) { |
1646 | gdk_draw_line(ginfo->curr_pixmap, gc, | 1651 | gdk_draw_line(ginfo->curr_pixmap, gc, |
1647 | x, y, x, PLOT_BOTTOM(i)); | 1652 | x, y, x, PLOT_BOTTOM(i)); |
1648 | } | 1653 | } |
@@ -1691,6 +1696,14 @@ static void draw_plot_box(struct graph_info *ginfo, int i, | |||
1691 | fill, | 1696 | fill, |
1692 | x1, y, | 1697 | x1, y, |
1693 | x2 - x1, size); | 1698 | x2 - x1, size); |
1699 | if (is_high_res(ginfo)) { | ||
1700 | gdk_draw_rectangle(ginfo->curr_pixmap, | ||
1701 | ginfo->draw->style->black_gc, | ||
1702 | FALSE, | ||
1703 | x1, y, | ||
1704 | x2 - x1, size); | ||
1705 | } | ||
1706 | |||
1694 | if (label) | 1707 | if (label) |
1695 | draw_plot_label(ginfo, label, x1 + 1, y + 1, x2 - x1 - 2); | 1708 | draw_plot_label(ginfo, label, x1 + 1, y + 1, x2 - x1 - 2); |
1696 | } | 1709 | } |
@@ -1709,11 +1722,9 @@ static void draw_plot_release(struct graph_info *ginfo, int i, | |||
1709 | tpoints[2].x = x + PLOT_TRI_SIZE/2; | 1722 | tpoints[2].x = x + PLOT_TRI_SIZE/2; |
1710 | tpoints[2].y = tbase; | 1723 | tpoints[2].y = tbase; |
1711 | 1724 | ||
1712 | if (convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) { | 1725 | gdk_draw_line(ginfo->curr_pixmap, gc, |
1713 | gdk_draw_line(ginfo->curr_pixmap, gc, | 1726 | x, tbase, x, PLOT_BOX_BOTTOM(i)); |
1714 | x, tbase, x, PLOT_BOX_BOTTOM(i)); | 1727 | gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3); |
1715 | gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3); | ||
1716 | } | ||
1717 | } | 1728 | } |
1718 | 1729 | ||
1719 | static void draw_plot_deadline(struct graph_info *ginfo, int i, | 1730 | static void draw_plot_deadline(struct graph_info *ginfo, int i, |
@@ -1729,11 +1740,9 @@ static void draw_plot_deadline(struct graph_info *ginfo, int i, | |||
1729 | tpoints[2].x = x + PLOT_TRI_SIZE/2; | 1740 | tpoints[2].x = x + PLOT_TRI_SIZE/2; |
1730 | tpoints[2].y = tbase; | 1741 | tpoints[2].y = tbase; |
1731 | 1742 | ||
1732 | if (convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) { | 1743 | gdk_draw_line(ginfo->curr_pixmap, gc, |
1733 | gdk_draw_line(ginfo->curr_pixmap, gc, | 1744 | x, PLOT_BOX_TOP(i), x, tbase); |
1734 | x, PLOT_BOX_TOP(i), x, tbase); | 1745 | gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3); |
1735 | gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3); | ||
1736 | } | ||
1737 | } | 1746 | } |
1738 | 1747 | ||
1739 | static void draw_plot_completion(struct graph_info *ginfo, int i, | 1748 | static void draw_plot_completion(struct graph_info *ginfo, int i, |
@@ -1749,9 +1758,7 @@ static void draw_plot_completion(struct graph_info *ginfo, int i, | |||
1749 | tpoints[2].x = x + PLOT_BTRI_SIZE/2; | 1758 | tpoints[2].x = x + PLOT_BTRI_SIZE/2; |
1750 | tpoints[2].y = tbase; | 1759 | tpoints[2].y = tbase; |
1751 | 1760 | ||
1752 | if (convert_dist_to_time(ginfo, PLOT_BTRI_SIZE) < MAX_TRI_TIME) { | 1761 | gdk_draw_polygon(ginfo->curr_pixmap, gc, TRUE, tpoints, 3); |
1753 | gdk_draw_polygon(ginfo->curr_pixmap, gc, TRUE, tpoints, 3); | ||
1754 | } | ||
1755 | } | 1762 | } |
1756 | 1763 | ||
1757 | static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | 1764 | static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, |
@@ -1790,7 +1797,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
1790 | info.bfill, info.bthin, info.blabel, plot->gc); | 1797 | info.bfill, info.bthin, info.blabel, plot->gc); |
1791 | } | 1798 | } |
1792 | 1799 | ||
1793 | if (info.release) { | 1800 | if (info.release && is_high_res(ginfo)) { |
1794 | if (plot->last_color != 0) { | 1801 | if (plot->last_color != 0) { |
1795 | plot->last_color = 0; | 1802 | plot->last_color = 0; |
1796 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1803 | set_color(ginfo->draw, plot->gc, plot->last_color); |
@@ -1798,7 +1805,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
1798 | draw_plot_release(ginfo, plot->pos, info.rtime, plot->gc); | 1805 | draw_plot_release(ginfo, plot->pos, info.rtime, plot->gc); |
1799 | } | 1806 | } |
1800 | 1807 | ||
1801 | if (info.deadline) { | 1808 | if (info.deadline && is_high_res(ginfo)) { |
1802 | if (plot->last_color != 0) { | 1809 | if (plot->last_color != 0) { |
1803 | plot->last_color = 0; | 1810 | plot->last_color = 0; |
1804 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1811 | set_color(ginfo->draw, plot->gc, plot->last_color); |
@@ -1806,7 +1813,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
1806 | draw_plot_deadline(ginfo, plot->pos, info.dtime, plot->gc); | 1813 | draw_plot_deadline(ginfo, plot->pos, info.dtime, plot->gc); |
1807 | } | 1814 | } |
1808 | 1815 | ||
1809 | if (info.completion) { | 1816 | if (info.completion && is_high_res(ginfo)) { |
1810 | if (plot->last_color != 0) { | 1817 | if (plot->last_color != 0) { |
1811 | plot->last_color = 0; | 1818 | plot->last_color = 0; |
1812 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1819 | set_color(ginfo->draw, plot->gc, plot->last_color); |
@@ -1924,8 +1931,6 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
1924 | gint cpu; | 1931 | gint cpu; |
1925 | gint i; | 1932 | gint i; |
1926 | 1933 | ||
1927 | printf("----Drawing plots----\n"); | ||
1928 | |||
1929 | /* Initialize plots */ | 1934 | /* Initialize plots */ |
1930 | for (i = 0; i < ginfo->plots; i++) { | 1935 | for (i = 0; i < ginfo->plots; i++) { |
1931 | plot = ginfo->plot_array[i]; | 1936 | plot = ginfo->plot_array[i]; |
@@ -2502,7 +2507,7 @@ static int load_handle(struct graph_info *ginfo, | |||
2502 | ginfo->start_time = -1ULL; | 2507 | ginfo->start_time = -1ULL; |
2503 | ginfo->end_time = 0; | 2508 | ginfo->end_time = 0; |
2504 | 2509 | ||
2505 | graph_plot_init_cpus(ginfo, ginfo->cpus); | 2510 | rt_plot_init_cpus(ginfo, ginfo->cpus); |
2506 | 2511 | ||
2507 | ginfo->draw_height = PLOT_SPACE(ginfo->plots); | 2512 | ginfo->draw_height = PLOT_SPACE(ginfo->plots); |
2508 | 2513 | ||
@@ -2549,7 +2554,6 @@ void trace_graph_refresh(struct graph_info *ginfo) | |||
2549 | ginfo->draw_height = PLOT_SPACE(ginfo->plots); | 2554 | ginfo->draw_height = PLOT_SPACE(ginfo->plots); |
2550 | gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height); | 2555 | gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height); |
2551 | update_label_window(ginfo); | 2556 | update_label_window(ginfo); |
2552 | printf("----Redrawing graph----\n"); | ||
2553 | redraw_graph(ginfo); | 2557 | redraw_graph(ginfo); |
2554 | } | 2558 | } |
2555 | 2559 | ||