Initial port of the detailed event view
authorFrancis Deslauriers <francis.deslauriers@polymtl.ca>
Fri, 22 Jun 2012 14:14:11 +0000 (10:14 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Fri, 6 Jul 2012 21:16:39 +0000 (17:16 -0400)
 Add valgrind suppression file for GTK

Signed-off-by: Francis Deslauriers <francis.deslauriers@polymtl.ca>
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
16 files changed:
debug/gtk.suppression [new file with mode: 0644]
lttv/lttv/event.c
lttv/lttv/tracecontext.c
lttv/lttv/traceset-process.c
lttv/lttv/traceset-process.h
lttv/lttv/traceset.c
lttv/lttv/traceset.h
lttv/modules/gui/Makefile.am
lttv/modules/gui/detailedevents/events.c
lttv/modules/gui/detailedevents/events.h
lttv/modules/gui/detailedevents/lttv_plugin_evd.c
lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
lttv/modules/gui/lttvwindow/lttvwindow/interface.c
lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h
runlttv

diff --git a/debug/gtk.suppression b/debug/gtk.suppression
new file mode 100644 (file)
index 0000000..ec75f6a
--- /dev/null
@@ -0,0 +1,297 @@
+#Taken from  
+#http://lug.rose-hulman.edu/code/projects/grits/repository/revisions/master/raw/src/gtk.suppression
+#on July 6th 2012.
+#Original creator :
+#Andy Spencer <andy753421@gmail.com>
+#
+# Valgrind suppression file for Gtk+ 2.16
+
+# ?????
+{
+       lib_ld_conds
+       Memcheck:Cond
+       obj:/lib/ld-2.11.2.so
+       obj:/lib/ld-2.11.2.so
+       obj:/lib/ld-2.11.2.so
+       obj:/lib/ld-2.11.2.so
+       obj:/lib/ld-2.11.2.so
+}
+{
+       libGL_leaks
+       Memcheck:Leak
+       obj:/usr/lib/opengl/nvidia/lib/libGL.so.*
+}
+
+# GLib
+{
+       g_type_register_static
+       Memcheck:Leak
+       ...
+       fun:g_type_register_static
+}
+{
+       g_type_add_interface_static
+       Memcheck:Leak
+       ...
+       fun:g_type_add_interface_static 
+}
+{
+       g_param_spec
+       Memcheck:Leak
+       ...
+       fun:g_param_spec_*
+       ...
+       fun:g_object_new
+}
+{
+       g_module_open__addr
+       Memcheck:Addr4
+       ...
+       fun:dlopen
+       fun:g_module_open
+}
+{
+       g_module_open__leak
+       Memcheck:Leak
+       ...
+       fun:dlopen
+       fun:g_module_open
+}
+{
+       g_module_open__sym
+       Memcheck:Addr4
+       ...
+       fun:dlsym
+       fun:g_module_symbol
+       fun:g_module_open
+}
+{
+       g_class_ref__leak
+       Memcheck:Leak
+       fun:malloc
+       fun:g_malloc
+       fun:g_memdup
+       fun:type_iface_vtable_base_init_Wm
+       fun:g_type_class_ref
+}
+
+# GTK+
+{
+       gtk_init
+       Memcheck:Leak
+       ...
+       fun:gtk_init
+}
+{
+       gtk_init
+       Memcheck:Addr4
+       ...
+       fun:gtk_init
+}
+{
+       gtk_style_new
+       Memcheck:Leak
+       ...
+       fun:gtk_style_new
+}
+{
+       gtk_rc_get_style
+       Memcheck:Leak
+       ...
+       fun:gtk_rc_get_style
+}
+{
+       gtk_icon_theme_has_icon
+       Memcheck:Leak
+       ...
+       fun:gtk_icon_theme_has_icon
+}
+{
+       gtk_icon_source_copy
+       Memcheck:Leak
+       ...
+       fun:gtk_icon_source_copy
+}
+{
+       gtk_icon_theme_get
+       Memcheck:Leak
+       ...
+       fun:gtk_icon_theme_get*
+}
+{
+       gtk_icon_factory_lookup
+       Memcheck:Leak
+       ...
+       fun:gtk_icon_factory_lookup*
+}
+{
+       gxk__for_display
+       Memcheck:Leak
+       ...
+       fun:g?k_*_for_display
+}
+{
+       gxk__for_screen
+       Memcheck:Leak
+       ...
+       fun:g?k_*_for_screen
+}
+{
+       gdk_gc_new
+       Memcheck:Leak
+       ...
+       fun:gdk_gc_new
+       ...
+       fun:gdk_window_end_paint
+}
+{
+       gtk_gc_get cached
+       Memcheck:Leak
+       ...
+       fun:g_cache_insert
+       fun:gtk_gc_get
+}
+{
+       gdk_x11_window_set_user_time
+       Memcheck:Leak
+       ...
+       fun:gdk_x11_window_set_user_time 
+}
+{
+       gdk_x11_window_set_user_time
+       Memcheck:Leak
+       ...
+       fun:gdk_x11_window_set_user_time 
+}
+{
+       gtk_widget_realize 1
+       Memcheck:Leak
+       ...
+       fun:g_slice_alloc
+       ...
+       fun:gtk_widget_realize
+}
+{
+       gtk_widget_realize 2
+       Memcheck:Leak
+       ...
+       fun:gdk_window_new
+       ...
+       fun:gtk_widget_realize
+}
+{
+       gdk_window_invalidate_region
+       Memcheck:Leak
+       ...
+       fun:gdk_region_*
+       fun:gdk_window_invalidate_maybe_recurse
+}
+{
+       gtk_container_check_resize
+       Memcheck:Leak
+       ...
+       fun:gdk_window_process_updates
+       ...
+       fun:gtk_container_check_resize
+}
+{
+       weak_pointer
+       Memcheck:Leak
+       ...
+       fun:g_object_weak_ref
+       fun:g_object_add_weak_pointer
+       obj:*/libgtk-*
+       obj:*/libgtk-*
+       fun:gtk_main_do_event
+}
+{
+       gtk_window_new
+       Memcheck:Leak
+       ...
+       fun:g_type_create_instance
+       fun:g_object_constructor
+       fun:g_object_newv
+       fun:g_object_new_valist
+       fun:g_object_new
+       fun:gtk_window_new
+}
+
+# Pango
+{
+       pango_ot_ruleset_new
+       Memcheck:Leak
+       ...
+       fun:pango_ot_ruleset_new*
+}
+{
+       pango_font_map_load_fontset
+       Memcheck:Leak
+       ...
+       fun:pango_font_map_load_fontset
+}
+{
+       pango_font_map_create_context
+       Memcheck:Leak
+       ...
+       fun:pango_font_map_create_context
+}
+{
+       pango__font_glyph_extents
+       Memcheck:Leak
+       ...
+       fun:pango_font_get_glyph_extents
+}
+{
+       pango_coverage_set
+       Memcheck:Leak
+       ...
+       fun:pango_coverage_set
+}
+
+# Cairo
+{
+       cairo__font_create
+       Memcheck:Leak
+       ...
+       fun:cairo_*_font_create
+}
+{
+       cairo__font_face_create
+       Memcheck:Leak
+       ...
+       fun:cairo_*_font_face_create*
+}
+{
+       cairo__font_glyph_extents
+       Memcheck:Leak
+       ...
+       fun:cairo_*_font_glyph_extents
+}
+{
+       cairo_show_glyphs
+       Memcheck:Leak
+       ...
+       fun:cairo_show_glyphs
+}
+
+# Fontconfig
+{
+       FcFontRenderPrepare
+       Memcheck:Leak
+       ...
+       fun:FcFontRenderPrepare
+}
+
+# OpenGL
+#{
+#      OpenGL memleak
+#      Memcheck:Leak
+#      ...
+#      fun:*alloc
+#      obj:*/libGL*
+#}
+#{
+#      OpenGL uninitalized
+#      Memcheck:Cond
+#      obj:*/libGL*
+#}
index 8c1b6d8021e359af29ccba2d1c3f15b932324325..be5f936503e9349ece54005db9a0a8519db0e0ae 100644 (file)
@@ -7,7 +7,7 @@
 
 LttTime lttv_event_get_timestamp(LttvEvent *event)
 {
-  return ltt_time_from_uint64(bt_ctf_get_timestamp(event->bt_event));
+  return ltt_time_from_uint64(bt_ctf_get_timestamp_raw(event->bt_event));
 }
 
 //TODO ybrosseau find a way to return an error code
index 165a890f688d49b539ab7f10860746976a032b59..5f6455a42f4be31b1d8bd4db7efba9ebce502e8f 100644 (file)
@@ -693,13 +693,14 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
        
        unsigned count = 0;
                
+        gint last_ret = 0;
        struct bt_ctf_event *bt_event;
        
        LttvEvent event;
 
        while(TRUE) {
 
-               if((count >= nb_events) && (nb_events != G_MAXULONG)) {
+               if(last_ret == TRUE || ((count >= nb_events) && (nb_events != G_MAXULONG))) {
                        break;
                }
 
@@ -712,7 +713,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
                           to retrieve the right state container */
                        event.state = self->tmpState;
                        
-                       lttv_hooks_call(self->event_hooks, &event);
+                       last_ret = lttv_hooks_call(self->event_hooks, &event);
 
                        if(bt_iter_next(bt_ctf_get_iter(self->iter)) < 0) {
                                printf("ERROR NEXT\n");
index 56543855f64a20bb6163ba7191eb181feeb516ed..8ce68981882dd0d76c5a441ab9a845aa9043bbbc 100644 (file)
@@ -25,7 +25,7 @@
 #include <lttv/event.h>
 #include <babeltrace/context.h>
 #include <babeltrace/iterator.h>
-
+#include <babeltrace/trace-handle.h>
 #include <babeltrace/ctf/events.h>
 #include <babeltrace/ctf/iterator.h>
 
@@ -54,29 +54,37 @@ void lttv_process_traceset_begin(LttvTraceset *traceset,
 }
 
 guint lttv_process_traceset_middle(LttvTraceset *traceset,
-               LttTime end,
-               gulong nb_events,
-               const LttvTracesetPosition *end_position)
+                                       LttTime end,
+                                       gulong nb_events,
+                                       const LttvTracesetPosition *end_position)
 {
-       
        unsigned count = 0;
-               
+       gint last_ret = 0;
+       LttvTracesetPosition *currentPos;
+        
        struct bt_ctf_event *bt_event;
        
        LttvEvent event;
   
        while(TRUE) {
 
-               if((count >= nb_events) && (nb_events != G_MAXULONG)) {
+               if(last_ret == TRUE || ((count >= nb_events) && (nb_events != G_MAXULONG))) {
                        break;
                }
 
                if((bt_event = bt_ctf_iter_read_event(traceset->iter)) != NULL) {
+
+                       LttTime time = ltt_time_from_uint64(bt_ctf_get_timestamp_raw(bt_event));
+                       if(ltt_time_compare(end, time) <= 0) {
+                               break;
+                       }
                        
-                       if(ltt_time_compare(end, ltt_time_from_uint64( bt_ctf_get_timestamp(bt_event))) <= 0) {
+                       currentPos = lttv_traceset_create_position(traceset);
+                       if(lttv_traceset_position_compare(currentPos,end_position ) == 0){
+                               lttv_traceset_destroy_position(currentPos);
                                break;
                        }
-
+                       lttv_traceset_destroy_position(currentPos);
                        count++;
 
                        event.bt_event = bt_event;
@@ -85,7 +93,7 @@ guint lttv_process_traceset_middle(LttvTraceset *traceset,
                        event.state = g_ptr_array_index(traceset->state_trace_handle_index,
                                                        bt_ctf_event_get_handle_id(bt_event));
                        
-                       lttv_hooks_call(traceset->event_hooks, &event);
+                       last_ret = lttv_hooks_call(traceset->event_hooks, &event);
 
                        if(bt_iter_next(bt_ctf_get_iter(traceset->iter)) < 0) {
                                printf("ERROR NEXT\n");
@@ -98,9 +106,6 @@ guint lttv_process_traceset_middle(LttvTraceset *traceset,
                
                }
        }
-       
-
-
        return count;
 }
 
@@ -124,7 +129,6 @@ void lttv_traceset_add_hooks(LttvTraceset *traceset,
                             LttvHooks *before_trace,
                             LttvHooks *event)
 {
-       
        guint i, nb_trace;
 
        LttvTrace *trace;
@@ -148,7 +152,6 @@ void lttv_traceset_remove_hooks(LttvTraceset *traceset,
                                LttvHooks *after_trace,
                                LttvHooks *event)
 {
-
        guint i, nb_trace;
 
        LttvTrace *trace;
@@ -163,6 +166,7 @@ void lttv_traceset_remove_hooks(LttvTraceset *traceset,
 
        }
 
+       lttv_hooks_remove_list(traceset->event_hooks, event);
        lttv_hooks_call(after_traceset, traceset);
 
 
@@ -182,7 +186,6 @@ void lttv_trace_remove_hooks(LttvTrace *trace,
 
 {
        lttv_hooks_call(after_trace, trace);
-
 }
 
 void lttv_process_traceset_seek_time(LttvTraceset *traceset, LttTime start)
@@ -200,5 +203,94 @@ void lttv_process_traceset_seek_time(LttvTraceset *traceset, LttTime start)
         if(ret < 0) {
                 printf("Seek by time error: %s,\n",strerror(-ret));
         }
+}
+
+guint lttv_process_traceset_seek_n_forward(LttvTraceset *traceset,
+                guint n,
+                check_handler *check,
+                gboolean *stop_flag,
+                LttvFilter *filter1,
+                LttvFilter *filter2,
+                LttvFilter *filter3,
+                gpointer data)
+{
+        struct bt_ctf_event *bt_event;
+        unsigned count = 0;
+        while(count < n) {
+               if(bt_iter_next(bt_ctf_get_iter(traceset->iter)) < 0) {
+                       printf("ERROR NEXT\n");
+                       break;
+               }
+               count++;
+        }
+      return count;  
+}
+
+guint lttv_process_traceset_seek_n_backward(LttvTraceset *ts,
+                guint n,
+                gdouble ratio,
+                check_handler *check,
+                gboolean *stop_flag,
+                LttvFilter *filter1,
+                LttvFilter *filter2,
+                LttvFilter *filter3,
+                gpointer data)
+{
+        guint i, count, ret;
+        gint extraEvent = 0;
+        guint64 initialTimeStamp, previousTimeStamp;
+        LttvTracesetPosition *initialPos, *previousPos, *currentPos;
+        
+        /*Save initial position of the traceset*/
+        initialPos = lttv_traceset_create_position (ts);
+        
+        /*Get the timespan of the initial position*/
+        initialTimeStamp = lttv_traceset_position_get_timestamp(initialPos);
+        /* 
+         * Create a position before the initial timestamp according
+         * to the ratio of nanosecond/nanosecond hopefully before the
+         * the desired seek position
+         */
+        while(1){
+               previousTimeStamp = initialTimeStamp - n*(guint)ceil(ratio);
+
+               previousPos = lttv_traceset_create_time_position(ts,ltt_time_from_uint64(previousTimeStamp));
+               if(initialTimeStamp == previousTimeStamp)
+                       break;
+                
+                currentPos = lttv_traceset_create_time_position(ts,ltt_time_from_uint64(previousTimeStamp));
+                /*move traceset position */
+                lttv_traceset_seek_to_position(previousPos);
+                /* iterate to the initial position counting the number of event*/
+                count = 0;
+                do {
+                        if((ret = lttv_traceset_position_compare(currentPos,initialPos)) == 1){       
+                                bt_iter_next(bt_ctf_get_iter(ts->iter));
+                                lttv_traceset_destroy_position(currentPos);
+                                currentPos = lttv_traceset_create_position(ts);
+                                count++;
+                        }
+                }while(ret != 0);
+                lttv_traceset_destroy_position(currentPos);
+                /*substract the desired number of event to the count*/
+                extraEvent = count - n;
+                if(extraEvent >= 0){
+                        //if the extraEvent is over 0 go back to previousPos and 
+                        //move forward the value of extraEvent times
+                        lttv_traceset_seek_to_position(previousPos);
+                        
+                        for(i = 0 ; i < extraEvent ; i++){
+                                if(bt_iter_next(bt_ctf_get_iter(ts->iter)) < 0){
+                                        printf("ERROR NEXT\n");
+                                        break;
+                                }
+                                
+                        }
+                        break; /* we successfully seeked backward */
+                }
+                else{ /* if the extraEvent is below 0 create a position before and start over*/  
+                        ratio = ratio * 16;
+                }
+        }
+        return 0;
 }
index cc7b75dd5883b94bebc0f268176a8bc6fde02913..cba868f24d78143113bccbc834415b7d6aec98aa 100644 (file)
@@ -62,10 +62,10 @@ void lttv_process_traceset_seek_time(LttvTraceset *traceset, LttTime start);
 
 void lttv_traceset_compute_time_span(LttvTraceset *traceset,
                TimeInterval *time_span);
-
+#ifdef BABEL_CLEANUP
 gboolean lttv_process_traceset_seek_position(LttvTraceset *traceset, 
                const LttvTracesetPosition *pos);
-
+#endif /*babel_cleanup*/
 void lttv_process_trace_seek_time(LttvTrace *trace, LttTime start);
 
 void lttv_traceset_add_hooks(LttvTraceset *traceset,
@@ -103,17 +103,19 @@ lttv_traceset_pos_pos_compare(const LttvTracesetPosition *pos1,
 
 gint lttv_traceset_ts_pos_compare(const LttvTraceset *traceset,
                const LttvTracesetPosition *pos2);
-
+#ifdef BABEL_CLEANUP/*Already in traceset.h*/
 LttTime
 lttv_traceset_position_get_time(const LttvTracesetPosition *pos);
-
+#endif //babel_cleanup
 /* Seek n events forward and backward (without filtering) : only use these where
  * necessary : the seek backward is costy. */
 
 #define BACKWARD_SEEK_MUL 2 /* Multiplication factor of time_offset between
                                backward seek iterations */
-
-static const LttTime seek_back_default_offset = { 1, 0 };
+#ifdef BABEL_CLEANUP
+static const gdouble seek_back_default_offset = 10;
+#endif //babel_cleanup
+static const gdouble SEEK_BACK_DEFAULT_RATIO = 20;
 
 typedef gboolean check_handler(guint count, gboolean *stop_flag, gpointer data);
 
@@ -129,15 +131,16 @@ guint lttv_process_traceset_seek_n_forward(LttvTraceset *traceset,
 typedef void (*seek_time_fct)(LttvTraceset *traceset, LttTime start);
 
 /* If first_offset is ltt_time_zero, it will choose a default value */
-guint lttv_process_traceset_seek_n_backward(LttvTraceset *traceset,
-               guint n,
-               LttTime first_offset,
-               seek_time_fct,
-               check_handler *check,
-               gboolean *stop_flag,
-               LttvFilter *filter1,
-               LttvFilter *filter2,
-               LttvFilter *filter3,
-               gpointer data);
+
+
+guint lttv_process_traceset_seek_n_backward(LttvTraceset *self,
+                guint n,
+                gdouble ratio,/*nanosecond/event*/
+                check_handler *check,
+                gboolean *stop_flag,
+                LttvFilter *filter1,
+                LttvFilter *filter2,
+                LttvFilter *filter3,
+                gpointer data);
 
 #endif // PROCESSTRACE_H
index ae7c1a16cecf5e9319813d57a0fecbdf91dfb79e..b10564c5dce8d040a7fafb44bfb2d97ec8f9981e 100644 (file)
@@ -23,6 +23,7 @@
 #include <lttv/traceset.h>
 #include <lttv/iattribute.h>
 #include <lttv/state.h>
+#include <lttv/event.h>
 #include <lttv/hook.h>
 #include <stdio.h>
 #include <babeltrace/babeltrace.h>
 
 LttvTraceset *lttv_traceset_new(void)
 {
-       LttvTraceset *s;
-        struct bt_iter_pos begin_pos;
+       LttvTraceset *ts;
+       struct bt_iter_pos begin_pos;
 
-       s = g_new(LttvTraceset, 1);
-       s->filename = NULL;
-       s->traces = g_ptr_array_new();
-       s->context = bt_context_create();
-       s->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
+       ts = g_new(LttvTraceset, 1);
+       ts->filename = NULL;
+       ts->traces = g_ptr_array_new();
+       ts->context = bt_context_create();
+       ts->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
        //TODO remove this when we have really mecanism
        //s->tmpState = g_new(LttvTraceState *, 1);
        //lttv_trace_state_init(s->tmpState,0);
 
-       s->iter = 0;
-        s->event_hooks = lttv_hooks_new();
-        
-       s->state_trace_handle_index =  g_ptr_array_new();
+       /*Initialize iterator to the beginning of the traces*/        
+       begin_pos.type = BT_SEEK_BEGIN;
+       ts->iter = bt_ctf_iter_create(ts->context, &begin_pos, NULL);
 
-       return s;
+       ts->event_hooks = lttv_hooks_new();
+
+       ts->state_trace_handle_index = g_ptr_array_new();
+
+       return ts;
 }
 
 char * lttv_traceset_name(LttvTraceset * s)
@@ -124,31 +128,31 @@ void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname)
  */
 static LttvTrace *lttv_trace_create(LttvTraceset *ts, const char *path)
 {
-  int id = bt_context_add_trace(lttv_traceset_get_context(ts),
-            path,
-            "ctf",
-            NULL,
-            NULL,
-            NULL);
-  if (id < 0) {
-    return NULL;
-  }
-  // Create the trace and save the trace handle id returned by babeltrace
-  LttvTrace *new_trace;
+       int id = bt_context_add_trace(lttv_traceset_get_context(ts),
+               path,
+               "ctf",
+               NULL,
+               NULL,
+               NULL);
+       if (id < 0) {
+               return NULL;
+       }
+       // Create the trace and save the trace handle id returned by babeltrace
+       LttvTrace *new_trace;
 
-  new_trace = g_new(LttvTrace, 1);
-  new_trace->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
-  new_trace->id = id;
-  new_trace->ref_count = 0;
-  new_trace->traceset = ts;
-  new_trace->state = g_new(LttvTraceState,1);
-  lttv_trace_state_init(new_trace->state,new_trace);
+       new_trace = g_new(LttvTrace, 1);
+       new_trace->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
+       new_trace->id = id;
+       new_trace->ref_count = 0;
+       new_trace->traceset = ts;
+       new_trace->state = g_new(LttvTraceState,1);
+       lttv_trace_state_init(new_trace->state,new_trace);
 
-  /* Add the state to the trace_handle to state index */
-  g_ptr_array_set_size(ts->state_trace_handle_index,id+1);
-  g_ptr_array_index(ts->state_trace_handle_index,id) = new_trace->state;
+       /* Add the state to the trace_handle to state index */
+       g_ptr_array_set_size(ts->state_trace_handle_index,id+1);
+       g_ptr_array_index(ts->state_trace_handle_index,id) = new_trace->state;
 
-  return new_trace;
+       return new_trace;
 }
 
 /*
@@ -162,12 +166,12 @@ static LttvTrace *lttv_trace_create(LttvTraceset *ts, const char *path)
  */
 static int lttv_traceset_create_trace(LttvTraceset *ts, const char *path)
 {
-  LttvTrace *trace = lttv_trace_create(ts, path);
-  if (trace == NULL) {
-    return -1;
-  }
-  lttv_traceset_add(ts, trace);
-  return 0;
+       LttvTrace *trace = lttv_trace_create(ts, path);
+       if (trace == NULL) {
+               return -1;
+       }
+       lttv_traceset_add(ts, trace);
+       return 0;
 }
 
 LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig) 
@@ -272,7 +276,6 @@ void lttv_traceset_add(LttvTraceset *s, LttvTrace *t)
 
 int lttv_traceset_add_path(LttvTraceset *ts, char *trace_path)
 {
-
        FTS *tree;
        FTSENT *node;
        char * const paths[2] = { trace_path, NULL };
@@ -388,7 +391,7 @@ LttvAttribute *lttv_trace_attribute(LttvTrace *t)
 
 gint lttv_trace_get_id(LttvTrace *t)
 {
-  return t->id;
+       return t->id;
 }
 
 guint lttv_trace_get_ref_number(LttvTrace * t)
@@ -424,7 +427,7 @@ LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset)
        
        traceset_pos = g_new(LttvTracesetPosition, 1);
 
-       /* Check in the new passed */
+       /* Check if the new passed */
        if(traceset_pos == NULL) {
                return NULL;
        }
@@ -435,20 +438,39 @@ LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset)
        return traceset_pos;
 }
 
+LttvTracesetPosition *lttv_traceset_create_time_position(LttvTraceset *traceset,
+                                                                LttTime timestamp)
+{
+        LttvTracesetPosition *traceset_pos;
+
+        traceset_pos = g_new(LttvTracesetPosition, 1);
+
+        /* Check if the new passed */
+        if(traceset_pos == NULL) {
+                return NULL;
+        }
+        
+        traceset_pos->iter = traceset->iter;
+        traceset_pos->bt_pos = bt_iter_create_time_pos(
+                                        bt_ctf_get_iter(traceset_pos->iter),
+                                        ltt_time_to_uint64(timestamp));
+         
+        return traceset_pos;
+}
+
 void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos)
 {
        bt_iter_free_pos(traceset_pos->bt_pos);
        g_free(traceset_pos);
 }
 
-void lttv_traceset_seek_to_position(LttvTracesetPosition *traceset_pos)
+void lttv_traceset_seek_to_position(const LttvTracesetPosition *traceset_pos)
 {
-       bt_iter_set_pos(traceset_pos->iter, traceset_pos->bt_pos);
+       bt_iter_set_pos(bt_ctf_get_iter(traceset_pos->iter), traceset_pos->bt_pos);
 }
 
 guint lttv_traceset_get_cpuid_from_event(LttvEvent *event)
 {
-       struct definition *scope;
        unsigned long timestamp;
        unsigned int cpu_id;
        
@@ -457,7 +479,7 @@ guint lttv_traceset_get_cpuid_from_event(LttvEvent *event)
        if (timestamp == -1ULL) {
                return 0;
        }
-       scope = bt_ctf_get_top_level_scope(ctf_event, BT_STREAM_PACKET_CONTEXT);
+       const struct definition *scope = bt_ctf_get_top_level_scope(ctf_event, BT_STREAM_PACKET_CONTEXT);
        if (bt_ctf_field_get_error()) {
                return 0;
        }
@@ -468,35 +490,48 @@ guint lttv_traceset_get_cpuid_from_event(LttvEvent *event)
                return cpu_id;
        }
 }
+
+guint64 lttv_traceset_get_timestamp_first_event(LttvTraceset *ts)
+{
+        LttvTracesetPosition begin_position;
+        struct bt_iter_pos pos;
+        begin_position.bt_pos = &pos;
+       
+         /* Assign iterator to the beginning of the traces */  
+        begin_position.bt_pos->type = BT_SEEK_BEGIN;
+        begin_position.iter = ts->iter;
+      
+        return lttv_traceset_position_get_timestamp(&begin_position);  
+}
+
 /*
  * lttv_traceset_get_timestamp_begin : returns the  minimum timestamp of 
  * all the traces in the traceset.
  * 
  */
-
 guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset)
 {
-  struct bt_context *bt_ctx;
-  bt_ctx = lttv_traceset_get_context(traceset);
-  guint64 timestamp_min = G_MAXUINT64, timestamp_cur = 0;
-  int i;
-  int trace_count;
-  LttvTrace *currentTrace;
-  trace_count = traceset->traces->len;
-  if(trace_count == 0) 
-    timestamp_min = 0;
-  else{
-    timestamp_min = G_MAXUINT64;
-    
-    for(i = 0; i < trace_count;i++)
-    {
-      currentTrace = g_ptr_array_index(traceset->traces,i);
-      timestamp_cur = bt_trace_handle_get_timestamp_begin(bt_ctx, currentTrace->id);
-      if(timestamp_cur < timestamp_min)
-       timestamp_min = timestamp_cur;
-    }
-  }
-  return timestamp_min;
+        struct bt_context *bt_ctx;
+        bt_ctx = lttv_traceset_get_context(traceset);
+        guint64 timestamp_min, timestamp_cur = 0;
+        int i;
+        int trace_count;
+        LttvTrace *currentTrace;
+        trace_count = traceset->traces->len;
+        if(trace_count == 0)    
+                timestamp_min = 0;
+        else{
+                timestamp_min = G_MAXUINT64;
+                for(i = 0; i < trace_count;i++)
+                {
+                        currentTrace = g_ptr_array_index(traceset->traces,i);
+                        timestamp_cur = bt_trace_handle_get_timestamp_begin(bt_ctx,
+                                                                        currentTrace->id);
+                        if(timestamp_cur < timestamp_min)
+                                timestamp_min = timestamp_cur;
+                }
+        }
+        return timestamp_min;
 }
 
 /*
@@ -506,28 +541,42 @@ guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset)
  */
 guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset)
 {
-  struct bt_context *bt_ctx;
-  bt_ctx = lttv_traceset_get_context(traceset);
-  guint64 timestamp_max, timestamp_cur = 0;
-  int i;
-  int trace_count;
-  LttvTrace *currentTrace;
-  trace_count = traceset->traces->len;
-  
-  if(trace_count == 0)
-    timestamp_max = 1;
-  else
-  {
-    timestamp_max = 0;
-    for(i =0; i < trace_count;i++)
-    {
-      currentTrace = g_ptr_array_index(traceset->traces,i);
-      timestamp_cur = bt_trace_handle_get_timestamp_end(bt_ctx, currentTrace->id);
-      if(timestamp_cur > timestamp_max)
-       timestamp_max = timestamp_cur;
-    }
-  }
-  return timestamp_max;
+       struct bt_context *bt_ctx;
+       bt_ctx = lttv_traceset_get_context(traceset);
+       guint64 timestamp_max, timestamp_cur = 0;
+       int i;
+       int trace_count;
+       LttvTrace *currentTrace;
+       trace_count = traceset->traces->len;
+       
+       if(trace_count == 0){
+               timestamp_max = 1;
+       }
+       else{
+               timestamp_max = 0;
+               for(i =0; i < trace_count;i++)
+               {
+                       currentTrace = g_ptr_array_index(traceset->traces,i);
+                       timestamp_cur = bt_trace_handle_get_timestamp_end(bt_ctx,
+                                                                         currentTrace->id);
+                       if(timestamp_cur > timestamp_max){
+                               timestamp_max = timestamp_cur;
+                       }
+               }
+       }
+       return timestamp_max;
+}
+/*
+ * lttv_traceset_get_time_span_real : return a TimeInterval representing the
+ * minimum timestamp dans le maximum timestamp of the traceset.
+ * 
+ */
+TimeInterval lttv_traceset_get_time_span_real(LttvTraceset *ts)
+{
+        TimeInterval time_span;
+        time_span.start_time =ltt_time_from_uint64(lttv_traceset_get_timestamp_first_event(ts));
+        time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts));
+        return time_span;
 }
 
 /*
@@ -538,7 +587,7 @@ guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset)
 TimeInterval lttv_traceset_get_time_span(LttvTraceset *ts)
 {
         TimeInterval time_span;
-        time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(ts));
+        time_span.start_time =ltt_time_from_uint64(lttv_traceset_get_timestamp_begin(ts));
         time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts));
         return time_span;
 }
@@ -547,3 +596,61 @@ const char *lttv_traceset_get_name_from_event(LttvEvent *event)
 {
        return bt_ctf_event_name(event->bt_event);
 }
+
+guint64 lttv_traceset_position_get_timestamp(const LttvTracesetPosition *pos)
+{ 
+        guint64 timestamp = 0;
+       /*We save the current iterator,so we can reassign it after the seek*/
+        LttvTracesetPosition previous_pos;
+        previous_pos.iter = pos->iter;
+        previous_pos.bt_pos = bt_iter_get_pos(bt_ctf_get_iter(pos->iter));
+       /* Seek to the new desired position */
+        lttv_traceset_seek_to_position(pos);
+       /*Read the event*/
+        struct bt_ctf_event *event = bt_ctf_iter_read_event(pos->iter);
+        
+       if(event != NULL){
+               timestamp = bt_ctf_get_timestamp_raw(event); 
+       }
+        /* Reassign the previously saved position */
+        lttv_traceset_seek_to_position(&previous_pos);
+       return timestamp;
+}
+
+LttTime  lttv_traceset_position_get_time(const LttvTracesetPosition *pos)
+{
+        return ltt_time_from_uint64(lttv_traceset_position_get_timestamp(pos));
+}
+
+int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvTracesetPosition *pos2)
+{
+#warning " TODO :Rename for lttv_traceset_position_equals && Must return COMPARAISON OF THE 2 POSITION && verify if it is the best way to compare position"
+        if(pos1 == NULL || pos2 == NULL){
+                return -1;
+       }
+        
+        guint64 timeStampPos1,timeStampPos2;
+        guint cpuId1, cpuId2;
+        LttvEvent event1, event2;
+        int ret;
+        
+        timeStampPos1 = lttv_traceset_position_get_timestamp(pos1);
+        timeStampPos2 = lttv_traceset_position_get_timestamp(pos2);
+        
+        event1.bt_event = bt_ctf_iter_read_event(pos1->iter);
+        event2.bt_event = bt_ctf_iter_read_event(pos2->iter);
+        
+        if(event1.bt_event == NULL || event2.bt_event == NULL){
+                return -1;
+       }
+
+        cpuId1 = lttv_traceset_get_cpuid_from_event(&event1);
+        cpuId2 = lttv_traceset_get_cpuid_from_event(&event2);
+       
+        if(timeStampPos1 == timeStampPos2 && cpuId1 == cpuId2){
+                return 0;
+       }
+        else{
+                return 1;
+       }
+}
index 6d4cedafd1dcceba4e7f9b46c0fd11c04796afdf..19fd563346512b36be1c87e767efee7f853673c9 100644 (file)
@@ -116,16 +116,28 @@ LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset);
 /* Destroy position snapshot */
 void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos);
 
