mega modif by Mathieu Desnoyers. Independant main windows, multiple tracesets, contro...
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 13 Oct 2003 04:50:53 +0000 (04:50 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 13 Oct 2003 04:50:53 +0000 (04:50 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@298 04897980-b3bd-0310-b5e0-8ef037075253

32 files changed:
ltt/branches/poly/include/ltt/ltt.h
ltt/branches/poly/include/ltt/trace.h
ltt/branches/poly/include/lttv/common.h
ltt/branches/poly/include/lttv/gtkTraceSet.h
ltt/branches/poly/include/lttv/mainWindow.h
ltt/branches/poly/include/lttv/processTrace.h
ltt/branches/poly/include/lttv/traceset.h
ltt/branches/poly/ltt/convert/sysInfo
ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/lttv/attribute.c
ltt/branches/poly/lttv/hook.c
ltt/branches/poly/lttv/modules/gui/API/gtkTraceSet.c
ltt/branches/poly/lttv/modules/gui/API/menu.c
ltt/branches/poly/lttv/modules/gui/API/toolbar.c
ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c
ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c
ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c
ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c
ltt/branches/poly/lttv/modules/guiControlFlow/CFV.h
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h
ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c
ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h
ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c
ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h
ltt/branches/poly/lttv/modules/guiControlFlow/module.c
ltt/branches/poly/lttv/modules/guiEvents.c
ltt/branches/poly/lttv/modules/guiStatistic/.deps/guiStatistic.Plo
ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c
ltt/branches/poly/lttv/processTrace.c
ltt/branches/poly/lttv/stats.c
ltt/branches/poly/lttv/traceset.c

index 74cbacebacbf6d3686e0117e179b421cb6d0473a..158553622fc02102be136bda10faf9ac8733f12c 100644 (file)
@@ -80,6 +80,13 @@ typedef struct _LttTime {
   unsigned long tv_nsec;
 } LttTime;
 
+
+typedef struct _TimeInterval{
+  LttTime startTime;
+  LttTime endTime;  
+} TimeInterval;
+
+
 typedef uint64_t LttCycleCount;
 
 #define NANSECOND_CONST       1000000000
index 18ef016c5ef9fac30d8f4e34c3c1a3b2456e1948..aa5cb6ba0d525c9bf5de0305e2a7a082f21aa60c 100644 (file)
    When a trace is closed, all the associated facilities, types and fields
    are released as well. */
 
-LttTrace *ltt_trace_open(char *pathname);
+LttTrace *ltt_trace_open(const char *pathname);
+
+/* copy reopens a trace */
+LttTrace *ltt_trace_copy(LttTrace *self);
 
 void ltt_trace_close(LttTrace *t); 
 
index 1af0790c4691e77bf600583d871b226d03bc6163..22057a966ebe3e801916a5bc2a23cc9f7b0c616d 100644 (file)
@@ -6,18 +6,12 @@
 #include <gtk/gtk.h>
 
 typedef struct _mainWindow mainWindow;
-typedef struct _systemView systemView;
+//typedef struct _systemView systemView;
 typedef struct _tab tab;
-typedef struct _TimeInterval TimeInterval;
 
 /* constructor of the viewer */
 typedef GtkWidget * (*lttv_constructor)(mainWindow * main_window);
 typedef lttv_constructor view_constructor;
 
-struct _TimeInterval{
-  LttTime startTime;
-  LttTime endTime;  
-};
-
 
 #endif // COMMON_H
index 6dd9ccd4132b40f925daadd16f1f2d1ddcf1c37c..5454758e5f9f11bfb8be92b793e423a1531d5d47 100644 (file)
@@ -15,6 +15,7 @@
 #include <lttv/hook.h>
 #include <lttv/common.h>
 #include <lttv/stats.h>
+#include <lttv/mainWindow.h>
 
 /**
  * Function to register a view constructor so that main window can generate
@@ -97,15 +98,15 @@ void UpdateStatus(mainWindow *main_win, char *info);
 
 
 /**
- * Function to get the current time interval of the current tab.
+ * Function to get the current time window of the current tab.
  * It will be called by a viewer's hook function to update the 
- * time interval of the viewer and also be called by the constructor
+ * time window of the viewer and also be called by the constructor
  * of the viewer.
  * @param main_win the main window the viewer belongs to.
  * @param time_interval a pointer where time interval will be stored.
  */
 
-void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval);
+void GetTimeWindow(mainWindow *main_win, TimeWindow *Time_Window);
 
 
 /**
@@ -116,8 +117,12 @@ void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval);
  * @param time_interval a pointer where time interval is stored.
  */
 
-void SetTimeInterval(mainWindow *main_win, TimeInterval *time_interval);
+void SetTimeWindow(mainWindow *main_win, TimeWindow *Time_Window);
 
+/**
+ * Function to get the time span of the main window's traceset.
+ */
+void GetTracesetTimeSpan(mainWindow *main_win, TimeInterval *Time_Interval);
 
 /**
  * Function to get the current time/event of the current tab.
@@ -167,7 +172,7 @@ void SetCurrentTime(mainWindow *main_win, LttTime *time);
  * Function to register a hook function for a viewer to set/update its
  * time interval.
  * It will be called by the constructor of the viewer.
- * @param hook hook function of the viewer.
+ * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
@@ -180,7 +185,7 @@ void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data,
  * Function to unregister a viewer's hook function which is used to 
  * set/update the time interval of the viewer.
  * It will be called by the destructor of the viewer.
- * @param hook hook function of the viewer.
+ * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
@@ -378,7 +383,7 @@ void contextRemoveHooks(mainWindow *main_win ,
  * @param end end time of the traceset.
  */
 
-void getTracesetTimeSpan(mainWindow *main_win, LttTime * start, LttTime* end);
+void getTracesetTimeSpan(mainWindow *main_win, TimeInterval *time_span);
 
 
 /**
index 391cef0fae8e074d187a58434175fcd44e51de59..0a43bfa59f6d9750b19a034e6d56f49c064675df 100644 (file)
 
 #include <lttv/common.h>
 #include <lttv/gtkcustom.h>
+#include <lttv/hook.h>
+#include <lttv/stats.h>
 
 typedef struct _WindowCreationData {
        int argc;
        char ** argv;
 } WindowCreationData;
 
+typedef struct _TimeWindow {
+       LttTime startTime;
+       LttTime Time_Width;
+} TimeWindow;
+
+typedef struct _TracesetInfo {
+       gchar* path;
+       LttvHooks 
+         *before_traceset,
+         *after_traceset,
+         *before_trace,
+         *after_trace,
+         *before_tracefile,
+         *after_tracefile,
+         *before_event,
+         *after_event;
+        //FIXME? TracesetContext and stats in same or different variable ?
+       LttvTracesetStats * TracesetContext;
+       LttvTraceset * traceset;
+} TracesetInfo ;
+
+
 struct _mainWindow{
   GtkWidget*      MWindow;            /* Main Window */
-  systemView *    SystemView;         /* System view displayed in this window*/
+//  systemView *    SystemView;         /* System view displayed in this window*/
 
   /* Status bar information */
   //  guint         MainSBarContextID;    /* Context ID of main status bar */
@@ -33,35 +57,47 @@ struct _mainWindow{
   GtkWidget*           HelpContents;/* Window to display help contents */
   GtkWidget*           AboutBox;    /* Window  about information */
  
-  LttvTracesetContext * traceset_context; 
-  LttvTraceset * traceset;  /* trace set associated with the window */
+  //LttvTracesetContext * traceset_context; 
+  //LttvTraceset * traceset;  /* trace set associated with the window */
   //  lttv_trace_filter * filter; /* trace filter associated with the window */
-  
 
+  /* Traceset related information */
+  TracesetInfo * Traceset_Info; 
+  /* Attributes for trace reading hooks local to the main window */
+  LttvIAttribute * Attributes;
+  
   tab * Tab;
   tab * CurrentTab;
-  LttvIAttribute * Attributes;
 
   WindowCreationData * winCreationData; 
 };
 
 
-struct _systemView{
-  gpointer             EventDB;
-  gpointer             SystemInfo;
-  gpointer             Options;
-  mainWindow         * Window;
-  struct _systemView * Next;
-};
+//struct _systemView{
+//  gpointer             EventDB;
+//  gpointer             SystemInfo;
+//  gpointer             Options;
+//  mainWindow         * Window;
+//  struct _systemView * Next;
+//};
 
 struct _tab{
   GtkWidget * label;
   GtkCustom * custom;
 
-  LttTime traceStartTime;
-  LttTime traceEndTime;
-  LttTime startTime;
-  LttTime endTime;
+  
+ // Will have to read directly at the main window level, as we want
+ // to be able to modify a traceset on the fly.
+  //LttTime traceStartTime;
+  //LttTime traceEndTime;
+  
+  // startTime is the left of the visible area. Corresponds to the scrollbar
+  // value.
+  // Time_Width is a zoom dependant value (corresponding to page size)
+  TimeWindow Time_Window;
+  
+  // The current time is the time selected in the visible area by the user,
+  // not the scrollbar value.
   LttTime currentTime;
   LttvIAttribute * Attributes;
 
index 08b28e3556239c33f6963dfcd9f0c3a5caabd10b..610000cb19e276cdb41a6f33242157ae475830d1 100644 (file)
@@ -71,6 +71,7 @@ struct _LttvTracesetContext {
   LttvHooks *after;
   LttvTraceContext **traces;
   LttvAttribute *a;
+  TimeInterval *Time_Span;
 };
 
 struct _LttvTracesetContextClass {
index 65fedbd814d184db3521d832218d1c73896022e2..ecf1046141523a85e01c045b5eeed682c259143d 100644 (file)
@@ -14,6 +14,12 @@ typedef struct _LttvTraceset LttvTraceset;
 
 LttvTraceset *lttv_traceset_new();
 
+LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig);
+
+LttvTraceset *lttv_traceset_load(const gchar *filename);
+
+gint lttv_traceset_save(LttvTraceset *s);
+
 void lttv_traceset_destroy(LttvTraceset *s);
 
 void lttv_traceset_add(LttvTraceset *s, LttTrace *t);
@@ -24,7 +30,6 @@ LttTrace *lttv_traceset_get(LttvTraceset *s, unsigned i);
 
 void lttv_traceset_remove(LttvTraceset *s, unsigned i);
 
-
 /* An attributes table is attached to the set and to each trace in the set. */
 
 LttvAttribute *lttv_traceset_attribute(LttvTraceset *s);
@@ -32,6 +37,5 @@ LttvAttribute *lttv_traceset_attribute(LttvTraceset *s);
 LttvAttribute *lttv_traceset_trace_attribute(LttvTraceset *s, 
     unsigned i);
 
-
 #endif // TRACESET_H
 
index 1a81012e9a686a25f665ca8170c26c9003df31af..fdd7b596a459fe273f2b16feab2123cc64121781 100755 (executable)
@@ -23,9 +23,12 @@ echo "kernel_version="$KERNEL_VERSION >> $outputFile
 MACHINE="`uname -m`"
 echo "machine="$MACHINE >> $outputFile
 
+
+# not available anymore in uname version 5 and newer
 PROCESSOR="`uname -p`"
 echo "processor="$PROCESSOR >> $outputFile
 
+# not available anymore in uname version 5 and newer
 HARDWARE_PLATFORM="`uname -i`"
 echo "hardware_platform="$HARDWARE_PLATFORM >> $outputFile
 
index e3829fbfbe6ca5006fa7390739ee3b03c88cbc7a..a2f7bbadcc380376751ea64acaa6016ba8bd6afb 100644 (file)
@@ -404,7 +404,7 @@ void getCpuFileInfo(LttTrace *t, char* cpu)
  *are released as well.
  ****************************************************************************/
 
-LttTrace *ltt_trace_open(char *pathname)
+LttTrace *ltt_trace_open(const char *pathname)
 {
   LttTrace  * t;
   LttSystemDescription * sys_description;
@@ -463,6 +463,16 @@ LttTrace *ltt_trace_open(char *pathname)
   return t;
 }
 
+/******************************************************************************
+ * When we copy a trace, we want all the opening actions to happen again :
+ * the trace will be reopened and totally independant from the original.
+ * That's why we call ltt_trace_open.
+ *****************************************************************************/
+LttTrace *ltt_trace_copy(LttTrace *self)
+{
+  return ltt_trace_open(self->pathname);
+}
+
 void ltt_trace_close(LttTrace *t)
 {
   int i;
index 648beee4858ececa4f483b87ac643731b68a2aef..59241fb3e815cfc67862f6b52ec942de0ef81753 100644 (file)
@@ -335,6 +335,7 @@ static void
 attribute_finalize (LttvAttribute *self)
 {
   g_hash_table_destroy(self->names);
+  g_critical("attribute_finalize()");
   g_array_free(self->attributes, TRUE);
   G_OBJECT_CLASS(g_type_class_peek_parent(
       g_type_class_peek(LTTV_ATTRIBUTE_TYPE)))->finalize(G_OBJECT(self));
index dc9b3ac86fb123c06a16a43903c94902e3fc24c5..8edbb2afbee7fc34755a6508c5ae704211c875dc 100644 (file)
@@ -16,6 +16,7 @@ LttvHooks *lttv_hooks_new()
 
 void lttv_hooks_destroy(LttvHooks *h) 
 {
+  g_critical("lttv_hooks_destroy()");
   g_array_free(h, TRUE);
 }
 
index 336e1f8b21cdf49bdcf446cd7ca7335548e3565f..3c681a97561b27f9e70a7bff433877fc902aaa5b 100644 (file)
@@ -202,7 +202,23 @@ void UpdateStatus(mainWindow *main_win, char *info)
 
 
 /**
- * Function to get the current time interval of the current tab.
+ * Function to get the current time interval shown on the current tab.
+ * It will be called by a viewer's hook function to update the 
+ * shown time interval of the viewer and also be called by the constructor
+ * of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval will be stored.
+ */
+
+void GetTimeWindow(mainWindow *main_win, TimeWindow *Time_Window)
+{
+  //Time_Window->startTime = main_win->CurrentTab->Time_Window.startTime;
+  //Time_Window->Time_Width = main_win->CurrentTab->Time_Window.Time_Width;
+  *Time_Window = main_win->CurrentTab->Time_Window;
+}
+
+/**
+ * Function to get the current time interval of the current traceset.
  * It will be called by a viewer's hook function to update the 
  * time interval of the viewer and also be called by the constructor
  * of the viewer.
@@ -210,13 +226,15 @@ void UpdateStatus(mainWindow *main_win, char *info)
  * @param time_interval a pointer where time interval will be stored.
  */
 
-void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
+void getTracesetTimeSpan(mainWindow *main_win, TimeInterval *Time_Interval)
 {
-  time_interval->startTime = main_win->CurrentTab->startTime;
-  time_interval->endTime = main_win->CurrentTab->endTime;
+  //Time_Window->startTime = main_win->CurrentTab->Time_Window.startTime;
+  //Time_Window->Time_Width = main_win->CurrentTab->Time_Window.Time_Width;
+  *Time_Interval = *(LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext)->Time_Span);
 }
 
 
+
 /**
  * Function to set the time interval of the current tab.
  * It will be called by a viewer's signal handle associated with 
@@ -225,17 +243,16 @@ void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
  * @param time_interval a pointer where time interval is stored.
  */
 
-void SetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
+void SetTimeWindow(mainWindow *main_win, TimeWindow *Time_Window)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  main_win->CurrentTab->startTime = time_interval->startTime;
-  main_win->CurrentTab->endTime = time_interval->endTime;
+  main_win->CurrentTab->Time_Window = *Time_Window;
   g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
-                      "hooks/updatetimeinterval", LTTV_POINTER, &value));
+                      "hooks/updatetimewindow", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL)return;
-  lttv_hooks_call(tmp, time_interval);
+  if(tmp == NULL) return;
+  lttv_hooks_call(tmp, Time_Window);
 }
 
 
