make precision correct when calling conversion between LttTime and double, fix viewer...
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 5 Aug 2004 00:56:06 +0000 (00:56 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 5 Aug 2004 00:56:06 +0000 (00:56 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@663 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/doc/developer/lttvwindow_events_delivery.txt
ltt/branches/poly/doc/developer/requests_servicing_schedulers.txt
ltt/branches/poly/ltt/time.h
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/text/textDump.c

index a3a785f5f5a563bd561fb51ec47c0a476a5f94cd..c52b6a3a9d47ab866be3cb624472df90716a01ec 100644 (file)
@@ -308,7 +308,10 @@ list_in : empty
 list_out : many events requests
 
 
-A. While (list_in !empty or list_out !empty) and !GTK Event pending
+0.1 Lock the traces
+0.2 Seek traces positions to current context position.
+
+A. While (list_in !empty or list_out !empty)
   1. If list_in is empty (need a seek)
     1.1 Add requests to list_in
       1.1.1 Find all time requests with lowest start time in list_out (ltime)
@@ -331,6 +334,9 @@ A. While (list_in !empty or list_out !empty) and !GTK Event pending
       1.3.2 call before chunk
       1.3.3 events hooks added
   2. Else, list_in is not empty, we continue a read
+    2.0 For each req of list_in
+      - Call before chunk
+      - events hooks added
     2.1 For each req of list_out
     - if req.start time == current context time
               or req.start position == current position
@@ -372,13 +378,14 @@ A. While (list_in !empty or list_out !empty) and !GTK Event pending
           - req.num -= count
           - if   req.num == 0
                or
-                 current context time > req.end time
+                 current context time >= req.end time
                or
                  req.end pos == current pos
                or
                  req.stop_flag == TRUE
             - Call end request for req
             - remove req from list_in
+  If GTK Event pending : break A loop
 
 B. When interrupted between chunks
   1. for each request in list_in
@@ -386,6 +393,8 @@ B. When interrupted between chunks
     1.2. Remove start time
     1.3. Move from list_in to list_out
 
+C. Unlock the traces
+
 
 
 Notes :
index 6919923b4c3dd8e90af4cdb2ea8f5803b4120bed..beaca69998bf1a1c318c68111358b718769a9dd0 100644 (file)
@@ -219,11 +219,19 @@ computation/      /* Global background computation hooks */
     after_request
     event_hook
     event_hook_by_id
+    hook_adder
+    hook_remover
   stats/
     ...
   modulename1/
     ...
 
+Hook Adder and Hook remover
+
+Hook functions that takes a trace context as call data. They simply 
+add / remove the computation related hooks from the trace context.
+
+
 
 Modify Traceset
 Points to the global traces. Main window must open a new one only when no
@@ -270,16 +278,20 @@ notify_in : currently checked notifications
 notify_out : queue of notifications that comes along with next processing.
 
 
+0.1 Lock traces
+0.2 Sync tracefiles
+
 1. Before processing
   - if list_in is empty
     - Add all requests in list_out to list_in, empty list_out
     - for each request in list_in
       - set hooks'in_progress flag to TRUE
+      - call before request hook
     - seek trace to start
     - Move all notifications from notify_out to notify_in.
   - for each request in list_in
     - Call before chunk hooks for list_in
-    - add hooks to context
+    - add hooks to context *note only one hook of each type added.
 
 2. call process traceset middle for a chunk
   (assert list_in is not empty! : should not even be called in that case)
@@ -288,7 +300,7 @@ notify_out : queue of notifications that comes along with next processing.
   3.1 call after_chunk hooks for list_in
     - for each request in list_in
       - Call after chunk hooks for list_in
-      - remove hooks from context
+      - remove hooks from context *note : only one hook of each type
   3.2 for each notify_in
     - if current time >= notify time, call notify and remove from notify_in
     - if current position >= notify position, call notify and remove from
@@ -297,10 +309,16 @@ notify_out : queue of notifications that comes along with next processing.
     - for each request in list_in
       - set hooks'in_progress flag to FALSE
       - set hooks'ready flag to TRUE
+      - call after request hook
       - remove request
     - for each notifications in notify_in
       - call notify and remove from notify_in
-    - return FALSE (scheduler stopped)
+    - reset the context
+    - if list_out is empty
+      return FALSE (scheduler stopped)
+    - else
+      return TRUE (scheduler still registered)
   3.4 else
     - return TRUE (scheduler still registered)
 
+4. Unlock traces
index a095895a9b37b1033ad198eb203323389700929d..d961f3738ac0eb110c5248722edc07061c7358b0 100644 (file)
@@ -121,6 +121,7 @@ static inline double ltt_time_to_double(LttTime t1)
    *
    * So we have 53-30 = 23 bits left for tv_sec.
    * */
+  g_assert(t1.tv_sec <= MAX_TV_SEC_TO_DOUBLE);
   if(t1.tv_sec > MAX_TV_SEC_TO_DOUBLE)
     g_warning("Precision loss in conversion LttTime to double");
   return (double)t1.tv_sec + (double)t1.tv_nsec / NANOSECONDS_PER_SECOND;
@@ -137,6 +138,7 @@ static inline LttTime ltt_time_from_double(double t1)
    *
    * So we have 53-30 = 23 bits left for tv_sec.
    * */
+  g_assert(t1 <= MAX_TV_SEC_TO_DOUBLE);
   if(t1 > MAX_TV_SEC_TO_DOUBLE)
     g_warning("Conversion from non precise double to LttTime");
   LttTime res;
index d9d4a03d48f7c4c490db7102a5256eec83c96776..2cd92c2eedafc3d4e36499b9b8310b8912171cc4 100644 (file)
@@ -402,14 +402,7 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
   LttTime window_end = ltt_time_add(time_window.time_width,
                                     time_window.start_time);
 
-  convert_time_to_pixels(
-        time_window.start_time,
-        window_end,
-        current_time,
-        drawing->width,
-        &cursor_x);
 
   /* update the screen from the pixmap buffer */
   gdk_draw_pixmap(widget->window,
       widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
@@ -418,30 +411,41 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
       event->area.x, event->area.y,
       event->area.width, event->area.height);
 
+  
+  if(ltt_time_compare(time_window.start_time, current_time) <= 0 &&
+           ltt_time_compare(window_end, current_time) >= 0)
+  {
+    /* Draw the dotted lines */
+    convert_time_to_pixels(
+          time_window.start_time,
+          window_end,
+          current_time,
+          drawing->width,
+          &cursor_x);
+
 
-  /* Draw the dotted lines */
+    if(drawing->dotted_gc == NULL) {
 
-  if(drawing->dotted_gc == NULL) {
+      drawing->dotted_gc = gdk_gc_new(drawing->drawing_area->window);
+      gdk_gc_copy(drawing->dotted_gc, widget->style->white_gc);
+   
+      gint8 dash_list[] = { 1, 2 };
+      gdk_gc_set_line_attributes(drawing->dotted_gc,
+                                 1,
+                                 GDK_LINE_ON_OFF_DASH,
+                                 GDK_CAP_BUTT,
+                                 GDK_JOIN_MITER);
+      gdk_gc_set_dashes(drawing->dotted_gc,
+                        0,
+                        dash_list,
+                        2);
+    }
 
-    drawing->dotted_gc = gdk_gc_new(drawing->drawing_area->window);
-    gdk_gc_copy(drawing->dotted_gc, widget->style->white_gc);
-    gint8 dash_list[] = { 1, 2 };
-    gdk_gc_set_line_attributes(drawing->dotted_gc,
-                               1,
-                               GDK_LINE_ON_OFF_DASH,
-                               GDK_CAP_BUTT,
-                               GDK_JOIN_MITER);
-    gdk_gc_set_dashes(drawing->dotted_gc,
-                      0,
-                      dash_list,
-                      2);
+    drawing_draw_line(NULL, widget->window,
+                  cursor_x, 0,
+                  cursor_x, drawing->height,
+                  drawing->dotted_gc);
   }
-
-  drawing_draw_line(NULL, widget->window,
-                cursor_x, 0,
-                cursor_x, drawing->height,
-                drawing->dotted_gc);
   return FALSE;
 }
 
@@ -728,6 +732,9 @@ void convert_time_to_pixels(
   LttTime window_time_interval;
   double interval_double, time_double;
   
+  g_assert(ltt_time_compare(window_time_begin, time) <= 0 &&
+           ltt_time_compare(window_time_end, time) >= 0);
+  
   window_time_interval = ltt_time_sub(window_time_end,window_time_begin);
   
   time = ltt_time_sub(time, window_time_begin);
index cb1121acd7fb77a91d0e2ddbd43a119c3c655711..19d004b9a32b3664438db8c70fbbd355e635bee0 100644 (file)
@@ -2277,11 +2277,12 @@ int after_chunk(void *hook_data, void *call_data)
   ProcessList *process_list =
     guicontrolflow_get_process_list(control_flow_data);
 
-  if(tfc != NULL)
+  if(tfc != NULL 
+      && ltt_time_compare(tfc->timestamp, events_request->end_time) <= 0)
     end_time = tfc->timestamp;
-  else /* end of traceset */
-    end_time = tsc->time_span.end_time;
-
+  else /* end of traceset, or position now out of request : end */
+    end_time = events_request->end_time;
+  
   ClosureData closure_data;
   closure_data.events_request = (EventsRequest*)hook_data;
   closure_data.tss = tss;
index ee6e6c52d9739f0697e1ecfd56afb7dfdfc4e79a..1588c5f580e2ac154b8b67361dc948d1a74363d0 100644 (file)
@@ -1511,7 +1511,7 @@ gboolean update_current_time(void * hook_data, void * call_data)
   sprintf(str_path,"%d\0",count);
   path = gtk_tree_path_new_from_string (str_path);
   gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-  g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->tree_v), "cursor-changed");
+  //g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->tree_v), "cursor-changed");
   gtk_tree_path_free(path);  
 
   return FALSE;
index 41b0a0fc48b3de5e6b98af9ebfa720d5833d075a..297b2a3b25fcee9fb3f1b101de40e2c81c3f6b5f 100644 (file)
@@ -256,13 +256,13 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
         LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
   TimeInterval time_span = tsc->time_span;
   GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
+  LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time);
       
   g_object_set(G_OBJECT(adjustment),
                "lower",
-                 0, /* lower */
+                 0.0, /* lower */
                "upper",
-               ltt_time_to_double(
-                   ltt_time_sub(time_span.end_time, time_span.start_time)) 
+               ltt_time_to_double(upper) 
                  * NANOSECONDS_PER_SECOND, /* upper */
                "step_increment",
                ltt_time_to_double(tab->time_window.time_width)
@@ -1996,15 +1996,15 @@ void zoom(GtkWidget * widget, double size)
   //
   //
 
+ LttTime rel_time =
+       ltt_time_sub(new_time_window.start_time, time_span.start_time); 
  if(   ltt_time_to_double(new_time_window.time_width)
                              * NANOSECONDS_PER_SECOND
                              / SCROLL_STEP_PER_PAGE/* step increment */
        +
-       ltt_time_to_double(new_time_window.start_time)
-                             * NANOSECONDS_PER_SECOND /* page size */
+       ltt_time_to_double(rel_time) * NANOSECONDS_PER_SECOND /* page size */
                     == 
-       ltt_time_to_double(new_time_window.start_time)
-                             * NANOSECONDS_PER_SECOND /* page size */
+       ltt_time_to_double(rel_time) * NANOSECONDS_PER_SECOND /* page size */
        ) {
     g_warning("Can not zoom that far due to scrollbar precision");
  } else if(
@@ -2024,7 +2024,7 @@ void zoom(GtkWidget * widget, double size)
                  //ltt_time_to_double(new_time_window.start_time) 
                  //  * NANOSECONDS_PER_SECOND, /* value */
                  "lower",
-                   0, /* lower */
+                   0.0, /* lower */
                  "upper",
                  ltt_time_to_double(
                    ltt_time_sub(time_span.end_time, time_span.start_time))
index 8b1f2b21df24005932b8089d7f0bb2d1e1be1064..076045bf24adbd3b0e80ef738befce1cdd1bf128 100644 (file)
@@ -691,7 +691,7 @@ void lttvwindow_report_time_window(Tab *tab,
       
   g_object_set(G_OBJECT(adjustment),
                "lower",
-               0, /* lower */
+               0.0, /* lower */
                "upper",
                ltt_time_to_double(
                  ltt_time_sub(time_span.end_time, time_span.start_time)) 
index 51e6994a23dc337fe29de37bd5f66aa871bbfebe..898c9b26d6f72d935c79800b91176aef3cb3680e 100644 (file)
@@ -422,8 +422,5 @@ static void destroy()
 
 LTTV_MODULE("textDump", "Print events in a file", \
            "Produce a detailed text printout of a trace", \
-           init, destroy, "stats", "batchAnalysis")
-
-
-
+           init, destroy, "stats", "batchAnalysis", "option")
 
This page took 0.030265 seconds and 4 git commands to generate.