-void lttv_traceset_seek_to_position(LttvTracesetPosition *traceset_pos);
+void lttv_traceset_seek_to_position(const LttvTracesetPosition *traceset_pos);
 
 guint lttv_traceset_get_cpuid_from_event(LttvEvent *event);
 /* Returns the minimum timestamp of the traces in the traceset */
 guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset);
 /* Returns the maximum timestamp of the traces in the traceset */
 guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset);
+/* Return a TimeInterval from timestamp of the first event to the last event [experimentale]*/
+TimeInterval lttv_traceset_get_time_span_real(LttvTraceset *ts);
 /* Returns a TimeInterval struct that represents the min and max of the traceset */
 TimeInterval lttv_traceset_get_time_span(LttvTraceset *traceset);
 
 const char *lttv_traceset_get_name_from_event(LttvEvent *event);
 
+LttvTracesetPosition *lttv_traceset_create_time_position(LttvTraceset *ts, LttTime timestamp);
+
+guint64 lttv_traceset_position_get_timestamp(const LttvTracesetPosition *pos);
+
+LttTime  lttv_traceset_position_get_time(const LttvTracesetPosition *pos);
+
+int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvTracesetPosition *pos2);
+
+
+
 #endif // TRACESET_H
index bf4c25e247477357aeb5862618b1bd0beae2a590..f88d7274f2e67f6cb190306cd4631161fbb30a0a 100644 (file)
@@ -6,8 +6,8 @@
 
 # WARNING : subdirs order is important : mainWin depends on API
 