@@ -310,13 +327,13 @@ void GetFilter(mainWindow *main_win, Filter *filter)
  * @param main_win the main window the viewer belongs to.
  */
 
-void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data,
+void RegUpdateTimeWindow(LttvHook hook, gpointer hook_data,
                           mainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
   g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
-                      "hooks/updatetimeinterval", LTTV_POINTER, &value));
+                      "hooks/updatetimewindow", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL){    
     tmp = lttv_hooks_new();
@@ -335,13 +352,13 @@ void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void UnregUpdateTimeInterval(LttvHook hook, gpointer hook_data,
+void UnregUpdateTimeWindow(LttvHook hook, gpointer hook_data,
                             mainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
   g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
-                      "hooks/updatetimeinterval", LTTV_POINTER, &value));
+                      "hooks/updatetimewindow", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL) return;
   lttv_hooks_remove_data(tmp, hook, hook_data);
@@ -581,8 +598,9 @@ void SetHPaneDividor(mainWindow *main_win, gint position)
 void processTraceset(mainWindow *main_win, LttTime start, 
                     LttTime end, unsigned maxNumEvents)
 {
-  lttv_process_trace(start, end, main_win->traceset, 
-                    main_win->traceset_context,  maxNumEvents);
+  lttv_process_trace(start, end, main_win->Traceset_Info->traceset, 
+      LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext),
+      maxNumEvents);
 }
 
 /**
@@ -606,7 +624,8 @@ void contextAddHooks(mainWindow *main_win ,
                     LttvHooks *before_event, 
                     LttvHooks *after_event)
 {
-  LttvTracesetContext * tsc = main_win->traceset_context;
+  LttvTracesetContext * tsc = 
+         LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext);
   lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset,
                                  check_trace,before_trace,after_trace,
                                  check_tracefile,before_tracefile,after_tracefile,
@@ -635,7 +654,8 @@ void contextRemoveHooks(mainWindow *main_win ,
                        LttvHooks *before_event, 
                        LttvHooks *after_event)
 {
-  LttvTracesetContext * tsc = main_win->traceset_context;
+  LttvTracesetContext * tsc =
+        LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext);
   lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset,
                                     check_trace,before_trace,after_trace,
                                     check_tracefile,before_tracefile,after_tracefile,
@@ -643,43 +663,6 @@ void contextRemoveHooks(mainWindow *main_win ,
 }
 
 
-/**
- * Function to get the life span of the traceset
- * @param main_win the main window the viewer belongs to.
- * @param start start time of the traceset.
- * @param end end time of the traceset.
- */
-
-void getTracesetTimeSpan(mainWindow *main_win, LttTime * start, LttTime* end)
-{
-  LttvTraceset * traceset = main_win->traceset;
-  int numTraces = lttv_traceset_number(traceset);
-  int i;
-  LttTime s, e;
-  LttvTraceContext *tc;
-  LttTrace * trace;
-
-  for(i=0; i<numTraces;i++){
-    tc = main_win->traceset_context->traces[i];
-    trace = tc->t;
-
-    ltt_trace_time_span_get(trace, &s, &e);
-
-    if(i==0){
-      *start = s;
-      *end   = e;
-    }else{
-      if(s.tv_sec < start->tv_sec ||
-        (s.tv_sec == start->tv_sec && s.tv_nsec < start->tv_nsec))
-       *start = s;
-      if(e.tv_sec > end->tv_sec ||
-        (e.tv_sec == end->tv_sec && e.tv_nsec > end->tv_nsec))
-       *end = e;      
-    }
-  }
-}
-
-
 /**
  * Function to add/remove event hooks for state 
  * @param main_win the main window the viewer belongs to.
@@ -687,12 +670,14 @@ void getTracesetTimeSpan(mainWindow *main_win, LttTime * start, LttTime* end)
 
 void stateAddEventHooks(mainWindow *main_win )
 {
-  lttv_state_add_event_hooks((LttvTracesetState*)main_win->traceset_context);
+  lttv_state_add_event_hooks(
+       (LttvTracesetState*)main_win->Traceset_Info->TracesetContext);
 }
 
 void stateRemoveEventHooks(mainWindow *main_win )
 {
-  lttv_state_remove_event_hooks((LttvTracesetState*)main_win->traceset_context);
+  lttv_state_remove_event_hooks(
+       (LttvTracesetState*)main_win->Traceset_Info->TracesetContext);
 }
 
 
@@ -703,12 +688,14 @@ void stateRemoveEventHooks(mainWindow *main_win )
 
 void statsAddEventHooks(mainWindow *main_win )
 {
-  lttv_stats_add_event_hooks((LttvTracesetStats*)main_win->traceset_context);
+  lttv_stats_add_event_hooks(
+        (LttvTracesetStats*)main_win->Traceset_Info->TracesetContext);
 }
 
 void statsRemoveEventHooks(mainWindow *main_win )
 {
-  lttv_stats_remove_event_hooks((LttvTracesetStats*)main_win->traceset_context);
+  lttv_stats_remove_event_hooks(
+        (LttvTracesetStats*)main_win->Traceset_Info->TracesetContext);
 }
 
 /**
@@ -718,5 +705,5 @@ void statsRemoveEventHooks(mainWindow *main_win )
 
 LttvTracesetStats* getTracesetStats(mainWindow *main_win)
 {
-  return (LttvTracesetStats*)main_win->traceset_context;
+  return main_win->Traceset_Info->TracesetContext;
 }
index acaba636cbb0de7b46e9457e05fc3d52e35775ab..06babb470fdbbb97de219ff568e935b89dffc5a0 100644 (file)
@@ -9,6 +9,7 @@ inline LttvMenus *lttv_menus_new() {
  * (functions).
  */
 inline void lttv_menus_destroy(LttvMenus *h) {
+  g_critical("lttv_menus_destroy()");
   g_array_free(h, TRUE);
 }
 
