aboutsummaryrefslogtreecommitdiffstats
path: root/trace-graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-graph.c')
-rw-r--r--trace-graph.c98
1 files changed, 94 insertions, 4 deletions
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,
1639static void draw_plot_box(struct graph_info *ginfo, int i, 1641static 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
1664static 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
1683static 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
1701static 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
1656static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, 1718static 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;