-SUBDIRS = lttvwindow 
-# controlflow detailedevents statistics filter tracecontrol histogram interrupts resourceview
+SUBDIRS = lttvwindow detailedevents
+# controlflow  statistics filter tracecontrol histogram interrupts resourceview
 # TODO: PORT for 0.10
 #diskperformance tutorial
 
index 27330c8d1cd58fe4a81442c176adb29704efa736..585acbc09b35b2cd937c515d95e84c1f1514b0fc 100644 (file)
 #include <lttv/lttv.h>
 #include <lttv/module.h>
 #include <lttv/hook.h>
-#include <lttv/tracecontext.h>
+#include <lttv/traceset.h>
 #include <lttv/state.h>
+#ifdef BABEL_CLEANUP
 #include <lttv/filter.h>
+#endif //babel_cleanup
 #include <lttv/print.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
@@ -100,8 +102,9 @@ gboolean update_current_position(void * hook_data, void * call_data);
 //gboolean show_event_detail(void * hook_data, void * call_data);
 gboolean traceset_changed(void * hook_data, void * call_data);
 gboolean timespan_changed(void * hook_data, void * call_data);
+#ifdef BABEL_CLEANUP
 gboolean filter_changed(void * hook_data, void * call_data);
-
+#endif // babel_cleanup
 static void request_background_data(EventViewerData *event_viewer_data);
 
 //! Event Viewer's constructor hook