index 48dc5947449b47f8e285599c6873c40b3f2baca8..ff16c42dcfb582d9fdf15a06f5f92f892bce4744 100644 (file)
@@ -9,6 +9,7 @@ inline LttvToolbars *lttv_toolbars_new() {
  * (functions).
  */
 inline void lttv_toolbars_destroy(LttvToolbars *h) {
+  g_critical("lttv_toolbars_destroy");
   g_array_free(h, TRUE);
 }
 
index 9e5fe0a4b755009c63ba2d57fa93ee504bac35df..44f5e61c3b866ec297a83f51bfdff27a4e1a4a82 100644 (file)
 #include <lttv/gtkTraceSet.h>
 #include <lttv/module.h>
 #include <lttv/gtkdirsel.h>
+#include <lttv/iattribute.h>
 
-#define PATH_LENGTH     256
+#define PATH_LENGTH          256
+#define DEFAULT_TIME_WIDTH_S   1
+
+//extern LttvTracesetContext * gTracesetContext;
+extern LttTrace *gInit_Trace ;
 
-extern LttvTracesetContext * gTracesetContext;
 
 /** Array containing instanced objects. */
 extern GSList * Main_Window_List;
@@ -702,6 +706,8 @@ void
 on_MWindow_destroy                     (GtkObject       *object,
                                         gpointer         user_data)
 {
+  mainWindow *Main_Window = (mainWindow*)user_data;
+  
   g_printf("There are : %d windows\n",g_slist_length(Main_Window_List));
 
   gWinCount--;
@@ -853,12 +859,16 @@ void insertMenuToolbarItem(mainWindow * mw)
 
 void constructMainWin(mainWindow * parent, WindowCreationData * win_creation_data)
 {
+  g_critical("constructMainWin()");
   //  systemView * sv = NULL; /* System view */
-  systemView * newSv;     /* New system view displayed in the new window */
+  //systemView * newSv;     /* New system view displayed in the new window */
   GtkWidget  * newWindow; /* New generated main window */
   mainWindow * newMWindow;/* New main window structure */
   GtkNotebook * notebook;
-
+  LttvIAttribute *attributes =
+         LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
+  LttvAttributeValue value;
+     
   //  if(parent) sv = parent->SystemView;
     
   newMWindow = g_new(mainWindow, 1);
@@ -866,39 +876,100 @@ void constructMainWin(mainWindow * parent, WindowCreationData * win_creation_dat
   // Add the object's information to the module's array 
   Main_Window_List = g_slist_append(Main_Window_List, newMWindow);
 
+
   newWindow  = create_MWindow();
   gtk_widget_show (newWindow);
     
-  newSv = g_new(systemView, 1);
+  //newSv = g_new(systemView, 1);
   //  if(sv){
   //    while(sv->Next) sv = sv->Next;
   //    sv->Next = newSv;
   //  }
 
-  newSv->EventDB = NULL;
-  newSv->SystemInfo = NULL;
-  newSv->Options  = NULL;
-  newSv->Next = NULL;
-  newSv->Window = newMWindow;
-
+  //newSv->EventDB = NULL;
+  //newSv->SystemInfo = NULL;
+  //newSv->Options  = NULL;
+  //newSv->Next = NULL;
+  //newSv->Window = newMWindow;
+  
+  newMWindow->Attributes = attributes;
+  
+  newMWindow->Traceset_Info = g_new(TracesetInfo,1);
+  newMWindow->Traceset_Info->path = NULL ;
+
+
+  newMWindow->Traceset_Info->before_traceset = lttv_hooks_new();
+  newMWindow->Traceset_Info->after_traceset = lttv_hooks_new();
+  newMWindow->Traceset_Info->before_trace = lttv_hooks_new();
+  newMWindow->Traceset_Info->after_trace = lttv_hooks_new();
+  newMWindow->Traceset_Info->before_tracefile = lttv_hooks_new();
+  newMWindow->Traceset_Info->after_tracefile = lttv_hooks_new();
+  newMWindow->Traceset_Info->before_event = lttv_hooks_new();
+  newMWindow->Traceset_Info->after_event = lttv_hooks_new();
+
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->before_traceset;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->after_traceset;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->before_trace;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/after",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->after_trace;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->before_tracefile;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->after_tracefile;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->before_event;
+  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after",
+      LTTV_POINTER, &value));
+  *(value.v_pointer) = newMWindow->Traceset_Info->after_event;
+  
   newMWindow->MWindow = newWindow;
   newMWindow->Tab = NULL;
   newMWindow->CurrentTab = NULL;
-  newMWindow->SystemView = newSv;
+  //newMWindow->SystemView = newSv;
   newMWindow->Attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
   if(parent){
-    newMWindow->traceset_context = parent->traceset_context;
-    newMWindow->traceset = parent->traceset;
+    newMWindow->Traceset_Info->traceset = 
+        lttv_traceset_copy(parent->Traceset_Info->traceset);
+    
+//FIXME copy not implemented in lower level
+    newMWindow->Traceset_Info->TracesetContext =
+       g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
+    lttv_context_init(
+       LTTV_TRACESET_CONTEXT(newMWindow->Traceset_Info->TracesetContext),
+       newMWindow->Traceset_Info->traceset);
+  //newMWindow->traceset_context = parent->traceset_context;
     newMWindow->winCreationData = parent->winCreationData;
   }else{
-    newMWindow->traceset_context = LTTV_TRACESET_CONTEXT(gTracesetContext);
-    newMWindow->traceset = (LTTV_TRACESET_CONTEXT(gTracesetContext))->ts;
+    newMWindow->Traceset_Info->traceset = lttv_traceset_new();
+
+    /* Add the command line trace */
+    if(gInit_Trace != NULL)
+      lttv_traceset_add(newMWindow->Traceset_Info->traceset, gInit_Trace);
+    /* NOTE : the context must be recreated if we change the traceset,
+     * ie : adding/removing traces */
+    newMWindow->Traceset_Info->TracesetContext =
+       g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
+    lttv_context_init(
+       LTTV_TRACESET_CONTEXT(newMWindow->Traceset_Info->TracesetContext),
+       newMWindow->Traceset_Info->traceset);
+
     newMWindow->winCreationData = win_creation_data;
   }
 
   insertMenuToolbarItem(newMWindow);
   
-  g_object_set_data(G_OBJECT(newWindow), "systemView", (gpointer)newSv);    
+  //g_object_set_data(G_OBJECT(newWindow), "systemView", (gpointer)newSv);    
   g_object_set_data(G_OBJECT(newWindow), "mainWindow", (gpointer)newMWindow);    
 
   //create a default tab
@@ -920,14 +991,21 @@ void constructMainWin(mainWindow * parent, WindowCreationData * win_creation_dat
   gWinCount++;
 }
 
+void Tab_Destructor(tab *Tab)
+{
+  if(Tab->Attributes)
+    g_object_unref(Tab->Attributes);
+  g_free(Tab);
+}
+
 void * create_tab(GtkWidget* parent, GtkNotebook * notebook, char * label)
 {
   GList * list;
   tab * tmpTab;
   mainWindow * mwData;
+  LttTime TmpTime;
 
   mwData = get_window_data_struct(parent);
-
   tmpTab = mwData->Tab;
   while(tmpTab && tmpTab->Next) tmpTab = tmpTab->Next;
   if(!tmpTab){
@@ -939,16 +1017,28 @@ void * create_tab(GtkWidget* parent, GtkNotebook * notebook, char * label)
     tmpTab = tmpTab->Next;
   }
   if(mwData->CurrentTab){
-    tmpTab->traceStartTime = mwData->CurrentTab->traceStartTime;
-    tmpTab->traceEndTime   = mwData->CurrentTab->traceEndTime;
-    tmpTab->startTime      = mwData->CurrentTab->startTime;
-    tmpTab->endTime        = mwData->CurrentTab->endTime;
+ // Will have to read directly at the main window level, as we want
+ // to be able to modify a traceset on the fly.
+ //   tmpTab->traceStartTime = mwData->CurrentTab->traceStartTime;
+ //   tmpTab->traceEndTime   = mwData->CurrentTab->traceEndTime;
+    tmpTab->Time_Window      = mwData->CurrentTab->Time_Window;
     tmpTab->currentTime    = mwData->CurrentTab->currentTime;
   }else{
-    getTracesetTimeSpan(mwData,&tmpTab->traceStartTime, &tmpTab->traceEndTime);
-    tmpTab->startTime   = tmpTab->traceStartTime;
-    tmpTab->endTime     = tmpTab->traceEndTime;
-    tmpTab->currentTime = tmpTab->traceStartTime;
+ // Will have to read directly at the main window level, as we want
+ // to be able to modify a traceset on the fly.
+  //  getTracesetTimeSpan(mwData,&tmpTab->traceStartTime, &tmpTab->traceEndTime);
+    tmpTab->Time_Window.startTime   = 
+           LTTV_TRACESET_CONTEXT(mwData->Traceset_Info->TracesetContext)->Time_Span->startTime;
+    if(DEFAULT_TIME_WIDTH_S <
+              LTTV_TRACESET_CONTEXT(mwData->Traceset_Info->TracesetContext)->Time_Span->endTime.tv_sec)
+      TmpTime.tv_sec = DEFAULT_TIME_WIDTH_S;
+    else
+      TmpTime.tv_sec =
+              LTTV_TRACESET_CONTEXT(mwData->Traceset_Info->TracesetContext)->Time_Span->endTime.tv_sec;
+    TmpTime.tv_nsec = 0;
+    tmpTab->Time_Window.Time_Width = TmpTime ;
+    tmpTab->currentTime.tv_sec = TmpTime.tv_sec / 2;
+    tmpTab->currentTime.tv_nsec = 0 ;
   }
   tmpTab->Attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
   //  mwData->CurrentTab = tmpTab;
@@ -960,8 +1050,13 @@ void * create_tab(GtkWidget* parent, GtkNotebook * notebook, char * label)
   tmpTab->label = gtk_label_new (label);
   gtk_widget_show (tmpTab->label);
 
-  gtk_notebook_append_page(notebook, (GtkWidget*)tmpTab->custom, tmpTab->label); 
+  g_object_set_data_full(
+           G_OBJECT(tmpTab->custom),
+           "Tab_Info",
+          tmpTab,
+          (GDestroyNotify)Tab_Destructor);
   
+  gtk_notebook_append_page(notebook, (GtkWidget*)tmpTab->custom, tmpTab->label);  
   list = gtk_container_get_children(GTK_CONTAINER(notebook));
   gtk_notebook_set_current_page(notebook,g_list_length(list)-1);
 }
index 385d715f9f9405674c4acfdac038c2baa1a56141..491e730c5c781fe9f777ebe5155c031824123b22 100644 (file)
@@ -105,10 +105,11 @@ void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1)
 {
   GtkPaned * tmpPane; 
   GtkWidget * w;
-  TimeInterval timeInterval;
+  TimeWindow Time_Window;
   LttTime      time;
   double       tmpValue;
-
+  TimeInterval *Time_Span;
+  
   g_return_if_fail(GTK_IS_CUSTOM(custom));
   g_object_ref(G_OBJECT(widget1));
  
@@ -121,26 +122,37 @@ void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1)
     gtk_widget_show(custom->hScrollbar);
 
     custom->hAdjust = gtk_range_get_adjustment(GTK_RANGE(custom->hScrollbar));
-    GetTimeInterval(custom->mw,&timeInterval);
+    GetTimeWindow(custom->mw,&Time_Window);
     GetCurrentTime(custom->mw,&time);
+    Time_Span = LTTV_TRACESET_CONTEXT(custom->mw->Traceset_Info->TracesetContext)->Time_Span ;
 
-    tmpValue               = timeInterval.startTime.tv_sec;
+    tmpValue               = Time_Span->startTime.tv_sec;
     tmpValue              *= NANSECOND_CONST;
-    tmpValue              += timeInterval.startTime.tv_nsec;
+    tmpValue              += Time_Span->startTime.tv_nsec;
     custom->hAdjust->lower = tmpValue;
-    tmpValue               = timeInterval.endTime.tv_sec;
+    custom->hAdjust->value = tmpValue;
+    tmpValue               = Time_Span->endTime.tv_sec;
     tmpValue              *= NANSECOND_CONST;
-    tmpValue              += timeInterval.endTime.tv_nsec;
+    tmpValue              += Time_Span->endTime.tv_nsec;
     custom->hAdjust->upper = tmpValue;
-    tmpValue               = time.tv_sec;
+    //tmpValue               = time.tv_sec;
+    //tmpValue              *= NANSECOND_CONST;
+    //tmpValue              += time.tv_nsec;
+    //custom->hAdjust->value = tmpValue;
+    /* Step increment to 1/10 of visible area */
+    tmpValue               = Time_Window.Time_Width.tv_sec;
     tmpValue              *= NANSECOND_CONST;
-    tmpValue              += time.tv_nsec;
-    custom->hAdjust->value = tmpValue;
-    custom->hAdjust->step_increment = 1;
-    custom->hAdjust->page_increment = 100000000;
-    custom->hAdjust->page_size = 100000000;
-
-    gtk_range_set_update_policy (GTK_RANGE(custom->hScrollbar), GTK_UPDATE_DISCONTINUOUS);
+    tmpValue              += Time_Window.Time_Width.tv_nsec;
+    custom->hAdjust->step_increment = tmpValue / 10;
+    /* Page increment of whole visible area */
+    custom->hAdjust->page_increment = tmpValue;
+    /* page_size to the whole visible area will take care that the
+     * scroll value + the shown area will never be more than what is
+     * in the trace. */
+    custom->hAdjust->page_size = tmpValue;
+
+    gtk_range_set_update_policy (GTK_RANGE(custom->hScrollbar),
+                                  GTK_UPDATE_DISCONTINUOUS);
     g_signal_connect(G_OBJECT(custom->hScrollbar), "value-changed",
                     G_CALLBACK(gtk_custom_scroll_value_changed), custom);
 
index 19cb148e841a0e77a281fc0de9acc7adcfc0a78b..f6f398ae11507aa99bc0c7111d1de2bdc806e97d 100644 (file)
 #include "callbacks.h"
 
 /* global variable */
-LttvTracesetStats * gTracesetContext = NULL;
-static LttvTraceset * traceset;
+//LttvTracesetStats * gTracesetContext = NULL;
+//static LttvTraceset * traceset;
 WindowCreationData  gWinCreationData;
 
 /** Array containing instanced objects. */
 GSList * Main_Window_List = NULL ;
 
-static LttvHooks 
-  *before_traceset,
-  *after_traceset,
-  *before_trace,
-  *after_trace,
-  *before_tracefile,
-  *after_tracefile,
-  *before_event,
-  *after_event,
+LttvHooks
   *main_hooks;
 
+/* Initial trace from command line */
+LttTrace *gInit_Trace = NULL;
+
 static char *a_trace;
 
 void lttv_trace_option(void *hook_data)
 { 
-  LttTrace *trace;
-
-  trace = ltt_trace_open(a_trace);
-  if(trace == NULL) g_critical("cannot open trace %s", a_trace);
-  lttv_traceset_add(traceset, trace);
+  gInit_Trace = ltt_trace_open(a_trace);
+  if(gInit_Trace == NULL) g_critical("cannot open trace %s", a_trace);
+  g_critical("lttv_trace_option : Init_Trace is %p", gInit_Trace);
 }
 
 /*****************************************************************************
@@ -82,12 +75,6 @@ static gboolean Window_Creation_Hook(void *hook_data, void *call_data)
   add_pixmap_directory ("pixmaps");
   add_pixmap_directory ("modules/gui/mainWin/pixmaps");
 
-
-  if(!gTracesetContext){
-    gTracesetContext = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
-    lttv_context_init(LTTV_TRACESET_CONTEXT(gTracesetContext), traceset);
-  }
-
   constructMainWin(NULL, Window_Creation_Data);
 
   gtk_main ();
@@ -101,7 +88,8 @@ static gboolean Window_Creation_Hook(void *hook_data, void *call_data)
 G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
 
   LttvAttributeValue value;
-  
+  // Global attributes only used for interaction with main() here.
   LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
   
   g_critical("GUI init()");
@@ -111,42 +99,6 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
       "pathname of the directory containing the trace", 
       LTTV_OPT_STRING, &a_trace, lttv_trace_option, NULL);
 
-  traceset = lttv_traceset_new();
-
-  before_traceset = lttv_hooks_new();
-  after_traceset = lttv_hooks_new();
-  before_trace = lttv_hooks_new();
-  after_trace = lttv_hooks_new();
-  before_tracefile = lttv_hooks_new();
-  after_tracefile = lttv_hooks_new();
-  before_event = lttv_hooks_new();
-  after_event = lttv_hooks_new();
-
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = before_traceset;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = after_traceset;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = before_trace;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/after",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = after_trace;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = before_tracefile;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = after_tracefile;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = before_event;
-  g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after",
-      LTTV_POINTER, &value));
-  *(value.v_pointer) = after_event;
-
   g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before",
       LTTV_POINTER, &value));
   g_assert((main_hooks = *(value.v_pointer)) != NULL);
@@ -158,42 +110,78 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
 
 }
 
-void
-free_system_view(systemView * SystemView)
-{
-  if(!SystemView)return;
-  //free_EventDB(SystemView->EventDB);
-  //free_SystemInfo(SystemView->SystemInfo);
-  //free_Options(SystemView->Options);
-  if(SystemView->Next)
-    free_system_view(SystemView->Next);
-  g_free(SystemView);
-}
-
-void free_tab(tab * Tab)
-{
-  if(!Tab) return;
-  if(Tab->custom->vbox)
-    gtk_widget_destroy(Tab->custom->vbox);
-  if(Tab->Attributes)
-    g_object_unref(Tab->Attributes);
-
-  if(Tab->Next) free_tab(Tab->Next);
-  g_free(Tab);
-}
+//void
+//free_system_view(systemView * SystemView)
+//{
+//  if(!SystemView)return;
+//  //free_EventDB(SystemView->EventDB);
+//  //free_SystemInfo(SystemView->SystemInfo);
+//  //free_Options(SystemView->Options);
+//  if(SystemView->Next)
+//    free_system_view(SystemView->Next);
+//  g_free(SystemView);
+//}
+
+//MD : The tab is now only referenced by the notebook. The destroy will
+//happend when notebook destroyed.
+//void free_tab(tab * Tab)
+//{
+//  if(!Tab) return;
+//  if(Tab->custom->vbox)
+//    gtk_widget_destroy(Tab->custom->vbox);
+//  if(Tab->Attributes)
+//    g_object_unref(Tab->Attributes);
+
+//  if(Tab->Next) free_tab(Tab->Next);
+//  g_free(Tab);
+//  Tab = NULL;
+//}
 
 void
 mainWindow_free(mainWindow * mw)
 { 
+  guint i, nb;
+
   if(mw){
-    Main_Window_List = g_slist_remove(Main_Window_List, mw);
-    
     //should free memory allocated dynamically first
-    free_system_view(mw->SystemView);
-    free_tab(mw->Tab);
+//    free_system_view(mw->SystemView);
+//    
+    //free_tab(mw->Tab);
+g_critical("begin remove");
+    lttv_hooks_destroy(mw->Traceset_Info->before_traceset);
+    lttv_hooks_destroy(mw->Traceset_Info->after_traceset);
+    lttv_hooks_destroy(mw->Traceset_Info->before_trace);
+    lttv_hooks_destroy(mw->Traceset_Info->after_trace);
+    lttv_hooks_destroy(mw->Traceset_Info->before_tracefile);
+    lttv_hooks_destroy(mw->Traceset_Info->after_tracefile);
+    lttv_hooks_destroy(mw->Traceset_Info->before_event);
+    lttv_hooks_destroy(mw->Traceset_Info->after_event);
+g_critical("end remove");
+    
+
+    if(mw->Traceset_Info->path != NULL)
+      g_free(mw->Traceset_Info->path);
+    if(mw->Traceset_Info->TracesetContext != NULL)
+      lttv_context_fini(LTTV_TRACESET_CONTEXT(mw->Traceset_Info->TracesetContext));
+    if(mw->Traceset_Info->traceset != NULL) {
+      nb = lttv_traceset_number(mw->Traceset_Info->traceset);
+      for(i = 0 ; i < nb ; i++) {
+        ltt_trace_close(
+           lttv_traceset_get(mw->Traceset_Info->traceset, i));
+      }
+    }
+
+    lttv_traceset_destroy(mw->Traceset_Info->traceset); 
+
     g_object_unref(mw->Attributes);
 
-    g_free(mw);    
+    g_free(mw->Traceset_Info);
+    mw->Traceset_Info = NULL;
+      
+    Main_Window_List = g_slist_remove(Main_Window_List, mw);
+    
+    g_free(mw);
+    mw = NULL;
   }
 }
 
@@ -206,8 +194,8 @@ mainWindow_Destructor(mainWindow * mw)
     //    gtk_widget_destroy(mw->AboutBox);    
     mw = NULL;
   }
-  
-  mainWindow_free(mw);
+  //mainWindow_free called when the object mw in the widget is unref.
+  //mainWindow_free(mw);
 }
 
 
@@ -228,34 +216,15 @@ G_MODULE_EXPORT void destroy() {
 
   LttvAttributeValue value;  
 
-  guint i, nb;
-
   lttv_option_remove("trace");
 
-  lttv_hooks_destroy(before_traceset);
-  lttv_hooks_destroy(after_traceset);
-  lttv_hooks_destroy(before_trace);
-  lttv_hooks_destroy(after_trace);
-  lttv_hooks_destroy(before_tracefile);
-  lttv_hooks_destroy(after_tracefile);
-  lttv_hooks_destroy(before_event);
-  lttv_hooks_destroy(after_event);
   lttv_hooks_remove_data(main_hooks, Window_Creation_Hook, &gWinCreationData);
 
-  nb = lttv_traceset_number(traceset);
-  for(i = 0 ; i < nb ; i++) {
-    ltt_trace_close(lttv_traceset_get(traceset, i));
-  }
-
-  lttv_traceset_destroy(traceset); 
-
   g_critical("GUI destroy()");
 
   g_slist_foreach(Main_Window_List, destroy_walk, NULL );
   g_slist_free(Main_Window_List);
   
-
-  g_object_unref(gTracesetContext);
 }
 
 
index aae13cf7aa9fe401900b7253d111a404eaf67b85..032a7f50ad42ca06320336b82464e9ae042d5fb7 100644 (file)
@@ -6,6 +6,8 @@
 #include "CFV.h"
 #include "Drawing.h"
 #include "Process_List.h"
+#include "Event_Hooks.h"
+#include "CFV-private.h"
 
 
 extern GSList *gControl_Flow_Data_List;
@@ -13,38 +15,6 @@ extern GSList *gControl_Flow_Data_List;
 /*****************************************************************************
  *                     Control Flow Viewer class implementation              *
  *****************************************************************************/
-
-
-struct _ControlFlowData {
-
-       GtkWidget *Scrolled_Window_VC;
-       
-       ProcessList *Process_List;
-       Drawing_t *Drawing;
-
-       //GtkWidget *HBox_V;
-       GtkWidget *Inside_HBox_V;
-
-       GtkAdjustment *VAdjust_C ;
-       
-       /* Trace information */
-       //TraceSet *Trace_Set;
-       //TraceStatistics *Trace_Statistics;
-       
-       /* Shown events information */
-       guint First_Event, Last_Event;
-       LttTime Begin_Time, End_Time;
-       
-       
-       /* TEST DATA, TO BE READ FROM THE TRACE */
-       gint Number_Of_Events ;
-       guint Currently_Selected_Event  ;
-       gboolean Selected_Event ;
-       guint Number_Of_Process;
-
-} ;
-
-
 /**
  * Control Flow Viewer's constructor
  *
@@ -61,7 +31,7 @@ GuiControlFlow(void)
        ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
 
        /* Create the Drawing */
-       Control_Flow_Data->Drawing = Drawing_construct();
+       Control_Flow_Data->Drawing = Drawing_construct(Control_Flow_Data);
        
        Drawing_Widget = 
                Drawing_getWidget(Control_Flow_Data->Drawing);
@@ -145,15 +115,15 @@ GuiControlFlow(void)
                        Control_Flow_Data,
                        (GDestroyNotify)GuiControlFlow_Destructor);
                        
