unsigned long tv_nsec;
} LttTime;
+
+typedef struct _TimeInterval{
+ LttTime startTime;
+ LttTime endTime;
+} TimeInterval;
+
+
typedef uint64_t LttCycleCount;
#define NANSECOND_CONST 1000000000
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);
#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
#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
/**
- * 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);
/**
* @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.
* 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.
*/
* 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.
*/
* @param end end time of the traceset.
*/
-void getTracesetTimeSpan(mainWindow *main_win, LttTime * start, LttTime* end);
+void getTracesetTimeSpan(mainWindow *main_win, TimeInterval *time_span);
/**
#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 */
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;
LttvHooks *after;
LttvTraceContext **traces;
LttvAttribute *a;
+ TimeInterval *Time_Span;
};
struct _LttvTracesetContextClass {
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);
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);
LttvAttribute *lttv_traceset_trace_attribute(LttvTraceset *s,
unsigned i);
-
#endif // TRACESET_H
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
*are released as well.
****************************************************************************/
-LttTrace *ltt_trace_open(char *pathname)
+LttTrace *ltt_trace_open(const char *pathname)
{
LttTrace * t;
LttSystemDescription * sys_description;
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;
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));
void lttv_hooks_destroy(LttvHooks *h)
{
+ g_critical("lttv_hooks_destroy()");
g_array_free(h, TRUE);
}
/**
- * 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.
* @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
* @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);
}
* @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();
* @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);
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);
}
/**
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,
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,
}
-/**
- * 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.
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);
}
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);
}
/**
LttvTracesetStats* getTracesetStats(mainWindow *main_win)
{
- return (LttvTracesetStats*)main_win->traceset_context;
+ return main_win->Traceset_Info->TracesetContext;
}
* (functions).
*/
inline void lttv_menus_destroy(LttvMenus *h) {
+ g_critical("lttv_menus_destroy()");
g_array_free(h, TRUE);
}
* (functions).
*/
inline void lttv_toolbars_destroy(LttvToolbars *h) {
+ g_critical("lttv_toolbars_destroy");
g_array_free(h, TRUE);
}
#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;
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--;
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);
// 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
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){
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;
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);
}
{
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));
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);
#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);
}
/*****************************************************************************
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 ();
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()");
"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);
}
-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;
}
}
// 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);
}
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);
}
#include "CFV.h"
#include "Drawing.h"
#include "Process_List.h"
+#include "Event_Hooks.h"
+#include "CFV-private.h"
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
*
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);
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;
}
/* 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);
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;
+}
+
+
#define _CFV_H
#include <gtk/gtk.h>
+#include "lttv/common.h"
+#include "lttv/mainWindow.h"
+#include "Process_List.h"
typedef struct _ControlFlowData ControlFlowData;
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
#include "Drawing.h"
+#include "CFV.h"
#include <gtk/gtk.h>
#include <gdk/gdk.h>
};
-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)
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);
}
{
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);
-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);
- g_critical("drawing configure event");
-
if (Drawing->Pixmap)
gdk_pixmap_unref(Drawing->Pixmap);
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),
// Drawing->Drawing_Area_V->allocation.height,
// -1);
-
g_signal_connect (G_OBJECT(Drawing->Drawing_Area_V),
"configure_event",
G_CALLBACK (configure_event),
guint x, guint y,
guint width, guint height)
{
+ GdkRectangle update_rect;
+
gdk_draw_drawable(
Drawing->Drawing_Area_V->window,
Drawing->Drawing_Area_V->
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);
+
}
#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);
#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;
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;
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++)
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;
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(
}
+ Process_List->Test_Process_Sent = TRUE;
+
}
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) ;
}
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 */
+
+}
+
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
{
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;
}
"Process_List_Data",
Process_List,
(GDestroyNotify)ProcessList_destroy);
-
+
+ Process_List->Test_Process_Sent = 0;
+
return Process_List;
}
void ProcessList_destroy(ProcessList *Process_List)
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;
}
/* 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,
(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))
gint ProcessList_get_process_pixels( ProcessList *Process_List,
guint pid, LttTime *birth,
- guint *x,
+ guint *y,
guint *height)
{
ProcessInfo Process_Info;
*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 {
GHashTable *Process_Hash;
guint Number_Of_Process;
+ gboolean Test_Process_Sent;
};
// 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
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);
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);
typedef struct _EventViewerData {
mainWindow * mw;
- TimeInterval time_interval;
+ TimeWindow time_window;
LttTime current_time;
LttvHooks * before_event_hooks;
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
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();
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);
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;
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;
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");
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);
}
-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;
}
/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 \
/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 \
/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
/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:
/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/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:
../../../include/lttv/iattribute.h:
+../../../include/lttv/mainWindow.h:
+
+../../../include/lttv/gtkcustom.h:
+
../../../include/ltt/event.h:
/usr/include/string.h:
#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;
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);
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);
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);
}
(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);
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)
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);
}
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);
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);
}
#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.
*/
struct _LttvTraceset {
+ char * filename;
GPtrArray *traces;
GPtrArray *attributes;
LttvAttribute *a;
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;
g_free(s);
}
-
void lttv_traceset_add(LttvTraceset *s, LttTrace *t)
{
g_ptr_array_add(s->traces, t);