[sysprof/wip/visualizers] visualizer-view: shrink time range when necessary



commit 7831b767d017edf9396e1f4ff006a6b4a6e000c2
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 28 14:10:29 2016 -0700

    visualizer-view: shrink time range when necessary
    
    If we don't have a minute worth of input, we should shrink the
    visible area to exactly what we came across.
    
    We still have the issue of the UI creating the capture file
    before auth has completed, but we can fix that later so we
    have a "semantically" correct start time.

 lib/sp-visualizer-view.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/lib/sp-visualizer-view.c b/lib/sp-visualizer-view.c
index 4284a6a..ec53892 100644
--- a/lib/sp-visualizer-view.c
+++ b/lib/sp-visualizer-view.c
@@ -218,8 +218,18 @@ sp_visualizer_view_set_reader (SpVisualizerView *self,
 
   if (reader != NULL)
     {
+      gint64 real_end_time;
+
       begin_time = sp_capture_reader_get_start_time (reader);
+      real_end_time = sp_capture_reader_get_end_time (reader);
+
       end_time = begin_time + (G_GINT64_CONSTANT (1000000000) * 60);
+
+      /* If we were able to extract a proper end time and its less
+       * than 60 seconds, we will use the whole width to show that.
+       */
+      if (real_end_time > 0 && real_end_time < end_time)
+        end_time = real_end_time;
     }
 
   sp_visualizer_list_set_reader (priv->list, reader);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]