-       g_slist_append(gControl_Flow_Data_List,Control_Flow_Data);
+       gControl_Flow_Data_List = g_slist_append(
+                       gControl_Flow_Data_List,
+                       Control_Flow_Data);
 
-       //FIXME : data sent too fast. The widget must be 
+       //WARNING : The widget must be 
        //inserted in the main window before the Drawing area
        //can be configured (and this must happend bedore sending
        //data)
-       send_test_data(Control_Flow_Data->Process_List,
-                       Control_Flow_Data->Drawing);
-       
+
        return Control_Flow_Data;
 
 }
@@ -176,6 +146,13 @@ GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
        
        /* Process List is removed with it's widget */
        //ProcessList_destroy(Control_Flow_Data->Process_List);
+       UnregUpdateTimeWindow(Update_Time_Window_Hook,
+                               Control_Flow_Data,
+                               Control_Flow_Data->Scrolled_Window_VC->parent);
+       
+       UnregUpdateCurrentTime(Update_Current_Time_Hook,
+                               Control_Flow_Data,
+                               Control_Flow_Data->Scrolled_Window_VC->parent);
        
        g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
        g_free(Control_Flow_Data);
@@ -186,3 +163,19 @@ GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data)
        return Control_Flow_Data->Scrolled_Window_VC ;
 }
 