@@ -189,6 +192,7 @@ gui_events(LttvPluginTab *ptab)
   GtkSettings* gtk_settings = gtk_settings_get_default();
   g_object_set(gtk_settings, "gtk-error-bell", FALSE, NULL);
 
+
   LttTime end;
   GtkTreeViewColumn *column;
   GtkCellRenderer *renderer;
@@ -200,11 +204,9 @@ gui_events(LttvPluginTab *ptab)
   event_viewer_data->tab = tab;
   event_viewer_data->ptab = ptab;
   GtkWidget *tmp_toolbar_icon;
-
-  LttvTracesetContext * tsc =
-        lttvwindow_get_traceset_context(event_viewer_data->tab);
-
   
+  LttvTraceset *ts =lttvwindow_get_traceset(event_viewer_data->tab);
+
   event_viewer_data->event_hooks = lttv_hooks_new();
   lttv_hooks_add(event_viewer_data->event_hooks,
                  event_hook,
@@ -219,12 +221,12 @@ gui_events(LttvPluginTab *ptab)
                 traceset_changed,event_viewer_data);
   lttvwindow_register_timespan_notify(tab, 
                 timespan_changed,event_viewer_data);
+#ifdef BABEL_CLEANUP 
   lttvwindow_register_filter_notify(tab,
                 filter_changed, event_viewer_data);
+#endif
   lttvwindow_register_redraw_notify(tab,
                 evd_redraw_notify, event_viewer_data);
-  
-
   event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_show (event_viewer_data->scroll_win);
   gtk_scrolled_window_set_policy(
@@ -232,12 +234,11 @@ gui_events(LttvPluginTab *ptab)
       GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
 
   event_viewer_data->currently_selected_position =
-    lttv_traceset_context_position_new(tsc);
+                               lttv_traceset_create_position(ts);
   event_viewer_data->first_event =
-    lttv_traceset_context_position_new(tsc);
+                               lttv_traceset_create_position(ts);
   event_viewer_data->last_event =
-    lttv_traceset_context_position_new(tsc);
-
+                               lttv_traceset_create_position(ts);
   event_viewer_data->main_win_filter = lttvwindow_get_filter(tab);
 
   event_viewer_data->update_cursor = TRUE;
@@ -462,10 +463,14 @@ gui_events(LttvPluginTab *ptab)
   event_viewer_data->previous_value = 0;
   event_viewer_data->vadjust_c->lower = 0.0;
     //event_viewer_data->vadjust_c->upper = event_viewer_data->number_of_events;
+
   LttTime time = lttvwindow_get_current_time(tab);
-  time = ltt_time_sub(time, tsc->time_span.start_time);
+  TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
+  time = ltt_time_sub(time, time_span.start_time);
   //TODO ybrosseau 2011-01-06: Which one do we keep?
+#ifdef BABEL_CLEANUP
   event_viewer_data->vadjust_c->value = ltt_time_to_double(time);
+#endif //babel_cleanup
   event_viewer_data->vadjust_c->value = 0.0;
   event_viewer_data->vadjust_c->step_increment = 1.0;
   event_viewer_data->vadjust_c->page_increment = 2.0;
@@ -487,11 +492,9 @@ gui_events(LttvPluginTab *ptab)
 
   //get the life span of the traceset and set the upper of the scroll bar
   
-  TimeInterval time_span = tsc->time_span;
   end = ltt_time_sub(time_span.end_time, time_span.start_time);
 
-  event_viewer_data->vadjust_c->upper =
-              ltt_time_to_double(end);
+  event_viewer_data->vadjust_c->upper = ltt_time_to_double(end);
 
   /* Set the Selected Event */
   //  tree_v_set_cursor(event_viewer_data);
@@ -513,7 +516,6 @@ gui_events(LttvPluginTab *ptab)
 
 
   request_background_data(event_viewer_data);
-  
   return event_viewer_data;
 }
 
@@ -537,9 +539,9 @@ static gint background_ready(void *hook_data, void *call_data)
 
 static void request_background_data(EventViewerData *event_viewer_data)
 {
-  LttvTracesetContext * tsc =
-        lttvwindow_get_traceset_context(event_viewer_data->tab);
-  gint num_traces = lttv_traceset_number(tsc->ts);
+  LttvTraceset * ts =
+        lttvwindow_get_traceset(event_viewer_data->tab);
+  gint num_traces = ts->traces->len;
   gint i;
   LttvTrace *trace;
   LttvTraceState *tstate;
@@ -549,13 +551,15 @@ static void request_background_data(EventViewerData *event_viewer_data)
   lttv_hooks_add(background_ready_hook, background_ready, event_viewer_data,
       LTTV_PRIO_DEFAULT);
   event_viewer_data->background_info_waiting = 0;
-  
+    
   for(i=0;i<num_traces;i++) {
-    trace = lttv_traceset_get(tsc->ts, i);
+    trace = g_ptr_array_index(ts->traces,i);
+#ifdef BABEL_CLEANUP 
     tstate = LTTV_TRACE_STATE(tsc->traces[i]);
+#endif /*babel_cleanup*/
 
     if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE
-        && !tstate->has_precomputed_states) {
+        /*&& !tstate->has_precomputed_states*/) {
 
       if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"),
                                           trace) == FALSE) {
@@ -591,7 +595,6 @@ static void request_background_data(EventViewerData *event_viewer_data)
   }
 
   lttv_hooks_destroy(background_ready_hook);
