aboutsummaryrefslogtreecommitdiffstats
path: root/trace-graph.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-05 12:10:14 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-08 13:11:03 -0500
commit38e4c3fb1424da4b4a6eebe808108907fc31a43b (patch)
treed6284f191d0656ea6ce294c650008744ba450ea0 /trace-graph.c
parentd5b2f5b5fe8a167bc42bbd25fe99055e0873b8a5 (diff)
trace-graph: Move adjusting of graph to plot code
Make the adjustment of the graph into a plot callback. That is, start from the first plot and work down to see if the plot has an exact match and should be displayed in the graph viewable area (adjust scrollbar). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-graph.c')
-rw-r--r--trace-graph.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/trace-graph.c b/trace-graph.c
index c16f313..7eaf506 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1721,7 +1721,6 @@ static void draw_info(struct graph_info *ginfo,
1721 1721
1722void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time) 1722void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1723{ 1723{
1724 struct record *record = NULL;
1725 GtkAdjustment *vadj; 1724 GtkAdjustment *vadj;
1726 gint view_start; 1725 gint view_start;
1727 gint view_width; 1726 gint view_width;
@@ -1729,7 +1728,8 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1729 gint mid; 1728 gint mid;
1730 gint start; 1729 gint start;
1731 gint end; 1730 gint end;
1732 gint cpu; 1731 int ret;
1732 gint i;
1733 guint64 old_start_time = ginfo->view_start_time; 1733 guint64 old_start_time = ginfo->view_start_time;
1734 1734
1735 view_width = gtk_adjustment_get_page_size(ginfo->hadj); 1735 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
@@ -1780,20 +1780,13 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1780 * If a record exists at this exact time value, we should 1780 * If a record exists at this exact time value, we should
1781 * make sure that it is in view. 1781 * make sure that it is in view.
1782 */ 1782 */
1783 for (cpu = 0; cpu < ginfo->cpus; cpu++) { 1783 for (i = 0; i < ginfo->plots; i++) {
1784 tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); 1784 ret = trace_graph_plot_match_time(ginfo, ginfo->plot_array[i],
1785 record = tracecmd_read_data(ginfo->handle, cpu); 1785 time);
1786 while (record && record->ts < time) { 1786 if (ret)
1787 free_record(record);
1788 record = tracecmd_read_data(ginfo->handle, cpu);
1789 }
1790 if (record && record->ts == time)
1791 break; 1787 break;
1792 free_record(record);
1793 record = NULL;
1794 } 1788 }
1795 free_record(record); 1789 if (i == ginfo->plots)
1796 if (cpu == ginfo->cpus)
1797 return; 1790 return;
1798 1791
1799 /* Make sure PLOT is visible */ 1792 /* Make sure PLOT is visible */
@@ -1801,15 +1794,15 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1801 view_start = gtk_adjustment_get_value(vadj); 1794 view_start = gtk_adjustment_get_value(vadj);
1802 view_width = gtk_adjustment_get_page_size(vadj); 1795 view_width = gtk_adjustment_get_page_size(vadj);
1803 1796
1804 if (PLOT_TOP(cpu) > view_start && 1797 if (PLOT_TOP(i) > view_start &&
1805 PLOT_BOTTOM(cpu) < view_start + view_width) 1798 PLOT_BOTTOM(i) < view_start + view_width)
1806 return; 1799 return;
1807 1800
1808 if (PLOT_TOP(cpu) < view_start) 1801 if (PLOT_TOP(i) < view_start)
1809 gtk_adjustment_set_value(vadj, PLOT_TOP(cpu) - 5); 1802 gtk_adjustment_set_value(vadj, PLOT_TOP(i) - 5);
1810 1803
1811 if (PLOT_BOTTOM(cpu) > view_start + view_width) 1804 if (PLOT_BOTTOM(i) > view_start + view_width)
1812 gtk_adjustment_set_value(vadj, (PLOT_BOTTOM(cpu) - view_width) + 10); 1805 gtk_adjustment_set_value(vadj, (PLOT_BOTTOM(i) - view_width) + 10);
1813} 1806}
1814 1807
1815static void graph_free_systems(struct graph_info *ginfo) 1808static void graph_free_systems(struct graph_info *ginfo)