+ProcessList *GuiControlFlow_get_Process_List
+               (ControlFlowData *Control_Flow_Data)
+{
+               return Control_Flow_Data->Process_List ;
+}
+
+TimeWindow *GuiControlFlow_get_Time_Window(ControlFlowData *Control_Flow_Data)
+{
+       return &Control_Flow_Data->Time_Window;
+}
+LttTime *GuiControlFlow_get_Current_Time(ControlFlowData *Control_Flow_Data)
+{
+       return &Control_Flow_Data->Current_Time;
+}
+
+
index 1855fb2731135a1a137df0fd17ce7f9e5bb4c729..548ae8907facd0bbe5da10f2eccacc6b9b9d494a 100644 (file)
@@ -2,6 +2,9 @@
 #define _CFV_H
 
 #include <gtk/gtk.h>
+#include "lttv/common.h"
+#include "lttv/mainWindow.h"
+#include "Process_List.h"
 
 typedef struct _ControlFlowData ControlFlowData;
 
@@ -12,5 +15,9 @@ GuiControlFlow_Destructor_Full(ControlFlowData *Control_Flow_Data);
 void
 GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data);
 GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data);
+ProcessList *GuiControlFlow_get_Process_List(ControlFlowData *Control_Flow_Data);
+TimeWindow *GuiControlFlow_get_Time_Window(ControlFlowData *Control_Flow_Data);
+LttTime *GuiControlFlow_get_Current_Time(ControlFlowData *Control_Flow_Data);
+
 
 #endif // _CFV_H
index 2f1312aad21c1fa7de4fa044ac8e24f5417ba94b..cb2d049d440e828579c7bb97c7ce00b5062cc054 100644 (file)
@@ -1,5 +1,6 @@
 
 #include "Drawing.h"
+#include "CFV.h"
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
@@ -31,19 +32,20 @@ static GdkColor CF_Colors [] =
 };
 
 
-struct _Drawing_t {
-       GtkWidget       *Drawing_Area_V;
-       GdkPixmap       *Pixmap;
+//struct _Drawing_t {
+//     GtkWidget       *Drawing_Area_V;
+//     GdkPixmap       *Pixmap;
+//     ControlFlowData *Control_Flow_Data;
 
-       gint            height, width, depth;
+//     gint            height, width, depth;
 
-};
+//};
 
 /* Function responsible for updating the exposed area.
  * It must call processTrace() to ask for this update.
  */
 void Drawing_Data_Request(Drawing_t *Drawing,
-                       GdkPixmap *Pixmap,
+                       GdkPixmap **Pixmap,
                        gint x, gint y,
                        gint width,
                        gint height)