-
 }
 
 static gboolean
@@ -664,6 +667,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
                             gint arg2,
                             gpointer data)
 {
+       
   GtkTreePath *path; // = gtk_tree_path_new();
   EventViewerData *event_viewer_data = (EventViewerData*)data;
   
@@ -702,7 +706,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
 
   }
 #endif //0
-  
+
   g_debug("tree view move cursor : arg1 is %u and arg2 is %d",
       (guint)arg1, arg2);
 
@@ -711,11 +715,11 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
     if(arg2 == 1) {
       /* Move one line down */
       if(event_viewer_data->pos->len > 0) {
-        LttvTracesetContextPosition *end_pos = 
-          (LttvTracesetContextPosition*)g_ptr_array_index(
+        LttvTracesetPosition *end_pos = 
+          (LttvTracesetPosition*)g_ptr_array_index(
                                              event_viewer_data->pos,
                                              event_viewer_data->pos->len-1);
-        if(lttv_traceset_context_pos_pos_compare(end_pos, 
+        if(lttv_traceset_position_compare(end_pos, 
               event_viewer_data->currently_selected_position) == 0) {
           /* Must get down one event and select the last one */
           gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(
@@ -729,7 +733,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
                                                                max(0, event_viewer_data->pos->len - 1), -1);
                                                if(path) {
                                                        gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
-                                                                                                                                                        path, NULL, FALSE);
+                                                                                        path, NULL, FALSE);
                                                        gtk_tree_path_free(path);
                                                }
                                        }
@@ -747,7 +751,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
                                                        max(0, event_viewer_data->pos->len - 1), -1);
                                        if(path) {
                                                gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
-                                                                                                                                                path, NULL, FALSE);
+                                                                                path, NULL, FALSE);
                                                gtk_tree_path_free(path);
                                        }
                                }
