aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--trace-graph.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 6971ec5..d3c7b1f 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1708,11 +1708,15 @@ static void draw_info(struct graph_info *ginfo,
1708 1708
1709void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time) 1709void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1710{ 1710{
1711 struct record *record = NULL;
1712 GtkAdjustment *vadj;
1713 gint view_start;
1711 gint view_width; 1714 gint view_width;
1712 gint width; 1715 gint width;
1713 gint mid; 1716 gint mid;
1714 gint start; 1717 gint start;
1715 gint end; 1718 gint end;
1719 gint cpu;
1716 guint64 old_start_time = ginfo->view_start_time; 1720 guint64 old_start_time = ginfo->view_start_time;
1717 1721
1718 view_width = gtk_adjustment_get_page_size(ginfo->hadj); 1722 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
@@ -1759,6 +1763,41 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1759 ginfo->cursor = time; 1763 ginfo->cursor = time;
1760 1764
1761 update_with_backend(ginfo, 0, 0, width, ginfo->draw_height); 1765 update_with_backend(ginfo, 0, 0, width, ginfo->draw_height);
1766
1767 /*
1768 * If a record exists at this exact time value, we should
1769 * make sure that it is in view.
1770 */
1771 for (cpu = 0; cpu < ginfo->cpus; cpu++) {
1772 tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time);
1773 record = tracecmd_read_data(ginfo->handle, cpu);
1774 while (record && record->ts < time) {
1775 free_record(record);
1776 record = tracecmd_read_data(ginfo->handle, cpu);
1777 }
1778 if (record && record->ts == time)
1779 break;
1780 free_record(record);
1781 record = NULL;
1782 }
1783 free_record(record);
1784 if (cpu == ginfo->cpus)
1785 return;
1786
1787 /* Make sure CPU is visible */
1788 vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(ginfo->scrollwin));
1789 view_start = gtk_adjustment_get_value(vadj);
1790 view_width = gtk_adjustment_get_page_size(vadj);
1791
1792 if (CPU_TOP(cpu) > view_start &&
1793 CPU_BOTTOM(cpu) < view_start + view_width)
1794 return;
1795
1796 if (CPU_TOP(cpu) < view_start)
1797 gtk_adjustment_set_value(vadj, CPU_TOP(cpu) - 5);
1798
1799 if (CPU_BOTTOM(cpu) > view_start + view_width)
1800 gtk_adjustment_set_value(vadj, (CPU_BOTTOM(cpu) - view_width) + 10);
1762} 1801}
1763 1802
1764static void graph_free_systems(struct graph_info *ginfo) 1803static void graph_free_systems(struct graph_info *ginfo)