@@ -51,16 +53,19 @@ void Drawing_Data_Request(Drawing_t *Drawing,
   if(width < 0) return ;
   if(height < 0) return ;
 
-  gdk_draw_rectangle (Pixmap,
+  gdk_draw_rectangle (*Pixmap,
                      Drawing->Drawing_Area_V->style->white_gc,
                      TRUE,
                      x, y,
                      width,    // do not overlap
                      height);
 
-  Drawing_draw_line(Drawing, Pixmap, 10, 10, 50, 10,
-                       Drawing->Drawing_Area_V->style->black_gc);
-
+  send_test_process(
+       GuiControlFlow_get_Process_List(Drawing->Control_Flow_Data),
+       Drawing);
+  send_test_drawing(
+       GuiControlFlow_get_Process_List(Drawing->Control_Flow_Data),
+       Drawing, *Pixmap, x, y, width, height);
   
 }
                      
@@ -74,22 +79,29 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
 {
   Drawing_t *Drawing = (Drawing_t*)user_data;
 
+  /* New Pixmap, size of the configure event */
   GdkPixmap *Pixmap = gdk_pixmap_new(widget->window,
                          widget->allocation.width,
                          widget->allocation.height,
                          -1);
        
+  g_critical("drawing configure event");
+
+  /* If no old Pixmap present */
   if(Drawing->Pixmap == NULL)
   {
-       Drawing->Pixmap = gdk_pixmap_new(widget->window,
-                               widget->allocation.width,
-                               widget->allocation.height,
-                               -1);
+       Drawing->Pixmap = gdk_pixmap_new(
+               widget->window,
+               widget->allocation.width,
+               widget->allocation.height,
+               //ProcessList_get_height
+               // (GuiControlFlow_get_Process_List(Drawing->Control_Flow_Data)),
+               -1);
        Drawing->width = widget->allocation.width;
        Drawing->height = widget->allocation.height;
-
+g_critical("init data");
        /* Initial data request */
-       Drawing_Data_Request(Drawing, Drawing->Pixmap, 0, 0,
+       Drawing_Data_Request(Drawing, &Drawing->Pixmap, 0, 0,
                        widget->allocation.width,
                        widget->allocation.height);
 
@@ -111,10 +123,11 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
                  -1, -1);
 
    /* Request data for missing space */
-   Drawing_Data_Request(Drawing, Pixmap, Drawing->width, 0,
+g_critical("missing data");
+   Drawing_Data_Request(Drawing, &Pixmap, Drawing->width, 0,
                        widget->allocation.width - Drawing->width,
                        widget->allocation.height);
-   Drawing_Data_Request(Drawing, Pixmap, 0, Drawing->height,
+   Drawing_Data_Request(Drawing, &Pixmap, 0, Drawing->height,
                   Drawing->width,
                   widget->allocation.height - Drawing->height);
                                              
@@ -136,8 +149,6 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
  
 
   
-  g_critical("drawing configure event");
-
   
   if (Drawing->Pixmap)
     gdk_pixmap_unref(Drawing->Pixmap);
@@ -167,12 +178,13 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
   return FALSE;
 }
 
-Drawing_t *Drawing_construct(void)
+Drawing_t *Drawing_construct(ControlFlowData *Control_Flow_Data)
 {
        Drawing_t *Drawing = g_new(Drawing_t, 1);
                
        Drawing->Drawing_Area_V = gtk_drawing_area_new ();
-       
+       Drawing->Control_Flow_Data = Control_Flow_Data;
+
        //gtk_widget_set_size_request(Drawing->Drawing_Area_V->window, 50, 50);
        g_object_set_data_full(
                        G_OBJECT(Drawing->Drawing_Area_V),
@@ -203,7 +215,6 @@ Drawing_t *Drawing_construct(void)
 //                       Drawing->Drawing_Area_V->allocation.height,
 //                       -1);
 
-
        g_signal_connect (G_OBJECT(Drawing->Drawing_Area_V),
                                "configure_event",
                                G_CALLBACK (configure_event),
@@ -284,6 +295,8 @@ void Drawing_Refresh (      Drawing_t *Drawing,
                        guint x, guint y,
                        guint width, guint height)
 {
+       GdkRectangle update_rect;
+
        gdk_draw_drawable(
                Drawing->Drawing_Area_V->window,
                Drawing->Drawing_Area_V->
@@ -292,6 +305,13 @@ void Drawing_Refresh (     Drawing_t *Drawing,
                x, y,
                x, y,
                width, height);
+
+       update_rect.x = 0 ;
+       update_rect.y = 0 ;
+       update_rect.width = Drawing->width;
+       update_rect.height = Drawing->height ;
+       gtk_widget_draw( Drawing->Drawing_Area_V, &update_rect);
+
 }
 
 
index 947f9bfdea5d112e9c8f7981df791aaae874a546..354021498f5bbe8b57a8f2bf9b5d46788924f795 100644 (file)
@@ -5,6 +5,7 @@
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 #include <ltt/ltt.h>
+#include "CFV.h"
 
 /* This part of the viewer does :
  * Draw horizontal lines, getting graphic context as arg.
 
 typedef struct _Drawing_t Drawing_t;
 
-Drawing_t *Drawing_construct(void);
+
+//FIXME : TEMPORARILY FOR GC !!
+struct _Drawing_t {
+       GtkWidget       *Drawing_Area_V;
+       GdkPixmap       *Pixmap;
+       ControlFlowData *Control_Flow_Data;
+
+       gint            height, width, depth;
+
+};
+
+
+Drawing_t *Drawing_construct(ControlFlowData *Control_Flow_Data);
 void Drawing_destroy(Drawing_t *Drawing);
 
 GtkWidget *Drawing_getWidget(Drawing_t *Drawing);
index 43b8fcbb15e18b4f5ee45b30922394e91925b104..12cf5c4d9dcb9d724ecb270c58ec3e19b03c8af2 100644 (file)
 #include "CFV.h"
 #include "Process_List.h"
 #include "Drawing.h"
+#include "CFV-private.h"
 
-/* NOTE : no draing data should be sent there, as the drawing widget
+
+/* NOTE : no drawing data should be sent there, as the drawing widget
  * has not been initialized */
-void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
+void send_test_drawing(ProcessList *Process_List,
+                       Drawing_t *Drawing,
+                       GdkPixmap *Pixmap,
+                       gint x, gint y, // y not used here?
+                       gint width,
+                       gint height) // height won't be used here ?
+{
+       int i;
+       ProcessInfo Process_Info = {10000, 12000, 55600};
+       //ProcessInfo Process_Info = {156, 14000, 55500};
+       GtkTreeRowReference *got_RowRef;
+       
+       LttTime birth;
+       birth.tv_sec = 12000;
+       birth.tv_nsec = 55500;
+       g_critical("we have : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
+       ProcessList_get_process_pixels(Process_List,
+                                       1,
+                                       &birth,
+                                       &y,
+                                       &height);
+       
+       g_critical("we draw : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
+       Drawing_draw_line(
+               Drawing, Pixmap, x,
+               y+(height/2), x + width, y+(height/2),
+               Drawing->Drawing_Area_V->style->black_gc);
+
+       birth.tv_sec = 14000;
+       birth.tv_nsec = 55500;
+
+       ProcessList_get_process_pixels(Process_List,
+                                       156,
+                                       &birth,
+                                       &y,
+                                       &height);
+       
+
+       Drawing_draw_line(
+               Drawing, Pixmap, x,
+               y+(height/2), x + width, y+(height/2),
+               Drawing->Drawing_Area_V->style->black_gc);
+
+       g_critical("y : %u, height : %u", y, height);
+
+       birth.tv_sec = 12000;
+       birth.tv_nsec = 55700;
+
+       ProcessList_get_process_pixels(Process_List,
+                                       10,
+                                       &birth,
+                                       &y,
+                                       &height);
+       
+
+       Drawing_draw_line(
+               Drawing, Pixmap, x,
+               y+(height/2), x + width, y+(height/2),
+               Drawing->Drawing_Area_V->style->black_gc);
+
+       g_critical("y : %u, height : %u", y, height);
+
+       for(i=0; i<10; i++)
+       {
+               birth.tv_sec = i*12000;
+               birth.tv_nsec = i*55700;
+
+               ProcessList_get_process_pixels(Process_List,
+                                               i,
+                                               &birth,
+                                               &y,
+                                               &height);
+               
+
+               Drawing_draw_line(
+                       Drawing, Pixmap, x,
+                       y+(height/2), x + width, y+(height/2),
+                       Drawing->Drawing_Area_V->style->black_gc);
+
+               g_critical("y : %u, height : %u", y, height);
+
+       }
+
+       birth.tv_sec = 12000;
+       birth.tv_nsec = 55600;
+
+       ProcessList_get_process_pixels(Process_List,
+                                       10,
+                                       &birth,
+                                       &y,
+                                       &height);
+       
+
+       Drawing_draw_line(
+               Drawing, Pixmap, x,
+               y+(height/2), x + width, y+(height/2),
+               Drawing->Drawing_Area_V->style->black_gc);
+
+       g_critical("y : %u, height : %u", y, height);
+       
+}
+
+void send_test_process(ProcessList *Process_List, Drawing_t *Drawing)
 {
-       guint height, size;
+       guint height, y;
        int i;
        ProcessInfo Process_Info = {10000, 12000, 55600};
        //ProcessInfo Process_Info = {156, 14000, 55500};
        GtkTreeRowReference *got_RowRef;
 
        LttTime birth;
+
+       if(Process_List->Test_Process_Sent) return;
+
        birth.tv_sec = 12000;
        birth.tv_nsec = 55500;
 
        ProcessList_add(Process_List,
                        1,
                        &birth,
-                       &height);
-       //Drawing_Insert_Square( Drawing, height, 5);
+                       &y);
+       ProcessList_get_process_pixels(Process_List,
+                                       1,
+                                       &birth,
+                                       &y,
+                                       &height);
+       Drawing_Insert_Square( Drawing, y, height);
        
-       g_critical("height : %u", height);
+       //g_critical("y : %u, height : %u", y, height);
        
        birth.tv_sec = 14000;
        birth.tv_nsec = 55500;
@@ -43,11 +155,16 @@ void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
        ProcessList_add(Process_List,
                        156,
                        &birth,
-                       &height);
-       //Drawing_Insert_Square( Drawing, height, 5);
-
-       g_critical("height : %u", height);
-
+                       &y);
+       ProcessList_get_process_pixels(Process_List,
+                                       156,
+                                       &birth,
+                                       &y,
+                                       &height);
+       Drawing_Insert_Square( Drawing, y, height);
+       
+       //g_critical("y : %u, height : %u", y, height);
+       
        birth.tv_sec = 12000;
        birth.tv_nsec = 55700;
 
@@ -55,6 +172,15 @@ void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
                        10,
                        &birth,
                        &height);
+       ProcessList_get_process_pixels(Process_List,
+                                       10,
+                                       &birth,
+                                       &y,
+                                       &height);
+       Drawing_Insert_Square( Drawing, y, height);
+       
+       //g_critical("y : %u, height : %u", y, height);
+       
        //Drawing_Insert_Square( Drawing, height, 5);
 
        for(i=0; i<10; i++)
@@ -66,10 +192,17 @@ void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
                                i,
                                &birth,
                                &height);
-       //Drawing_Insert_Square( Drawing, height, 5);
-
+               ProcessList_get_process_pixels(Process_List,
+                                               i,
+                                               &birth,
+                                               &y,
+                                               &height);
+               Drawing_Insert_Square( Drawing, y, height);
+       
+       //      g_critical("y : %u, height : %u", y, height);
+       
        }
-       g_critical("height : %u", height);
+       //g_critical("height : %u", height);
 
        birth.tv_sec = 12000;
        birth.tv_nsec = 55600;
@@ -77,27 +210,42 @@ void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
        ProcessList_add(Process_List,
                        10,
                        &birth,
-                       &height);
-       //Drawing_Insert_Square( Drawing, height, 5);
-       g_critical("height : %u", height);
-
+                       &y);
+       ProcessList_get_process_pixels(Process_List,
+                                       10,
+                                       &birth,
+                                       &y,
+                                       &height);
+       Drawing_Insert_Square( Drawing, y, height);
+       
+       //g_critical("y : %u, height : %u", y, height);
+       
        ProcessList_add(Process_List,
                        10000,
                        &birth,
                        &height);
+       ProcessList_get_process_pixels(Process_List,
+                                       10000,
+                                       &birth,
+                                       &y,
+                                       &height);
+       Drawing_Insert_Square( Drawing, y, height);
+       
+       //g_critical("y : %u, height : %u", y, height);
+       
        //Drawing_Insert_Square( Drawing, height, 5);
-       g_critical("height : %u", height);
+       //g_critical("height : %u", height);
 
 
        ProcessList_get_process_pixels(Process_List,
                                10000,
                                &birth,
-                               &height, &size);
+                               &y, &height);
        ProcessList_remove(     Process_List,
                                10000,
                                &birth);
 
-       //Drawing_Remove_Square( Drawing, height, 5);
+       Drawing_Remove_Square( Drawing, y, height);
        
        if(got_RowRef = 
                (GtkTreeRowReference*)g_hash_table_lookup(
@@ -113,6 +261,8 @@ void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
                
        }
 
+       Process_List->Test_Process_Sent = TRUE;
+
 }
 
 
@@ -131,6 +281,16 @@ hGuiControlFlow(mainWindow *pmParentWindow)
        g_critical("hGuiControlFlow");
        ControlFlowData *Control_Flow_Data = GuiControlFlow() ;
 
+       GetTimeWindow(pmParentWindow,
+                       GuiControlFlow_get_Time_Window(Control_Flow_Data));
+       GetCurrentTime(pmParentWindow,
+                       GuiControlFlow_get_Current_Time(Control_Flow_Data));
+
+       // Unreg done in the GuiControlFlow_Destructor
+       RegUpdateTimeWindow(Update_Time_Window_Hook, Control_Flow_Data,
+                               pmParentWindow);
+       RegUpdateCurrentTime(Update_Current_Time_Hook, Control_Flow_Data,
+                               pmParentWindow);
        return GuiControlFlow_get_Widget(Control_Flow_Data) ;
        
 }
@@ -199,3 +359,58 @@ int Draw_After_Hook(void *hook_data, void *call_data)
        return 0;
 }
 #endif
+
+
+
+
+void Update_Time_Window_Hook(void *hook_data, void *call_data)
+{
+       ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data;
+       TimeWindow* Time_Window = 
+               GuiControlFlow_get_Time_Window(Control_Flow_Data);
+       TimeWindow *New_Time_Window = ((TimeWindow*)call_data);
+
+       // As the time interval change will mostly be used for
+       // zoom in and out, it's not useful to keep old drawing
+       // sections, as scale will be changed.
+       
+
+       *Time_Window = *New_Time_Window;
+       g_critical("New time window HOOK : %u, %u to %u, %u",
+                       Time_Window->startTime.tv_sec,
+                       Time_Window->startTime.tv_nsec,
+                       Time_Window->Time_Width.tv_sec,
+                       Time_Window->Time_Width.tv_nsec);
+
+       Drawing_Data_Request(Control_Flow_Data->Drawing,
+                       &Control_Flow_Data->Drawing->Pixmap,
+                       0, 0,
+                       Control_Flow_Data->Drawing->width,
+                       Control_Flow_Data->Drawing->height);
+
+       Drawing_Refresh(Control_Flow_Data->Drawing,
+                       0, 0,
+                       Control_Flow_Data->Drawing->width,
+                       Control_Flow_Data->Drawing->height);
+
+}
+
+void Update_Current_Time_Hook(void *hook_data, void *call_data)
+{
+       ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data;
+       LttTime* Current_Time = 
+               GuiControlFlow_get_Current_Time(Control_Flow_Data);
+       *Current_Time = *((LttTime*)call_data);
+       g_critical("New Current time HOOK : %u, %u", Current_Time->tv_sec,
+                                                       Current_Time->tv_nsec);
+
+       /* If current time is inside time interval, just move the highlight
+        * bar */
+
+       /* Else, we have to change the time interval. We have to tell it
+        * to the main window. */
+       /* The time interval change will take care of placing the current
+        * time at the center of the visible area */
+       
+}
+
index 479b3a35e5f5c551e36549985cfca6d6788fb905..13b3d3aecf966efd621cc3c05b6f637b07a215fc 100644 (file)
@@ -47,4 +47,8 @@ int Draw_Event_Hook(void *hook_data, void *call_data);
 
 int Draw_After_Hook(void *hook_data, void *call_data);
 
+void Update_Time_Window_Hook(void *hook_data, void *call_data);
+void Update_Current_Time_Hook(void *hook_data, void *call_data);
+
+
 #endif // _EVENT_HOOKS_H
index a9da1fda4afc36ff21cdf38ef1b28e0d0ac26c11..e3197541dcfc0cbf1122790214d4029bb44f2436 100644 (file)
@@ -141,14 +141,14 @@ gboolean equ_fct(gconstpointer a, gconstpointer b)
 {
        if(((ProcessInfo*)a)->pid != ((ProcessInfo*)b)->pid)
                return 0;
-       g_critical("compare %u and %u",((ProcessInfo*)a)->pid,((ProcessInfo*)b)->pid);
+//     g_critical("compare %u and %u",((ProcessInfo*)a)->pid,((ProcessInfo*)b)->pid);
        if(((ProcessInfo*)a)->birth.tv_sec != ((ProcessInfo*)b)->birth.tv_sec)
                return 0;
-       g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_sec,((ProcessInfo*)b)->birth.tv_sec);
+//     g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_sec,((ProcessInfo*)b)->birth.tv_sec);
 
        if(((ProcessInfo*)a)->birth.tv_nsec != ((ProcessInfo*)b)->birth.tv_nsec)
                return 0;
-       g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec);
+//     g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec);
 
        return 1;
 }
@@ -252,7 +252,9 @@ ProcessList *ProcessList_construct(void)
                        "Process_List_Data",
                        Process_List,
                        (GDestroyNotify)ProcessList_destroy);
-                       
+
+       Process_List->Test_Process_Sent = 0;
+       
        return Process_List;
 }
 void ProcessList_destroy(ProcessList *Process_List)
@@ -278,7 +280,7 @@ gint get_cell_height(GtkTreeView *TreeView)
        GtkCellRenderer *Renderer = g_list_first(Render_List)->data;
        
        gtk_tree_view_column_cell_get_size(Column, NULL, NULL, NULL, NULL, &height);
-       g_critical("cell 0 height : %u",height);
+       //g_critical("cell 0 height : %u",height);
        
        return height;
 }