@@ -756,11 +760,11 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
     } else {
       if(event_viewer_data->pos->len > 0) {
         /* Move one line up */
-        LttvTracesetContextPosition *begin_pos = 
-          (LttvTracesetContextPosition*)g_ptr_array_index(
+        LttvTracesetPosition *begin_pos = 
+          (LttvTracesetPosition*)g_ptr_array_index(
                                              event_viewer_data->pos,
                                              0);
-        if(lttv_traceset_context_pos_pos_compare(begin_pos, 
+        if(lttv_traceset_position_compare(begin_pos, 
               event_viewer_data->currently_selected_position) == 0) {
           /* Must get up one event and select the first one */
           gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(
@@ -803,11 +807,11 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
     if(arg2 == 1) {
       /* Move one page down */
       if(event_viewer_data->pos->len > 0) {
-        LttvTracesetContextPosition *end_pos = 
-          (LttvTracesetContextPosition*)g_ptr_array_index(
+        LttvTracesetPosition *end_pos = 
+          (LttvTracesetPosition*)g_ptr_array_index(
                                              event_viewer_data->pos,
                                              event_viewer_data->pos->len-1);
-        if(lttv_traceset_context_pos_pos_compare(end_pos, 
+        if(lttv_traceset_position_compare(end_pos, 
               event_viewer_data->currently_selected_position) == 0) {
           /* Must get down one page and select the last one */
           gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(
@@ -847,11 +851,11 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
     } else {
       /* Move one page up */
       if(event_viewer_data->pos->len > 0) {
-        LttvTracesetContextPosition *begin_pos = 
-          (LttvTracesetContextPosition*)g_ptr_array_index(
+        LttvTracesetPosition *begin_pos = 
+          (LttvTracesetPosition*)g_ptr_array_index(
                                              event_viewer_data->pos,
                                              0);
-        if(lttv_traceset_context_pos_pos_compare(begin_pos, 
+        if(lttv_traceset_position_compare(begin_pos, 
               event_viewer_data->currently_selected_position) == 0) {
           /* Must get up one page and select the first one */
           gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(
@@ -893,9 +897,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
   default:
     break;
   }
-
   //gtk_tree_path_free(path);
-  
 #if 0
   if(arg1 == GTK_MOVEMENT_DISPLAY_LINES)
   {
@@ -1061,15 +1063,17 @@ gboolean tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpoint
 
 void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data)
 {
+        
   EventViewerData *event_viewer_data = (EventViewerData*) data;
   Tab *tab = event_viewer_data->tab;
   GtkTreeIter iter;
   GtkTreeModel* model = GTK_TREE_MODEL(event_viewer_data->store_m);
   GtkTreePath *path;
-  LttvTracesetContextPosition *pos;
+  LttvTracesetPosition *pos;
 
   g_debug("cursor changed cb");
-
   /* On cursor change, modify the currently selected event by calling
    * the right API function */
   if(event_viewer_data->report_position) {
@@ -1080,7 +1084,7 @@ void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data)
                                if(gtk_tree_model_get_iter(model,&iter,path)){
                                        gtk_tree_model_get(model, &iter, POSITION_COLUMN, &pos, -1);
                                        
-                                       if(lttv_traceset_context_pos_pos_compare(pos, 
+                                       if(lttv_traceset_position_compare(pos, 
                                                                event_viewer_data->currently_selected_position) != 0)
                                                lttvwindow_report_current_position(tab, pos);
                                }else{
@@ -1215,13 +1219,12 @@ void tree_v_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer
             / (double)cell_height ;
   
   event_viewer_data->num_visible_events = ceil(exact_num_visible) ;
-  
-/*
+
   event_viewer_data->vadjust_c->page_increment = 
-    floor(exact_num_visible);
+                                       floor(exact_num_visible);
   event_viewer_data->vadjust_c->page_size =
-    floor(exact_num_visible);
-*/
+                                       floor(exact_num_visible);
+
  
   g_debug("size allocate %p : last_num_visible_events : %d",
            event_viewer_data, last_num_visible_events);
@@ -1302,17 +1305,18 @@ static gboolean events_check_handler(guint count, gboolean *stop_flag,
 
 static void get_events(double new_value, EventViewerData *event_viewer_data)
 {
+#ifdef BABEL_CLEANUP
   LttvTracesetStats *tss =
     lttvwindow_get_traceset_stats(event_viewer_data->tab);
-  LttvTracesetContext *tsc = (LttvTracesetContext*)tss;
+#endif //babel_cleanup
+  LttvTraceset *ts = lttvwindow_get_traceset(event_viewer_data->tab);
   guint i;
   gboolean seek_by_time;
-  int retval;
-  
   if(lttvwindow_preempt_count > 0) return;
 
   double value = new_value - event_viewer_data->previous_value;
-
+  
   /* Set stop button status for foreground processing */
   event_viewer_data->tab->stop_foreground = FALSE;
   lttvwindow_events_request_disable();
@@ -1335,7 +1339,6 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
     }
   } else direction = SCROLL_NONE; /* 0.0 */
 
-
   switch(direction) {
   case SCROLL_STEP_UP:
     g_debug("get_events : SCROLL_STEP_UP");
@@ -1370,43 +1373,27 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
   }
 
   LttTime time = ltt_time_from_double(new_value);
-  time = ltt_time_add(tsc->time_span.start_time, time);
+  TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
+  time = ltt_time_add(time_span.start_time, time);
+  
+  LttvTracesetPosition *timePos = lttv_traceset_create_time_position(ts,time);
+  
 
   if(!seek_by_time) {
-  
-    LttvTracesetContextPosition *pos =
-        lttv_traceset_context_position_new(tsc);
-    
     /* Remember the beginning position */
     if(event_viewer_data->pos->len > 0) {
-      LttvTracesetContextPosition *first_pos = 
-        (LttvTracesetContextPosition*)g_ptr_array_index(
-                                                    event_viewer_data->pos,
-                                                    0);
-      lttv_traceset_context_position_copy(pos, first_pos);
-
-      if(relative_position >= 0) {
-        LttTime first_event_time = 
-            lttv_traceset_context_position_get_time(
-                              pos);
-        lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc,
-          first_event_time);
-        lttv_process_traceset_middle(tsc, ltt_time_infinite,
-                                   G_MAXUINT,
-                                   pos);
-       
-      } else if(relative_position < 0) {
-        retval= lttv_process_traceset_seek_position(tsc, pos);
-               g_assert_cmpint(retval, ==, 0);
+      
+      if(relative_position != 0)
+      {
+        LttvTracesetPosition *pos = 0;
+        pos = (LttvTracesetPosition*)g_ptr_array_index(
+                                                event_viewer_data->pos,
+                                                0);
+        lttv_traceset_seek_to_position(pos);
       }
-    } else {
-      /* There is nothing in the list : simply seek to the time value. */
-      lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc,
-          time);
-      lttv_process_traceset_middle(tsc, time, G_MAXUINT,
-                                   NULL);
-    }
-    
+    } 
+
   /* Note that, as we mess with the tsc position, this function CANNOT be called
    * from a hook inside the lttv_process_traceset_middle. */
   /* As the lttvwindow API keeps a sync_position inside the tsc to go back at
@@ -1416,70 +1403,63 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
   /* Get the beginning position of the read (with seek backward or seek forward)
    */
     if(relative_position > 0) {
-
-      lttv_process_traceset_seek_n_forward(tsc, relative_position,
+      lttv_process_traceset_seek_n_forward(ts, relative_position,
           events_check_handler,
           &event_viewer_data->tab->stop_foreground,
           event_viewer_data->main_win_filter,
           event_viewer_data->filter, NULL, event_viewer_data);
     } else if(relative_position < 0) {
-
       /* Get an idea of currently shown event dispersion */
-      LttTime first_event_time =
-        lttv_traceset_context_position_get_time(event_viewer_data->first_event);
-      LttTime last_event_time =
-        lttv_traceset_context_position_get_time(event_viewer_data->last_event);
-      LttTime time_diff = ltt_time_sub(last_event_time, first_event_time);
-      if(ltt_time_compare(time_diff, ltt_time_zero) == 0)
-        time_diff = seek_back_default_offset;
-
-      lttv_process_traceset_seek_n_backward(tsc,
-          abs(relative_position),
-          time_diff,
-          (seek_time_fct)lttv_state_traceset_seek_time_closest,
+      guint64 first_event_time_stamp =
+        lttv_traceset_position_get_timestamp(event_viewer_data->first_event);
+      guint64 last_event_time_stamp =
+        lttv_traceset_position_get_timestamp(event_viewer_data->last_event);
+      guint64 timeSpan = (last_event_time_stamp - first_event_time_stamp);
+      gdouble ratio =  (gdouble)timeSpan / (gdouble)event_viewer_data->num_visible_events;
+      if(ratio <= 0){
+        ratio = SEEK_BACK_DEFAULT_RATIO;
+      }
+
+      lttv_process_traceset_seek_n_backward(ts,
+          (guint)abs(relative_position),
+          ratio,
          events_check_handler,
          &event_viewer_data->tab->stop_foreground,
           event_viewer_data->main_win_filter,
           event_viewer_data->filter, NULL, event_viewer_data);
     } /* else 0 : do nothing : we are already at the beginning position */
 
-    lttv_traceset_context_position_destroy(pos);
-
     /* Save the first event position */
-    lttv_traceset_context_position_save(tsc, event_viewer_data->first_event);
-    
-    time = lttv_traceset_context_position_get_time(
-                                            event_viewer_data->first_event);
+
+    event_viewer_data->first_event = lttv_traceset_create_position(ts);
+
+    time = ltt_time_from_uint64(lttv_traceset_position_get_timestamp(
+                                            event_viewer_data->first_event));
     //if(ltt_time_compare(time, tsc->time_span.end_time) > 0)
     //  time = tsc->time_span.end_time;
 
-    LttTime time_val = ltt_time_sub(time,
-                        tsc->time_span.start_time);
+    LttTime time_val = ltt_time_sub(time,time_span.start_time);
     event_viewer_data->previous_value = ltt_time_to_double(time_val);
-    
-    lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, time);
-    lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT,
-                                 event_viewer_data->first_event);
+
+    lttv_traceset_seek_to_position(event_viewer_data->first_event);
 
   } else {
     /* Seek by time */
-    lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc,
-          time);
-    lttv_process_traceset_middle(tsc, time, G_MAXUINT,
-                                 NULL);
-    LttTime time_val = ltt_time_sub(time,
-                        tsc->time_span.start_time);
+    lttv_traceset_seek_to_position(timePos);
+
+    
+    LttTime time_val = ltt_time_sub(time,time_span.start_time);
     event_viewer_data->previous_value = ltt_time_to_double(time_val);
-    lttv_traceset_context_position_save(tsc, event_viewer_data->first_event);
+    event_viewer_data->first_event = timePos;
   }
  
   /* Clear the model (don't forget to free the TCS positions!) */
   gtk_list_store_clear(event_viewer_data->store_m);
   for(i=0;i<event_viewer_data->pos->len;i++) {
-    LttvTracesetContextPosition *cur_pos = 
-      (LttvTracesetContextPosition*)g_ptr_array_index(event_viewer_data->pos,
+    LttvTracesetPosition *cur_pos = 
+      (LttvTracesetPosition*)g_ptr_array_index(event_viewer_data->pos,
                                                       i);
-    lttv_traceset_context_position_destroy(cur_pos);
+    lttv_traceset_destroy_position(cur_pos);
   }
   g_ptr_array_set_size(event_viewer_data->pos, 0);
   
@@ -1491,26 +1471,24 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
    * processing can be stopped.
    */
   
-  lttv_process_traceset_begin(tsc,
-      NULL, NULL, NULL, event_viewer_data->event_hooks, NULL);
+  lttv_process_traceset_begin(ts,
+      NULL, NULL, event_viewer_data->event_hooks);
 
   event_viewer_data->num_events = 0;
   
-  lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT, NULL);
+  lttv_process_traceset_middle(ts, ltt_time_infinite, G_MAXUINT, NULL);
   
-  lttv_process_traceset_end(tsc,
-      NULL, NULL, NULL, event_viewer_data->event_hooks, NULL);
+  lttv_process_traceset_end(ts, NULL, NULL, event_viewer_data->event_hooks);
   
   /* Get the end position */
   if(event_viewer_data->pos->len > 0) {
-    LttvTracesetContextPosition *cur_pos = 
-      (LttvTracesetContextPosition*)g_ptr_array_index(event_viewer_data->pos,
+    LttvTracesetPosition *cur_pos = 
+      (LttvTracesetPosition*)g_ptr_array_index(event_viewer_data->pos,
                                                event_viewer_data->pos->len - 1);
-    lttv_traceset_context_position_copy(event_viewer_data->last_event,
-        cur_pos);
+    event_viewer_data->last_event = cur_pos;
   } else
-    lttv_traceset_context_position_save(tsc, event_viewer_data->last_event);
-
+        event_viewer_data->last_event =lttv_traceset_create_position(ts);
+  
   gtk_adjustment_set_value(event_viewer_data->vadjust_c,
       event_viewer_data->previous_value);
   
@@ -1522,17 +1500,17 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
         gtk_widget_get_parent_window(event_viewer_data->tree_v));
 
   lttvwindow_events_request_enable();
-
+  
   return;
 }
 
 
 int event_hook(void *hook_data, void *call_data)
 {
+
   EventViewerData *event_viewer_data = (EventViewerData*)hook_data;
-  LttvTracefileContext *tfc = (LttvTracefileContext*)call_data;
-  LttvTracefileState *tfs = (LttvTracefileState*)call_data;
-  LttEvent *e = ltt_tracefile_get_event(tfc->tf);
+  
+  LttvEvent * e = (LttvEvent *)call_data;
 
   if(event_viewer_data->num_events % CHECK_GDK_INTERVAL == 0) {
     GdkEvent *event;
@@ -1552,8 +1530,9 @@ int event_hook(void *hook_data, void *call_data)
     if(event_viewer_data->tab->stop_foreground)
       return TRUE;
   }
   event_viewer_data->num_events++;
-  
+#ifdef BABEL_CLEANUP
   LttvFilter *filter = event_viewer_data->main_win_filter;
   if(filter != NULL && filter->head != NULL)
     if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
@@ -1565,49 +1544,46 @@ int event_hook(void *hook_data, void *call_data)
     if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
           tfc->t_context->t,tfc,NULL,NULL))
       return FALSE;
-
-
+#endif //babel_cleanup
+   
 //  LttFacility *facility = ltt_event_facility(e);
 //  LttEventType *event_type = ltt_event_eventtype(e);
-  LttTime time = ltt_event_time(e);
+  LttTime time = lttv_event_get_timestamp(e);
+  gint cpu = lttv_traceset_get_cpuid_from_event(e);
+
+  LttvTraceState *traceState = e->state;
+  LttvProcessState *process = traceState->running_process[cpu];
 
-  guint cpu = tfs->cpu;
-  LttvTraceState *ts = (LttvTraceState*)tfc->t_context;
-  LttvProcessState *process = ts->running_process[cpu];
-  
   GtkTreeIter iter;
 
   GString *desc = g_string_new("");
   
-  LttvTracesetContextPosition *pos =
-    lttv_traceset_context_position_new(tfc->t_context->ts_context);
+  LttvTracesetPosition *pos = lttv_traceset_create_position(traceState->trace->traceset);
 
-  lttv_traceset_context_position_save(tfc->t_context->ts_context, pos);
-
-  lttv_event_to_string(e, desc, TRUE, TRUE, (LttvTracefileState*)tfc);
+  lttv_event_to_string(e, desc, TRUE);
 
   g_info("detail : %s", desc->str);
-  
+
   gtk_list_store_append (event_viewer_data->store_m, &iter);
+
   gtk_list_store_set (event_viewer_data->store_m, &iter,
-      TRACE_NAME_COLUMN, g_quark_to_string(ltt_trace_name(tfc->t_context->t)),
-      TRACEFILE_NAME_COLUMN, g_quark_to_string(ltt_tracefile_name(tfc->tf)),
-      CPUID_COLUMN, cpu,
-      EVENT_COLUMN, g_quark_to_string(marker_get_info_from_id(tfc->tf->mdata,
-        e->event_id)->name),
-      TIME_S_COLUMN, time.tv_sec,
-      TIME_NS_COLUMN, time.tv_nsec,
-      PID_COLUMN, process->pid,
-      EVENT_DESCR_COLUMN, desc->str,
-      POSITION_COLUMN, pos,
-      -1);
+        TRACE_NAME_COLUMN, "TraceName",
+        TRACEFILE_NAME_COLUMN,"TraceFile" /*traceState->trace->traceset->filename*/,
+        CPUID_COLUMN, cpu,
+        EVENT_COLUMN,"EventName" /*bt_ctf_event_name(e->bt_event)*/,
+        TIME_S_COLUMN, time.tv_sec,
+        TIME_NS_COLUMN, time.tv_nsec,
+        PID_COLUMN, process->pid,
+        EVENT_DESCR_COLUMN, desc->str,
+        POSITION_COLUMN, pos,
+        -1);
 
   g_ptr_array_add(event_viewer_data->pos, pos);
   
   g_string_free(desc, TRUE);
 
   if(event_viewer_data->update_cursor) {
-    if(lttv_traceset_context_pos_pos_compare(pos, 
+    if(lttv_traceset_position_compare(pos, 
           event_viewer_data->currently_selected_position) == 0) {
       GtkTreePath *path = gtk_tree_path_new_from_indices(
                           event_viewer_data->pos->len - 1, -1);
@@ -1618,39 +1594,43 @@ int event_hook(void *hook_data, void *call_data)
                        }
     }
   }
-  
   if(event_viewer_data->pos->len >= event_viewer_data->num_visible_events )
     return TRUE;
   else
     return FALSE;
+
 }
 
 
 
 static void event_update_selection(EventViewerData *event_viewer_data)
 {
+      
   guint i;
   GPtrArray *positions = event_viewer_data->pos;
   g_info("event_update_selection");
 
   for(i=0;i<positions->len;i++) {
-    LttvTracesetContextPosition *cur_pos = 
-      (LttvTracesetContextPosition*)g_ptr_array_index(positions, i);
-    if(lttv_traceset_context_pos_pos_compare(cur_pos, 
+    LttvTracesetPosition *cur_pos = 
+               (LttvTracesetPosition*)g_ptr_array_index(positions, i);
+    if(lttv_traceset_position_compare(cur_pos, 
           event_viewer_data->currently_selected_position) == 0) {
       GtkTreePath *path = gtk_tree_path_new_from_indices(i, -1);
                        if(path) {
              gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
                                     path, NULL, FALSE);
              gtk_tree_path_free(path);
-                       }
+              break;
+                        }               
     }
-  }
+  } 
 }
 
 static int current_time_get_first_event_hook(void *hook_data, void *call_data)
 {
+#ifdef BABEL_CLEANUP 
   EventViewerData *event_viewer_data = (EventViewerData*)hook_data;
+   
   LttvTracefileContext *tfc = (LttvTracefileContext*)call_data;
   LttEvent *e = ltt_tracefile_get_event(tfc->tf);
 
@@ -1669,73 +1649,45 @@ static int current_time_get_first_event_hook(void *hook_data, void *call_data)
   lttv_traceset_context_position_save(tfc->t_context->ts_context, 
       event_viewer_data->current_time_get_first);
   return TRUE;
+#endif // BABEL_CLEANUP 
 }
 
 
 gboolean update_current_time(void * hook_data, void * call_data)
 {
+      
+        //LttvEvent * e = (LttvEvent *)call_data;
   g_info("update_current_time");
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
   const LttTime * current_time = (LttTime*)call_data;
-  LttvTracesetContext * tsc =
-        lttvwindow_get_traceset_context(event_viewer_data->tab);
+  LttvTraceset * ts =
+        lttvwindow_get_traceset(event_viewer_data->tab);
   
   /* If the currently selected event time != current time, set the first event
    * with this time as currently selected. */
-  LttTime pos_time = lttv_traceset_context_position_get_time(
-      event_viewer_data->currently_selected_position);
+  LttTime pos_time = lttv_traceset_position_get_time(
+                        event_viewer_data->currently_selected_position);
+     
   if(ltt_time_compare(pos_time, *current_time) != 0) {
-    
-    lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc,
-        *current_time);
-    lttv_process_traceset_middle(tsc, *current_time, G_MAXUINT,
-                                   NULL);
-
-    /* Get the first event that passes in the filter */
-    event_viewer_data->current_time_get_first =
-                lttv_traceset_context_position_new(tsc);
-    LttvHooks *hooks = lttv_hooks_new();
-    lttv_hooks_add(hooks,
-                   current_time_get_first_event_hook,
-                   event_viewer_data,
-                   LTTV_PRIO_DEFAULT);
-
-    lttv_process_traceset_begin(tsc,
-        NULL, NULL, NULL, hooks, NULL);
-    
-    lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT, NULL);
-    
-    lttv_process_traceset_end(tsc,
-        NULL, NULL, NULL, hooks, NULL);
    
-    lttv_hooks_destroy(hooks);
+        /*create position*/
+        LttvTracesetPosition *currentPosition = 
+                        lttv_traceset_create_time_position(ts,*current_time );
+        /*seek to current position*/
+        lttv_traceset_seek_to_position(currentPosition);
+    
+    event_viewer_data->currently_selected_position = 
+                                        lttv_traceset_create_position(ts);
+
 
-    lttv_traceset_context_position_copy(
-        event_viewer_data->currently_selected_position,
-        event_viewer_data->current_time_get_first);
-    lttv_traceset_context_position_destroy(
-        event_viewer_data->current_time_get_first);
-    pos_time = lttv_traceset_context_position_get_time(
-        event_viewer_data->currently_selected_position);
   }
 
-  LttTime time = ltt_time_sub(pos_time, tsc->time_span.start_time);
-  double new_value = ltt_time_to_double(time);
   event_viewer_data->report_position = FALSE;
-  /* Change the viewed area if does not match */
-  if(lttv_traceset_context_pos_pos_compare(
-        event_viewer_data->currently_selected_position,
-        event_viewer_data->first_event) < 0
-    ||
-     lttv_traceset_context_pos_pos_compare(
-        event_viewer_data->currently_selected_position,
-        event_viewer_data->last_event) > 0) {
-    gtk_adjustment_set_value(event_viewer_data->vadjust_c, new_value);
-  } else {
+  
     /* Simply update the current time : it is in the list */
-    event_update_selection(event_viewer_data);
-  }
+  event_update_selection(event_viewer_data);
   event_viewer_data->report_position = TRUE;
   
   return FALSE;
@@ -1743,47 +1695,27 @@ gboolean update_current_time(void * hook_data, void * call_data)
 
 gboolean update_current_position(void * hook_data, void * call_data)
 {
+
   g_info("update_current_position");
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
-  const LttvTracesetContextPosition *current_pos =
-    (LttvTracesetContextPosition*)call_data;
-  LttvTracesetContext * tsc =
-        lttvwindow_get_traceset_context(event_viewer_data->tab);
+  const LttvTracesetPosition *current_pos = (LttvTracesetPosition*)call_data;
   
-  if(lttv_traceset_context_pos_pos_compare(
+  if(lttv_traceset_position_compare(
         event_viewer_data->currently_selected_position, current_pos) != 0) {
-    lttv_traceset_context_position_copy(
-        event_viewer_data->currently_selected_position, current_pos);
-
-    /* Change the viewed area if does not match */
-    if(lttv_traceset_context_pos_pos_compare(
-          event_viewer_data->currently_selected_position,
-          event_viewer_data->first_event) < 0
-      ||
-       lttv_traceset_context_pos_pos_compare(
-          event_viewer_data->currently_selected_position,
-          event_viewer_data->last_event) > 0) {
-      LttTime time = lttv_traceset_context_position_get_time(current_pos);
-      time = ltt_time_sub(time, tsc->time_span.start_time);
-      double new_value = ltt_time_to_double(time);
-      gtk_adjustment_set_value(event_viewer_data->vadjust_c, new_value);
-    } else {
+                event_viewer_data->currently_selected_position = current_pos;
       /* Simply update the current time : it is in the list */
       event_update_selection(event_viewer_data);
     }
-
-  }
-
-
   return FALSE;
+
 }
 
 gboolean timespan_changed(void * hook_data, void * call_data)
 {
+       
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
-  LttvTracesetContext * tsc =
-        lttvwindow_get_traceset_context(event_viewer_data->tab);
-  TimeInterval time_span = tsc->time_span;
+  LttvTraceset * ts = lttvwindow_get_traceset(event_viewer_data->tab);
+  TimeInterval time_span = lttv_traceset_get_time_span(ts);
  
   LttTime end;
 
@@ -1802,38 +1734,36 @@ gboolean timespan_changed(void * hook_data, void * call_data)
 
 gboolean traceset_changed(void * hook_data, void * call_data)
 {
+
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
-  LttvTracesetContext * tsc =
-        lttvwindow_get_traceset_context(event_viewer_data->tab);
-  TimeInterval time_span = tsc->time_span;
+  LttvTraceset * ts = lttvwindow_get_traceset(event_viewer_data->tab);
+  TimeInterval time_span = lttv_traceset_get_time_span(ts);
+  
   LttTime end;
   gtk_list_store_clear(event_viewer_data->store_m);
   g_ptr_array_set_size(event_viewer_data->pos, 0);
-
+  
   end = ltt_time_sub(time_span.end_time, time_span.start_time);
   event_viewer_data->vadjust_c->upper = ltt_time_to_double(end);
-
+#ifdef BABEL_CLEANUP
   /* Reset the positions */
-  lttv_traceset_context_position_destroy(
-      event_viewer_data->currently_selected_position);
-  lttv_traceset_context_position_destroy(
-      event_viewer_data->first_event);
-  lttv_traceset_context_position_destroy(
-      event_viewer_data->last_event);
+  lttv_traceset_destroy_position(event_viewer_data->currently_selected_position);
+  lttv_traceset_destroy_position(event_viewer_data->first_event);
+  lttv_traceset_destroy_position(event_viewer_data->last_event);
  
   event_viewer_data->currently_selected_position =
-    lttv_traceset_context_position_new(tsc);
+                                lttv_traceset_create_position(ts);
   event_viewer_data->first_event =
-    lttv_traceset_context_position_new(tsc);
+                                lttv_traceset_create_position(ts);
   event_viewer_data->last_event =
-    lttv_traceset_context_position_new(tsc);
+                                lttv_traceset_create_position(ts);
 
   get_events(event_viewer_data->vadjust_c->value, event_viewer_data);
+#endif //babel_cleanup
   //  event_viewer_data->vadjust_c->value = 0;
 
        request_background_data(event_viewer_data);
-       
+
   return FALSE;
 }
 
@@ -1859,6 +1789,7 @@ gint evd_redraw_notify(void *hook_data, void *call_data)
 
 void gui_events_free(gpointer data)
 {
+#ifdef BABEL_CLEANUP
   LttvPluginEVD *plugin_evd = (LttvPluginEVD*)data;
   Tab *tab = plugin_evd->evd->tab;
   EventViewerData *event_viewer_data = plugin_evd->evd;
@@ -1906,6 +1837,7 @@ void gui_events_free(gpointer data)
       event_viewer_data);
   //g_free(event_viewer_data);
   g_object_unref(plugin_evd);
+#endif // BABEL_CLEANUP
 }
 
 
index 93b0df2e9968cfbec7c955643fd9463b1c5f1ed9..0be8a59abb1f57ab12565cec44287d7b9e3eec4a 100644 (file)
@@ -7,6 +7,7 @@
 typedef struct _EventViewerData EventViewerData;
 
 struct _EventViewerData {
+  
 
   Tab * tab;
   LttvPluginTab *ptab;
@@ -43,16 +44,16 @@ struct _EventViewerData {
   
   gint num_visible_events;
   
-  LttvTracesetContextPosition *currently_selected_position;
+  LttvTracesetPosition *currently_selected_position;
   gboolean update_cursor; /* Speed optimisation : do not update cursor when 
                              unnecessary */
   gboolean report_position; /* do not report position when in current_time
                                update */
+  LttvTracesetPosition *first_event;  /* Time of the first event shown */
+  
+  LttvTracesetPosition *last_event;  /* Time of the last event shown */
 
-  LttvTracesetContextPosition *first_event;  /* Time of the first event shown */
-  LttvTracesetContextPosition *last_event;  /* Time of the first event shown */
-
-  LttvTracesetContextPosition *current_time_get_first; 
+  LttvTracesetPosition *current_time_get_first; 
 
   LttvFilter *main_win_filter;
 
index 3aeac8d11f3cb68bf7c893552972b41bc7a7498d..ed4e4dafd9d54c6dbe828ee68dcdf46ce4dd9a85 100644 (file)
@@ -28,7 +28,7 @@
 /*
  * Implementation
  */
-
+#ifdef BABEL_CLEANUP
 static void evd_update_filter(LttvPlugin *parent, LttvFilter *filter)
 {
   LttvPluginEVD *self = LTTV_PLUGIN_EVD(parent);
@@ -37,14 +37,16 @@ static void evd_update_filter(LttvPlugin *parent, LttvFilter *filter)
   self->evd->filter = filter;
   evd_redraw_notify(self->evd, NULL);
 }
-
+#endif //babel cleanup
 
 static void
 lttv_plugin_evd_class_init (LttvPluginEVDClass *klass)
 {
   LttvPluginClass *parent_klass;
   parent_klass = &klass->parent;
+  #ifdef BABEL_CLEANUP
   parent_klass->update_filter = evd_update_filter;
+#endif //babel cleanup
   g_type_class_add_private (klass, sizeof (EventViewerData));
 }
 
index 34bce0a9bfd066e6e9832ea48a46e2657025bd8c..ae56ee67354108613cf5b8793c3b61414f48a2c6 100644 (file)
@@ -226,7 +226,6 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor)
 int SetTraceset(Tab * tab, LttvTraceset *traceset)
 {
   
-  guint i;
   TimeInterval time_span;
   TimeWindow new_time_window;
   LttTime new_current_time;
@@ -710,7 +709,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data)
 
 gboolean lttvwindow_process_pending_requests(Tab *tab)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   LttvTracesetContext *tsc;
   LttvTracefileContext *tfc;
   GSList *list_in = NULL;
@@ -987,11 +986,12 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
             /* Process the traceset with only state hooks */
 #ifdef DEBUG
             seek_count =
-#endif
+
                lttv_process_traceset_middle(tsc,
                                             ltt_time_infinite,
                                             G_MAXUINT,
                                             events_request->start_position);
+#endif
             g_assert(lttv_traceset_context_ctx_pos_compare(tsc,
                          events_request->start_position) == 0);
 
@@ -1500,8 +1500,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
 static gboolean
 live_trace_update_handler(Tab *tab)
 {  
-       unsigned int updated_count;
 #ifdef BABEL_CLEANUP
+       unsigned int updated_count;
        LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
        TimeInterval initial_time_span = tsc->time_span;
        TimeInterval updated_time_span;
@@ -1541,7 +1541,7 @@ live_trace_update_handler(Tab *tab)
 
 static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   LttvTraceset *traceset = tab->traceset_info->traceset;
   guint i;
   guint num_traces = lttv_traceset_number(traceset);
@@ -1725,7 +1725,7 @@ void add_trace(GtkWidget * widget, gpointer user_data)
 
 void remove_trace(GtkWidget *widget, gpointer user_data)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   LttTrace *trace;
   LttvTrace * trace_v;
   LttvTraceset * traceset;
@@ -2067,7 +2067,7 @@ void save_as(GtkWidget * widget, gpointer user_data)
 
 void zoom(GtkWidget * widget, double size)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   TimeInterval time_span;
   TimeWindow new_time_window;
   LttTime    current_time, time_delta;
@@ -3347,30 +3347,23 @@ void current_time_change_manager       (Tab *tab,
   tab->current_time_manager_lock = FALSE;
 }
 
-void current_position_change_manager(Tab *tab,
-                                     LttvTracesetPosition *pos)
+void current_position_change_manager(Tab *tab, LttvTracesetPosition *pos)
 {
-    #ifdef BABEL_CLEANUP
-  LttvTracesetContext *tsc =
-    LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
-  int retval;
-
-  retval= lttv_process_traceset_seek_position(tsc, pos);
-  g_assert_cmpint(retval, ==, 0);
-  LttTime new_time = lttv_traceset_context_position_get_time(pos);
+  lttv_traceset_seek_to_position( pos);
+
+  LttTime new_time = lttv_traceset_position_get_time(pos);
   /* Put the context in a state coherent position */
-  lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero);
-  
+#ifdef BABEL_CLEANUP
+   lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero);
+#endif /* BABEL_CLEANUP */
   current_time_change_manager(tab, new_time);
   
   set_current_position(tab, pos);
-    #endif /* BABEL_CLEANUP */
 }
 
 static void on_timebar_starttime_changed(Timebar *timebar,
                                gpointer user_data)
 {
        Tab *tab = (Tab *)user_data;
        LttvTraceset * ts =tab->traceset_info->traceset;
        TimeInterval time_span = lttv_traceset_get_time_span(ts);
@@ -3407,7 +3400,6 @@ static void on_timebar_starttime_changed(Timebar *timebar,
 static void on_timebar_endtime_changed(Timebar *timebar,
                                gpointer user_data)
 {
-
        Tab *tab = (Tab *)user_data;
         LttvTraceset * ts =tab->traceset_info->traceset;
         TimeInterval time_span = lttv_traceset_get_time_span(ts);
@@ -3452,7 +3444,6 @@ static void on_timebar_currenttime_changed(Timebar *timebar,
 void scroll_value_changed_cb(GtkWidget *scrollbar,
                              gpointer user_data)
 {
-   
   Tab *tab = (Tab *)user_data;
   TimeWindow new_time_window;
   LttTime time;
index 4f12082164dea00c5b6fe1b25fbe47c6ac042ecd..9e55661fa2a47fe8d3b64639888d111bdec817dd 100644 (file)
@@ -142,8 +142,13 @@ create_MWindow (void)
   MWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_size_request (MWindow, 100, 50);
   gtk_window_set_title (GTK_WINDOW (MWindow), "Linux Trace Toolkit Viewer");
+  
+  /* making the window a size higher than 80% of the screen cause a gtk glitch 
+   * where the window is automaticly going fullscreen but the widgets stay 
+   * the normal size.
+   */
   gtk_window_set_default_size (GTK_WINDOW (MWindow),
-      gdk_screen_width()*0.9, gdk_screen_height()*0.9);
+                       gdk_screen_width()*0.8, gdk_screen_height()*0.8);
   gtk_window_set_icon(GTK_WINDOW(MWindow), create_pixbuf("lttng_logo.svg"));
   
   MVbox = gtk_vbox_new (FALSE, 0);
index 60c18157cecbd99d106298c9628ac8f52e54421e..d76ef62953f73388e824b382de565041c1a5dc5a 100644 (file)
 #include <ltt/ltt.h>
 #include <lttv/lttv.h>
 #include <lttv/state.h>
+#include <lttv/traceset.h>
 #ifdef BABEL_CLEANUP
 #include <lttv/stats.h>
 #endif /* BABEL_CLEANUP */
 #include <lttvwindow/mainwindow.h>   
-#include <lttvwindow/mainwindow-private.h>   
+#include <lttvwindow/mainwindow-private.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/toolbar.h>
 #include <lttvwindow/menu.h>
@@ -118,13 +119,11 @@ void set_current_time(Tab *tab, const LttTime *current_time)
 
 void set_current_position(Tab *tab, const LttvTracesetPosition *pos)
 {
- #ifdef BABEL_CLEANUP
-
   LttvAttributeValue value;
   LttvHooks * tmp;
   gboolean retval;
 
-  tab->current_time = lttv_traceset_context_position_get_time(pos);
+  tab->current_time = lttv_traceset_position_get_time(pos);
 
   retval= lttv_iattribute_find_by_path(tab->attributes,
     "hooks/updatecurrentposition", LTTV_POINTER, &value);
@@ -133,7 +132,6 @@ void set_current_position(Tab *tab, const LttvTracesetPosition *pos)
   if (tmp != NULL) {
     lttv_hooks_call(tmp, (void *) pos);
   }
-#endif /*BABEL_CLEANUP*/
 }
 
 void add_toolbar_constructor(MainWindow *mw, LttvToolbarClosure *toolbar_c)
@@ -1231,9 +1229,14 @@ __EXPORT LttvTracesetStats* lttvwindow_get_traceset_stats(Tab *tab)
 }
 #endif /*BABEL_CLEANUP*/
 
+__EXPORT LttvTraceset *lttvwindow_get_traceset(Tab *tab)
+{
+        return tab->traceset_info->traceset;
+}
+
 void events_request_free(EventsRequest *events_request)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   if(events_request == NULL) return;
 
   if(events_request->start_position != NULL)
@@ -1267,7 +1270,7 @@ void events_request_free(EventsRequest *events_request)
        lttv_hooks_destroy(events_request->after_request);
 
   g_free(events_request);
-  #endif /*BABEL_CLEANUP*/
+#endif /*BABEL_CLEANUP*/
 }
 
 
index 03ff9cc04e5daf1a86c64fe963ca7d171910b498..b83c058c0b91861e5ad1549922b098103960752f 100644 (file)
@@ -254,10 +254,10 @@ FIXME : explain other important events
 #include <gtk/gtk.h>
 #include <ltt/ltt.h>
 #include <ltt/time.h>
+#include <lttv/traceset.h>
 #include <lttv/hook.h>
 #ifdef BABEL_CLEANUP
 #include <lttv/stats.h>
-
 #include <lttv/filter.h>
 #endif /* BABEL_CLEANUP */
 #include <lttvwindow/mainwindow.h>
@@ -820,6 +820,7 @@ void lttvwindow_report_filter(Tab *tab, LttvFilter *filter);
 LttvTracesetStats* lttvwindow_get_traceset_stats(Tab *tab);
 #endif /*BABEL_CLEANUP*/
 
+LttvTraceset* lttvwindow_get_traceset(Tab *tab);
 
 /* set_time_window 
  *
diff --git a/runlttv b/runlttv
index 70e236210e4c81d6abe5a6b6f5f737cadcf33961..a1be65facdf822fd871413cbe288a923240e1050 100755 (executable)
--- a/runlttv
+++ b/runlttv
@@ -15,9 +15,9 @@ BUILDPATH=$(dirname $0)
 RCFILE="$(dirname $0)/.runlttvrc"
 TEXTLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m textDump"
 EVALLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m sync_chain_batch"
-GRAPHLIBS="-L ${BUILDPATH}/lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow"
+GRAPHLIBS="-L ${BUILDPATH}/lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\
+"-L ${BUILDPATH}/lttv/modules/gui/detailedevents/.libs -m guievents"
 #"-L ${BUILDPATH}/lttv/modules/gui/controlflow/.libs -m guicontrolflow "\
-#"-L ${BUILDPATH}/lttv/modules/gui/detailedevents/.libs -m guievents "\
 #"-L ${BUILDPATH}/lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\
 #"-L ${BUILDPATH}/lttv/modules/gui/statistics/.libs -m guistatistics "\
 #"-L ${BUILDPATH}/lttv/modules/gui/resourceview/.libs -m resourceview "\
@@ -89,7 +89,7 @@ LTTV_ARGS="$BOPTIONS $LIBS $TRACEFILES $AOPTIONS"
 if [ "$HELPER" = "gdb" ]; then
        LD_LIBRARY_PATH=${BUILDPATH}/ltt/.libs gdb --args $LTTV_EXEC $LTTV_ARGS
 elif [ "$HELPER" = "valgrind" ]; then
-       LD_LIBRARY_PATH=${BUILDPATH}/ltt/.libs G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $LTTV_ARGS
+       LD_LIBRARY_PATH=${BUILDPATH}/ltt/.libs G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind  --show-reachable=yes --leak-check=full --tool=memcheck --suppressions=debug/gtk.suppression --track-origins=yes --error-limit=no $LTTV_EXEC $LTTV_ARGS
 elif [ "$HELPER" = "massif" ]; then
        LD_LIBRARY_PATH=${BUILDPATH}/ltt/.libs valgrind --tool=massif $LTTV_EXEC $LTTV_ARGS
 elif [ "$HELPER" = "strace" ]; then
This page took 0.053533 seconds and 4 git commands to generate.