@@ -307,10 +309,10 @@ int ProcessList_add(      ProcessList *Process_List,
        
        /* Add a new row to the model */
        gtk_list_store_append ( Process_List->Store_M, &iter);
-       g_critical ( "iter before : %s", gtk_tree_path_to_string (
-                       gtk_tree_model_get_path (
-                                       GTK_TREE_MODEL(Process_List->Store_M),
-                                       &iter)));
+       //g_critical ( "iter before : %s", gtk_tree_path_to_string (
+       //              gtk_tree_model_get_path (
+       //                              GTK_TREE_MODEL(Process_List->Store_M),
+       //                              &iter)));
        gtk_list_store_set (    Process_List->Store_M, &iter,
                                PROCESS_COLUMN, "name",
                                PID_COLUMN, pid,
@@ -327,10 +329,10 @@ int ProcessList_add(      ProcessList *Process_List,
                                (gpointer)Process_Info,
                                (gpointer)RowRef);
        
-       g_critical ( "iter after : %s", gtk_tree_path_to_string (
-                       gtk_tree_model_get_path (
-                                       GTK_TREE_MODEL(Process_List->Store_M),
-                                       &iter)));
+       //g_critical ( "iter after : %s", gtk_tree_path_to_string (
+       //              gtk_tree_model_get_path (
+       //                              GTK_TREE_MODEL(Process_List->Store_M),
+       //                              &iter)));
        Process_List->Number_Of_Process++;
 
        *height = get_cell_height(GTK_TREE_VIEW(Process_List->Process_List_VC))
@@ -388,7 +390,7 @@ guint ProcessList_get_height(ProcessList *Process_List)
 
 gint ProcessList_get_process_pixels(   ProcessList *Process_List,
                                        guint pid, LttTime *birth,
-                                       guint *x,
+                                       guint *y,
                                        guint *height)
 {
        ProcessInfo Process_Info;
@@ -410,7 +412,7 @@ gint ProcessList_get_process_pixels(        ProcessList *Process_List,
 
                *height = get_cell_height(
                                GTK_TREE_VIEW(Process_List->Process_List_VC));
-               *x = *height * path_indices[0];
+               *y = *height * path_indices[0];
                
                return 0;       
        } else {
index 1daabdd65593f20daa4e3942730180a52cac95d5..f2fa69cb3c39998780fa1b0b08189e9f175b825e 100644 (file)
@@ -37,6 +37,7 @@ struct _ProcessList {
        GHashTable *Process_Hash;
        
        guint Number_Of_Process;
+       gboolean Test_Process_Sent;
 
 };
 
@@ -53,10 +54,10 @@ int ProcessList_add(ProcessList *Process_List, guint pid, LttTime *birth,
 // out : success (0) and height
 int ProcessList_remove(ProcessList *Process_List, guint pid, LttTime *birth);
 
-guint ProcessList_get_pixels(ProcessList *Process_List);
+guint ProcessList_get_height(ProcessList *Process_List);
 
 // Returns 0 on success
 gint ProcessList_get_process_pixels(ProcessList *Process_List,
                                guint pid, LttTime *birth,
-                               guint *x, guint *height);
+                               guint *y, guint *height);
 #endif // _PROCESS_LIST_H
index 5b73abae25dd902b52374d88075f977e92f81979..7d47e9d1eee968e0c72aed62a4d3a193bea42438 100644 (file)
@@ -84,10 +84,10 @@ G_MODULE_EXPORT void destroy() {
        g_critical("GUI Control Flow Viewer destroy()");
        int i;
 
-       ControlFlowData *Control_Flow_Data;
-       
        g_slist_foreach(gControl_Flow_Data_List, destroy_walk, NULL );
        
+       g_slist_free(gControl_Flow_Data_List);
+
        /* Unregister the toolbar insert button */
        ToolbarItemUnreg(hGuiControlFlow);
 
index dc062e7e03252721eaf9c88e58b6325223ea49b6..9b3e8641b07b40c36e8447371709c260bedc03d8 100644 (file)
@@ -55,7 +55,7 @@ static LttvHooks  *before_event;
 static GSList *sEvent_Viewer_Data_List = NULL ;
 
 /** hook functions for update time interval, current time ... */
-gboolean updateTimeInterval(void * hook_data, void * call_data);
+gboolean updateTimeWindow(void * hook_data, void * call_data);
 gboolean updateCurrentTime(void * hook_data, void * call_data);
 void remove_item_from_queue(GQueue * q, gboolean fromHead);
 void remove_all_items_from_queue(GQueue * q);
@@ -85,7 +85,7 @@ typedef enum _ScrollDirection{
 typedef struct _EventViewerData {
 
   mainWindow * mw;
-  TimeInterval time_interval;
+  TimeWindow   time_window;
   LttTime      current_time;
   LttvHooks  * before_event_hooks;
 
@@ -94,8 +94,9 @@ typedef struct _EventViewerData {
   GQueue     * raw_trace_data_queue_tmp;  //tmp buf to contain raw data
   unsigned     current_event_index;
   double       previous_value;            //value of the slide
-  LttTime      trace_start;
-  LttTime      trace_end;
+  TimeInterval time_span;
+ // LttTime      trace_start;
+ // LttTime      trace_end;
   unsigned     start_event_index;        //the first event shown in the window
   unsigned     end_event_index;          //the last event shown in the window
 
@@ -268,7 +269,7 @@ GuiEvents(mainWindow *pmParentWindow)
   unsigned size;
 
   Event_Viewer_Data->mw = pmParentWindow;
-  GetTimeInterval(Event_Viewer_Data->mw, &Event_Viewer_Data->time_interval);
+  GetTimeWindow(Event_Viewer_Data->mw, &Event_Viewer_Data->time_window);
   GetCurrentTime(Event_Viewer_Data->mw, &Event_Viewer_Data->current_time);
   
   Event_Viewer_Data->before_event_hooks = lttv_hooks_new();
@@ -277,7 +278,7 @@ GuiEvents(mainWindow *pmParentWindow)
   Event_Viewer_Data->raw_trace_data_queue     = g_queue_new();
   Event_Viewer_Data->raw_trace_data_queue_tmp = g_queue_new();  
 
-  RegUpdateTimeInterval(updateTimeInterval,Event_Viewer_Data, Event_Viewer_Data->mw);
+  RegUpdateTimeWindow(updateTimeWindow,Event_Viewer_Data, Event_Viewer_Data->mw);
   RegUpdateCurrentTime(updateCurrentTime,Event_Viewer_Data, Event_Viewer_Data->mw);
 
   Event_Viewer_Data->Scroll_Win = gtk_scrolled_window_new (NULL, NULL);
@@ -435,11 +436,11 @@ GuiEvents(mainWindow *pmParentWindow)
   Event_Viewer_Data->Num_Visible_Events = 1;
 
   //get the life span of the traceset and set the upper of the scroll bar
-  getTracesetTimeSpan(Event_Viewer_Data->mw, &Event_Viewer_Data->trace_start, 
-                     &Event_Viewer_Data->trace_end);
-  time_value = Event_Viewer_Data->trace_end.tv_sec - Event_Viewer_Data->trace_start.tv_sec;
+  getTracesetTimeSpan(Event_Viewer_Data->mw, &Event_Viewer_Data->time_span);
+  
+  time_value = Event_Viewer_Data->time_span.endTime.tv_sec - Event_Viewer_Data->time_span.startTime.tv_sec;
   time_value *= NANSECOND_CONST;
-  time_value += (double)Event_Viewer_Data->trace_end.tv_nsec - Event_Viewer_Data->trace_start.tv_nsec;
+  time_value += (double)Event_Viewer_Data->time_span.endTime.tv_nsec - Event_Viewer_Data->time_span.startTime.tv_nsec;
   Event_Viewer_Data->VAdjust_C->upper = time_value;
 
   Event_Viewer_Data->append = TRUE;
@@ -939,7 +940,7 @@ void get_test_data(double time_value, guint List_Height,
        remove_all_items_from_queue(Event_Viewer_Data->raw_trace_data_queue);
        end.tv_sec = G_MAXULONG;
        end.tv_nsec = G_MAXULONG;
-       start = Event_Viewer_Data->trace_start;
+       start = Event_Viewer_Data->time_span.startTime;
        value = (int)(time_value / NANSECOND_CONST);
        start.tv_sec += value;
        value = time_value / NANSECOND_CONST - value;
@@ -988,9 +989,9 @@ void get_test_data(double time_value, guint List_Height,
       first = Event_Viewer_Data->raw_trace_data_queue->head;
       raw_data = (RawTraceData*)g_list_nth_data(first,Event_Number);
       value = raw_data->time.tv_sec;
-      value -= Event_Viewer_Data->trace_start.tv_sec;
+      value -= Event_Viewer_Data->time_span.startTime.tv_sec;
       value *= NANSECOND_CONST;
-      value -= Event_Viewer_Data->trace_start.tv_nsec;
+      value -= Event_Viewer_Data->time_span.startTime.tv_nsec;
       value += raw_data->time.tv_nsec;
       Event_Viewer_Data->VAdjust_C->value = value;
       g_signal_stop_emission_by_name(G_OBJECT(Event_Viewer_Data->VAdjust_C), "value-changed");
@@ -1135,7 +1136,7 @@ GuiEvents_free(EventViewerData *Event_Viewer_Data)
     g_queue_free(Event_Viewer_Data->raw_trace_data_queue);
     g_queue_free(Event_Viewer_Data->raw_trace_data_queue_tmp);
 
-    UnregUpdateTimeInterval(updateTimeInterval,Event_Viewer_Data, Event_Viewer_Data->mw);
+    UnregUpdateTimeWindow(updateTimeWindow,Event_Viewer_Data, Event_Viewer_Data->mw);
     UnregUpdateCurrentTime(updateCurrentTime,Event_Viewer_Data, Event_Viewer_Data->mw);
 
     sEvent_Viewer_Data_List = g_slist_remove(sEvent_Viewer_Data_List, Event_Viewer_Data);
@@ -1202,10 +1203,10 @@ int Event_Selected_Hook(void *hook_data, void *call_data)
 }
 
 
-gboolean updateTimeInterval(void * hook_data, void * call_data)
+gboolean updateTimeWindow(void * hook_data, void * call_data)
 {
   EventViewerData *Event_Viewer_Data = (EventViewerData*) hook_data;
-  Event_Viewer_Data->time_interval = *(TimeInterval*)call_data;
+  Event_Viewer_Data->time_window = *(TimeWindow*)call_data;
 
   return FALSE;
 }
index 855994663a8334094aeaac693dd0244630a415dd..224bf1251c5e842b8ab1afb09dc85da144b43bb0 100644 (file)
@@ -3,14 +3,14 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
   /usr/include/glib-2.0/glib/gtypes.h \
   /usr/lib/glib-2.0/include/glibconfig.h \
   /usr/include/glib-2.0/glib/gmacros.h \
-  /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h \
-  /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/limits.h \
-  /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/syslimits.h \
+  /usr/lib/gcc-lib/i486-linux/3.3.2/include/stddef.h \
+  /usr/lib/gcc-lib/i486-linux/3.3.2/include/limits.h \
+  /usr/lib/gcc-lib/i486-linux/3.3.2/include/syslimits.h \
   /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/gnu/stubs.h /usr/include/bits/posix1_lim.h \
   /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
   /usr/include/bits/posix2_lim.h \
-  /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/float.h \
+  /usr/lib/gcc-lib/i486-linux/3.3.2/include/float.h \
   /usr/include/glib-2.0/glib/garray.h \
   /usr/include/glib-2.0/glib/gasyncqueue.h \
   /usr/include/glib-2.0/glib/gthread.h \
@@ -30,7 +30,7 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
   /usr/include/glib-2.0/glib/gunicode.h \
   /usr/include/glib-2.0/glib/gmarkup.h \
   /usr/include/glib-2.0/glib/gmessages.h \
-  /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h \
+  /usr/lib/gcc-lib/i486-linux/3.3.2/include/stdarg.h \
   /usr/include/glib-2.0/glib/gnode.h \
   /usr/include/glib-2.0/glib/gpattern.h \
   /usr/include/glib-2.0/glib/gprimes.h \
@@ -269,7 +269,8 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
   /usr/include/bits/stdio.h ../../../include/lttv/stats.h \
   ../../../include/lttv/state.h ../../../include/lttv/processTrace.h \
   ../../../include/lttv/traceset.h ../../../include/lttv/attribute.h \
-  ../../../include/lttv/iattribute.h ../../../include/ltt/event.h \
+  ../../../include/lttv/iattribute.h ../../../include/lttv/mainWindow.h \
+  ../../../include/lttv/gtkcustom.h ../../../include/ltt/event.h \
   /usr/include/string.h /usr/include/bits/string.h \
   /usr/include/bits/string2.h /usr/include/stdlib.h \
   ../icons/hGuiStatisticInsert.xpm
@@ -284,11 +285,11 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
 
 /usr/include/glib-2.0/glib/gmacros.h:
 
-/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h:
+/usr/lib/gcc-lib/i486-linux/3.3.2/include/stddef.h:
 
-/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/limits.h:
+/usr/lib/gcc-lib/i486-linux/3.3.2/include/limits.h:
 
-/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/syslimits.h:
+/usr/lib/gcc-lib/i486-linux/3.3.2/include/syslimits.h:
 
 /usr/include/limits.h:
 
@@ -306,7 +307,7 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
 
 /usr/include/bits/posix2_lim.h:
 
-/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/float.h:
+/usr/lib/gcc-lib/i486-linux/3.3.2/include/float.h:
 
 /usr/include/glib-2.0/glib/garray.h:
 
@@ -356,7 +357,7 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
 
 /usr/include/glib-2.0/glib/gmessages.h:
 
-/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h:
+/usr/lib/gcc-lib/i486-linux/3.3.2/include/stdarg.h:
 
 /usr/include/glib-2.0/glib/gnode.h:
 
@@ -924,6 +925,10 @@ guiStatistic.lo guiStatistic.o: guiStatistic.c \
 
 ../../../include/lttv/iattribute.h:
 
+../../../include/lttv/mainWindow.h:
+
+../../../include/lttv/gtkcustom.h:
+
 ../../../include/ltt/event.h:
 
 /usr/include/string.h:
index 46fa5fb84c4769112e7ee00c4e4665f5870a0d10..ad3bbe3c6d9c5fbd1e15b4f49d3cef0868fa486b 100644 (file)
 
 #include "../icons/hGuiStatisticInsert.xpm"
 
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
 #define PATH_LENGTH        256
 
 static LttvModule *Main_Win_Module;
 
 /** Array containing instanced objects. Used when module is unloaded */
-GSList *gStatistic_Viewer_Data_List = NULL ;
+static GSList *gStatistic_Viewer_Data_List = NULL ;
 
 typedef struct _StatisticViewerData StatisticViewerData;
 
@@ -119,10 +122,7 @@ void destroy_walk(gpointer data, gpointer user_data)
 G_MODULE_EXPORT void destroy() {
   int i;
   
-  StatisticViewerData *Statistic_Viewer_Data;
-  
   g_critical("GUI Statistic Viewer destroy()");
-
   g_slist_foreach(gStatistic_Viewer_Data_List, destroy_walk, NULL );
 
   g_slist_free(gStatistic_Viewer_Data_List);
@@ -138,6 +138,7 @@ G_MODULE_EXPORT void destroy() {
 void
 GuiStatistic_free(StatisticViewerData *Statistic_Viewer_Data)
 { 
+  g_critical("GuiStatistic_free()");
   if(Statistic_Viewer_Data){
     g_hash_table_destroy(Statistic_Viewer_Data->Statistic_Hash);
     gStatistic_Viewer_Data_List = g_slist_remove(gStatistic_Viewer_Data_List, Statistic_Viewer_Data);
@@ -149,12 +150,12 @@ GuiStatistic_free(StatisticViewerData *Statistic_Viewer_Data)
 void
 GuiStatistic_Destructor(StatisticViewerData *Statistic_Viewer_Data)
 {
+  g_critical("GuiStatistic_Destructor()");
   /* May already been done by GTK window closing */
   if(GTK_IS_WIDGET(Statistic_Viewer_Data->HPaned_V)){
     gtk_widget_destroy(Statistic_Viewer_Data->HPaned_V);
     Statistic_Viewer_Data = NULL;
   }
-  
   GuiStatistic_free(Statistic_Viewer_Data);
 }
 
@@ -261,7 +262,9 @@ GuiStatistic(mainWindow *pmParentWindow)
                        (GDestroyNotify)GuiStatistic_free);
 
   /* Add the object's information to the module's array */
-  gStatistic_Viewer_Data_List = g_slist_append(gStatistic_Viewer_Data_List, Statistic_Viewer_Data);
+  gStatistic_Viewer_Data_List = g_slist_append(
+                       gStatistic_Viewer_Data_List,
+                       Statistic_Viewer_Data);
 
   get_traceset_stats(Statistic_Viewer_Data);
 
index c4f650c4be5b0b86b5a9dddb4e5ad50c515bd9be..339bc1af7d9fdad09a2fa46abd52d848ec8a68fb 100644 (file)
@@ -37,6 +37,51 @@ lttv_context_new_tracefile_context(LttvTracesetContext *self)
   return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self);
 }
 
+/****************************************************************************
+ * lttv_traceset_context_compute_time_span
+ *
+ * Keep the Time_Span is sync with on the fly addition and removal of traces
+ * in a trace set. It must be called each time a trace is added/removed from
+ * the traceset. It could be more efficient to call it only once a bunch
+ * of traces are loaded, but the calculation is not long, so it's not
+ * critical.
+ *
+ * Author : Xang Xiu Yang
+ * Imported from gtkTraceSet.c by Mathieu Desnoyers
+ ***************************************************************************/
+static void lttv_traceset_context_compute_time_span(
+                                          LttvTracesetContext *self,
+                                         TimeInterval *Time_Span)
+{
+  LttvTraceset * traceset = self->ts;
+  int numTraces = lttv_traceset_number(traceset);
+  int i;
+  LttTime s, e;
+  LttvTraceContext *tc;
+  LttTrace * trace;
+
+  for(i=0; i<numTraces;i++){
+    tc = self->traces[i];
+    trace = tc->t;
+
+    ltt_trace_time_span_get(trace, &s, &e);
+
+    if(i==0){
+      Time_Span->startTime = s;
+      Time_Span->endTime   = e;
+    }else{
+      if(s.tv_sec < Time_Span->startTime.tv_sec ||
+        (s.tv_sec == Time_Span->startTime.tv_sec 
+          && s.tv_nsec < Time_Span->startTime.tv_nsec))
+       Time_Span->startTime = s;
+      if(e.tv_sec > Time_Span->endTime.tv_sec ||
+        (e.tv_sec == Time_Span->endTime.tv_sec &&
+          e.tv_nsec > Time_Span->endTime.tv_nsec))
+       Time_Span->endTime = e;      
+    }
+  }
+}
+
 
 static void
 init(LttvTracesetContext *self, LttvTraceset *ts)
@@ -96,6 +141,8 @@ init(LttvTracesetContext *self, LttvTraceset *ts)
       tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
     }
   }
+  self->Time_Span = g_new(TimeInterval,1);
+  lttv_traceset_context_compute_time_span(self, self->Time_Span);
 }
 
 
@@ -109,9 +156,12 @@ void fini(LttvTracesetContext *self)
 
   LttvTraceset *ts = self->ts;
 
+  g_free(self->Time_Span);
+
   lttv_hooks_destroy(self->before);
   lttv_hooks_destroy(self->after);
-  g_object_unref(self->a);
+  //FIXME : segfault
+ // g_object_unref(self->a);
 
   nb_trace = lttv_traceset_number(ts);
 
index d0bb4cdf6ea2a855144d530942d3faf194972968..311658c1141443ee5823016940e956a42e2ce393 100644 (file)
@@ -794,6 +794,7 @@ lttv_stats_remove_event_hooks(LttvTracesetStats *self)
            hook.id), hook.h, &g_array_index(after_hooks, LttvTraceHook, k));
       }
     }
+    g_critical("lttv_stats_remove_event_hooks()");
     g_array_free(before_hooks, TRUE);
     g_array_free(after_hooks, TRUE);
   }
index 85e33225bb95e252b2b85e6cfc6cc4f499e87b5b..aee03471209c972293d191cad1fbc01a96d8206e 100644 (file)
@@ -1,5 +1,6 @@
 
 #include <lttv/traceset.h>
+#include <stdio.h>
 
 /* A trace is a sequence of events gathered in the same tracing session. The
    events may be stored in several tracefiles in the same directory. 
@@ -8,6 +9,7 @@
 */
 
 struct _LttvTraceset {
+  char * filename;
   GPtrArray *traces;
   GPtrArray *attributes;
   LttvAttribute *a;
@@ -19,13 +21,65 @@ LttvTraceset *lttv_traceset_new()
   LttvTraceset *s;
 
   s = g_new(LttvTraceset, 1);
+  s->filename = NULL;
   s->traces = g_ptr_array_new();
   s->attributes = g_ptr_array_new();
   s->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
   return s;
 }
 
+LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig) 
+{
+  int i;
+  LttvTraceset *s;
+
+  s = g_new(LttvTraceset, 1);
+  s->filename = NULL;
+  s->traces = g_ptr_array_new();
+  for(i=0;i<s_orig->traces->len;i++)
+  {
+    g_ptr_array_add(
+        s->traces,
+       ltt_trace_copy(g_ptr_array_index(s_orig->traces, i)));
+  }
+  s->attributes = g_ptr_array_new();
+  for(i=0;i<s_orig->attributes->len;i++)
+  {
+    g_ptr_array_add(
+        s->attributes,
+        lttv_iattribute_deep_copy(g_ptr_array_index(s_orig->attributes, i)));
+  }
+  s->a = LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig->a)));
+  return s;
+}
 
+
+LttvTraceset *lttv_traceset_load(const gchar *filename)
+{
+  LttvTraceset *s = g_new(LttvTraceset,1);
+  FILE *tf;
+  
+  s->filename = g_strdup(filename);
+  tf = fopen(filename,"r");
+
+  g_critical("NOT IMPLEMENTED : load traceset data from a XML file");
+  
+  fclose(tf);
+  return s;
+}
+
+gint lttv_traceset_save(LttvTraceset *s)
+{
+  FILE *tf;
+
+  tf = fopen(s->filename, "w");
+  
+  g_critical("NOT IMPLEMENTED : save traceset data in a XML file");
+
+  fclose(tf);
+  return 0;
+}
 void lttv_traceset_destroy(LttvTraceset *s) 
 {
   int i, nb;
@@ -39,7 +93,6 @@ void lttv_traceset_destroy(LttvTraceset *s)
   g_free(s);
 }
 
-
 void lttv_traceset_add(LttvTraceset *s, LttTrace *t) 
 {
   g_ptr_array_add(s->traces, t);
This page took 0.064318 seconds and 4 git commands to generate.