From: compudj Date: Fri, 30 May 2003 14:32:23 +0000 (+0000) Subject: modules creation X-Git-Tag: v0.12.20~3446 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=92bd6e98c732cff37c9af1f6e8601f91bd0f53b3;p=lttv.git modules creation git-svn-id: http://ltt.polymtl.ca/svn@43 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/traceWindow.h b/ltt/branches/poly/lttv/modules/traceWindow.h new file mode 100644 index 00000000..739c09a6 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/traceWindow.h @@ -0,0 +1,261 @@ +/** + * Main window (main module) is the place to contain and display viewers. + * Viewers (lttv modules) interacter with main window though API of the + * main window and hooks of itself. + * This header file should be included in each graphic module. + */ + +#include +#include +#include + +/** + * Function to register a view constructor so that main window can generate + * a toolbar item for the viewer in order to generate a new instance easily. + * It will be called by init function of the module. + * @param pixmap, pixmap shown on the toolbar item. + * @param tooltip, tooltip of the toolbar item. + * @view_constructor, constructor of the viewer. + */ + +void ToolbarItemReg(GdkPixmap *pixmap, char *tooltip, void *view_constructor); + + +/** + * Function to unregister the viewer's constructor, release the space + * occupied by pixmap, tooltip and constructor of the viewer. + * It will be called when a module is unloaded. + * @param view_constructor, constructor of the viewer which is used as + * a reference to find out where the pixmap and tooltip are. + */ + +void ToolbarItemUnreg(void *view_constructor); + + +/** + * Function to register a view constructor so that main window can generate + * a menu item for the viewer in order to generate a new instance easily. + * It will be called by init function of the module. + * @param menu_path, path of the menu item. + * @param menu_text, text of the menu item. + * @view_constructor, constructor of the viewer. + */ + +void MenuItemReg(char *menu_path, char *menu_text, void *view_constructor); + + +/** + * Function to unregister the viewer's constructor, release the space + * occupied by menu_path, menu_text and constructor of the viewer. + * It will be called when a module is unloaded. + * @param view_constructor, constructor of the viewer which is used as + * a reference to find out where the menu_path and menu_text are. + */ + +void MenuItemUnreg(void *view_constructor); + + +/** + * Attach a viewer to the current tab. + * It will be called in the constructor of the viewer. + * @param main_win, the main window the viewer belongs to. + * @param viewer, viewer to be attached to the current tab + */ + +void AttachViewer(MainWindow *main_win, GtkWidget *viewer); + + +/* ?? Maybe we do not need this function, when a widget is destoried, + * it will be removed automatically from its container + */ + +/** + * Detach a viewer from the current tab. + * It will be called in the destructor of the viewer. + * @param main_win, the main window the viewer belongs to. + * @param viewer, viewer to be detached from the current tab. + */ + +void DetachViewer(MainWindow *main_win, GtkWidget *viewer); + + +/** + * Update the status bar whenever something changed in the viewer. + * @param main_win, the main window the viewer belongs to. + * @param info, the message which will be shown in the status bar. + */ + +void UpdateStatus(MainWindow *main_win, char *info); + + +/** + * Function to get the current time interval 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 + * 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); + + +/** + * Function to set the time interval of the current tab. + * It will be called by a viewer's signal handle associated with + * the move_slider signal + * @param main_win, the main window the viewer belongs to. + * @param time_interval, a pointer where time interval is stored. + */ + +void SetTimeInterval(MainWindow *main_win, TimeInterval *time_interval); + + +/** + * Function to get the current time/event of the current tab. + * It will be called by a viewer's hook function to update the + * current time/event of the viewer. + * @param main_win, the main window the viewer belongs to. + * @param ltt_time, a pointer where time will be stored. + */ + +void GetCurrentTime(MainWindow *main_win, ltt_time *time); + + +/** + * Function to set the current time/event of the current tab. + * It will be called by a viewer's signal handle associated with + * the button-release-event signal + * @param main_win, the main window the viewer belongs to. + * @param ltt_time, a pointer where time is stored. + */ + +void SetCurrentTime(MainWindow *main_win, ltt_time *time); + + +/** + * Function to get the traceset from the current tab. + * It will be called by the constructor of the viewer and also be + * called by a hook funtion of the viewer to update its traceset. + * @param main_win, the main window the viewer belongs to. + * @param traceset, a pointer to a traceset. + */ + +void GetTraceset(MainWindow *main_win, Traceset *traceset); + + +/** + * Function to get the filter of the current tab. + * It will be called by the constructor of the viewer and also be + * called by a hook funtion of the viewer to update its filter. + * @param main_win, the main window the viewer belongs to. + * @param filter, a pointer to a filter. + */ + +void GetFilter(MainWindow *main_win, Filter *filter); + + +/** + * 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_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void RegUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, + MainWindow * main_win); + + +/** + * 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_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void UnregUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, + MainWindow * main_win); + + +/** + * Function to register a hook function for a viewer to set/update its + * traceset. + * It will be called by the constructor of the viewer. + * @param hook, hook function of the viewer. + * @param hook_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void RegUpdateTraceset(lttv_hook *hook, Traceset *hook_data, + MainWindow * main_win); + + +/** + * Function to unregister a viewer's hook function which is used to + * set/update the traceset of the viewer. + * It will be called by the destructor of the viewer. + * @param hook, hook function of the viewer. + * @param hook_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void UnregUpdateTraceset(lttv_hook *hook, Traceset *hook_data, + MainWindow * main_win); + + +/** + * Function to register a hook function for a viewer to set/update its + * filter. + * It will be called by the constructor of the viewer. + * @param hook, hook function of the viewer. + * @param hook_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void RegUpdateFilter(lttv_hook *hook, Filter *hook_data, + MainWindow *main_win); + + +/** + * Function to unregister a viewer's hook function which is used to + * set/update the filter of the viewer. + * It will be called by the destructor of the viewer. + * @param hook, hook function of the viewer. + * @param hook_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void UnregUpdateFilter(lttv_hook *hook, Filter *hook_data, + MainWindow * main_win); + + +/** + * Function to register a hook function for a viewer to set/update its + * current time. + * It will be called by the constructor of the viewer. + * @param hook, hook function of the viewer. + * @param hook_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void RegUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, + MainWindow *main_win); + + +/** + * Function to unregister a viewer's hook function which is used to + * set/update the current time of the viewer. + * It will be called by the destructor of the viewer. + * @param hook, hook function of the viewer. + * @param hook_data, hook data associated with the hook function. + * @param main_win, the main window the viewer belongs to. + */ + +void UnregUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, + MainWindow * main_win); + + diff --git a/ltt/branches/poly/lttv/trace-specific-code/trace.c b/ltt/branches/poly/lttv/trace-specific-code/trace.c deleted file mode 100644 index 55f6103d..00000000 --- a/ltt/branches/poly/lttv/trace-specific-code/trace.c +++ /dev/null @@ -1,136 +0,0 @@ -/* 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. - A trace set is defined when several traces are to be analyzed together, - possibly to study the interactions between events in the different traces. -*/ - -struct _lttv_trace_set { - GPtrArray *traces; - lttv_attributes *a; -}; - -struct _lttv_trace { - GPtrArray *all_cpu; - GPtrArray *per_cpu; - char *name; - lttv_attributes *a; -}; - - -struct _lttv_tracefile { - ltt_tracefile *t; - lttv_attributes *a; -}; - - -lttv_trace_set *lttv_trace_set_new() { - lttv_trace_set s; - - s = g_new(lttv_trace_set, 1); - s->traces = g_ptr_array_new(); - s->a = lttv_attributes_new(); -} - -lttv_trace_set *lttv_trace_set_destroy(lttv_trace_set *s) { - g_ptr_array_free(s->traces); - lttv_attributes_destroy(s->a); - return g_free(s); -} - -void lttv_trace_set_add(lttv_trace_set *s, lttv_trace *t) { - g_ptr_array_add(s,t); -} - -unsigned lttv_trace_set_number(lttv_trace_set *s) { - return s->traces.len; -} - - -lttv_trace *lttv_trace_set_get(lttv_trace_set *s, unsigned i) { - g_assert(s->traces->len <= i); - return s->traces.pdata[i]; -} - - -lttv_trace *lttv_trace_set_remove(lttv_trace_set *s, unsigned i) { - return g_ptr_array_remove_index(s->traces,i); -} - - -/* Look at all files in the directory. Open all those with ltt as extension - and sort these as per cpu or all cpu. */ - -lttv_trace *lttv_trace_open(char *pathname) { - lttv_trace *t; - - t = g_new(lttv_trace, 1); - t->per_cpu = g_ptr_array_new(); - t->all_cpu = g_ptr_array_new(); - t->a = lttv_attributes_new(); - return t; -} - -int lttv_trace_close(lttv_trace *t) { - - g_ptr_array_free(t->per_cpu); - g_ptr_array_free(t->all_cpu); - lttv_attributes_destroy(t->a); - g_free(t); - return 0; -} - -char *lttv_trace_name(lttv_trace *t) { - return t->name; -} - - -unsigned int lttv_trace_tracefile_number(lttv_trace *t) { - return t->per_cpu->len + t->all_cpu->len; -} - -unsigned int lttv_trace_cpu_number(lttv_trace *t) { - /* */ -} - -unsigned int lttv_trace_tracefile_number_per_cpu(lttv_trace *t) { - return t->per_cpu->len; -} - -unsigned int lttv_trace_tracefile_number_all_cpu(lttv_trace *t) { - return t->all_cpu_len; -} - -lttv_tracefile *lttv_trace_tracefile_get_per_cpu(lttv_trace *t, unsigned i) { - return t->per_cpu->pdata[i]; -} - -lttv_tracefile *lttv_trace_tracefile_get_all_cpu(lttv_trace *t, unsigned i) { - return t->all_cpu->pdata[i]; -} - - -/* A set of attributes is attached to each trace set, trace and tracefile - to store user defined data as needed. */ - -lttv_attributes *lttv_trace_set_attributes(lttv_trace_set *s) { - return s->a; -} - -lttv_attributes *lttv_trace_attributes(lttv_trace *t) { - return t->a; -} - -lttv_attributes *lttv_tracefile_attributes(lttv_tracefile *tf) { - return tf->a; -} - - -ltt_tracefile *lttv_tracefile_ltt_tracefile(lttv_tracefile *tf) { - return tf->t; -} - -char *lttv_tracefile_name(lttv_tracefile *tf) { - return tf->name; -} - - diff --git a/ltt/branches/poly/lttv/trace.c b/ltt/branches/poly/lttv/trace.c new file mode 100644 index 00000000..55f6103d --- /dev/null +++ b/ltt/branches/poly/lttv/trace.c @@ -0,0 +1,136 @@ +/* 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. + A trace set is defined when several traces are to be analyzed together, + possibly to study the interactions between events in the different traces. +*/ + +struct _lttv_trace_set { + GPtrArray *traces; + lttv_attributes *a; +}; + +struct _lttv_trace { + GPtrArray *all_cpu; + GPtrArray *per_cpu; + char *name; + lttv_attributes *a; +}; + + +struct _lttv_tracefile { + ltt_tracefile *t; + lttv_attributes *a; +}; + + +lttv_trace_set *lttv_trace_set_new() { + lttv_trace_set s; + + s = g_new(lttv_trace_set, 1); + s->traces = g_ptr_array_new(); + s->a = lttv_attributes_new(); +} + +lttv_trace_set *lttv_trace_set_destroy(lttv_trace_set *s) { + g_ptr_array_free(s->traces); + lttv_attributes_destroy(s->a); + return g_free(s); +} + +void lttv_trace_set_add(lttv_trace_set *s, lttv_trace *t) { + g_ptr_array_add(s,t); +} + +unsigned lttv_trace_set_number(lttv_trace_set *s) { + return s->traces.len; +} + + +lttv_trace *lttv_trace_set_get(lttv_trace_set *s, unsigned i) { + g_assert(s->traces->len <= i); + return s->traces.pdata[i]; +} + + +lttv_trace *lttv_trace_set_remove(lttv_trace_set *s, unsigned i) { + return g_ptr_array_remove_index(s->traces,i); +} + + +/* Look at all files in the directory. Open all those with ltt as extension + and sort these as per cpu or all cpu. */ + +lttv_trace *lttv_trace_open(char *pathname) { + lttv_trace *t; + + t = g_new(lttv_trace, 1); + t->per_cpu = g_ptr_array_new(); + t->all_cpu = g_ptr_array_new(); + t->a = lttv_attributes_new(); + return t; +} + +int lttv_trace_close(lttv_trace *t) { + + g_ptr_array_free(t->per_cpu); + g_ptr_array_free(t->all_cpu); + lttv_attributes_destroy(t->a); + g_free(t); + return 0; +} + +char *lttv_trace_name(lttv_trace *t) { + return t->name; +} + + +unsigned int lttv_trace_tracefile_number(lttv_trace *t) { + return t->per_cpu->len + t->all_cpu->len; +} + +unsigned int lttv_trace_cpu_number(lttv_trace *t) { + /* */ +} + +unsigned int lttv_trace_tracefile_number_per_cpu(lttv_trace *t) { + return t->per_cpu->len; +} + +unsigned int lttv_trace_tracefile_number_all_cpu(lttv_trace *t) { + return t->all_cpu_len; +} + +lttv_tracefile *lttv_trace_tracefile_get_per_cpu(lttv_trace *t, unsigned i) { + return t->per_cpu->pdata[i]; +} + +lttv_tracefile *lttv_trace_tracefile_get_all_cpu(lttv_trace *t, unsigned i) { + return t->all_cpu->pdata[i]; +} + + +/* A set of attributes is attached to each trace set, trace and tracefile + to store user defined data as needed. */ + +lttv_attributes *lttv_trace_set_attributes(lttv_trace_set *s) { + return s->a; +} + +lttv_attributes *lttv_trace_attributes(lttv_trace *t) { + return t->a; +} + +lttv_attributes *lttv_tracefile_attributes(lttv_tracefile *tf) { + return tf->a; +} + + +ltt_tracefile *lttv_tracefile_ltt_tracefile(lttv_tracefile *tf) { + return tf->t; +} + +char *lttv_tracefile_name(lttv_tracefile *tf) { + return tf->name; +} + + diff --git a/ltt/branches/poly/lttv/traceWindow.h b/ltt/branches/poly/lttv/traceWindow.h deleted file mode 100644 index 739c09a6..00000000 --- a/ltt/branches/poly/lttv/traceWindow.h +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Main window (main module) is the place to contain and display viewers. - * Viewers (lttv modules) interacter with main window though API of the - * main window and hooks of itself. - * This header file should be included in each graphic module. - */ - -#include -#include -#include - -/** - * Function to register a view constructor so that main window can generate - * a toolbar item for the viewer in order to generate a new instance easily. - * It will be called by init function of the module. - * @param pixmap, pixmap shown on the toolbar item. - * @param tooltip, tooltip of the toolbar item. - * @view_constructor, constructor of the viewer. - */ - -void ToolbarItemReg(GdkPixmap *pixmap, char *tooltip, void *view_constructor); - - -/** - * Function to unregister the viewer's constructor, release the space - * occupied by pixmap, tooltip and constructor of the viewer. - * It will be called when a module is unloaded. - * @param view_constructor, constructor of the viewer which is used as - * a reference to find out where the pixmap and tooltip are. - */ - -void ToolbarItemUnreg(void *view_constructor); - - -/** - * Function to register a view constructor so that main window can generate - * a menu item for the viewer in order to generate a new instance easily. - * It will be called by init function of the module. - * @param menu_path, path of the menu item. - * @param menu_text, text of the menu item. - * @view_constructor, constructor of the viewer. - */ - -void MenuItemReg(char *menu_path, char *menu_text, void *view_constructor); - - -/** - * Function to unregister the viewer's constructor, release the space - * occupied by menu_path, menu_text and constructor of the viewer. - * It will be called when a module is unloaded. - * @param view_constructor, constructor of the viewer which is used as - * a reference to find out where the menu_path and menu_text are. - */ - -void MenuItemUnreg(void *view_constructor); - - -/** - * Attach a viewer to the current tab. - * It will be called in the constructor of the viewer. - * @param main_win, the main window the viewer belongs to. - * @param viewer, viewer to be attached to the current tab - */ - -void AttachViewer(MainWindow *main_win, GtkWidget *viewer); - - -/* ?? Maybe we do not need this function, when a widget is destoried, - * it will be removed automatically from its container - */ - -/** - * Detach a viewer from the current tab. - * It will be called in the destructor of the viewer. - * @param main_win, the main window the viewer belongs to. - * @param viewer, viewer to be detached from the current tab. - */ - -void DetachViewer(MainWindow *main_win, GtkWidget *viewer); - - -/** - * Update the status bar whenever something changed in the viewer. - * @param main_win, the main window the viewer belongs to. - * @param info, the message which will be shown in the status bar. - */ - -void UpdateStatus(MainWindow *main_win, char *info); - - -/** - * Function to get the current time interval 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 - * 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); - - -/** - * Function to set the time interval of the current tab. - * It will be called by a viewer's signal handle associated with - * the move_slider signal - * @param main_win, the main window the viewer belongs to. - * @param time_interval, a pointer where time interval is stored. - */ - -void SetTimeInterval(MainWindow *main_win, TimeInterval *time_interval); - - -/** - * Function to get the current time/event of the current tab. - * It will be called by a viewer's hook function to update the - * current time/event of the viewer. - * @param main_win, the main window the viewer belongs to. - * @param ltt_time, a pointer where time will be stored. - */ - -void GetCurrentTime(MainWindow *main_win, ltt_time *time); - - -/** - * Function to set the current time/event of the current tab. - * It will be called by a viewer's signal handle associated with - * the button-release-event signal - * @param main_win, the main window the viewer belongs to. - * @param ltt_time, a pointer where time is stored. - */ - -void SetCurrentTime(MainWindow *main_win, ltt_time *time); - - -/** - * Function to get the traceset from the current tab. - * It will be called by the constructor of the viewer and also be - * called by a hook funtion of the viewer to update its traceset. - * @param main_win, the main window the viewer belongs to. - * @param traceset, a pointer to a traceset. - */ - -void GetTraceset(MainWindow *main_win, Traceset *traceset); - - -/** - * Function to get the filter of the current tab. - * It will be called by the constructor of the viewer and also be - * called by a hook funtion of the viewer to update its filter. - * @param main_win, the main window the viewer belongs to. - * @param filter, a pointer to a filter. - */ - -void GetFilter(MainWindow *main_win, Filter *filter); - - -/** - * 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_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void RegUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, - MainWindow * main_win); - - -/** - * 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_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void UnregUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, - MainWindow * main_win); - - -/** - * Function to register a hook function for a viewer to set/update its - * traceset. - * It will be called by the constructor of the viewer. - * @param hook, hook function of the viewer. - * @param hook_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void RegUpdateTraceset(lttv_hook *hook, Traceset *hook_data, - MainWindow * main_win); - - -/** - * Function to unregister a viewer's hook function which is used to - * set/update the traceset of the viewer. - * It will be called by the destructor of the viewer. - * @param hook, hook function of the viewer. - * @param hook_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void UnregUpdateTraceset(lttv_hook *hook, Traceset *hook_data, - MainWindow * main_win); - - -/** - * Function to register a hook function for a viewer to set/update its - * filter. - * It will be called by the constructor of the viewer. - * @param hook, hook function of the viewer. - * @param hook_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void RegUpdateFilter(lttv_hook *hook, Filter *hook_data, - MainWindow *main_win); - - -/** - * Function to unregister a viewer's hook function which is used to - * set/update the filter of the viewer. - * It will be called by the destructor of the viewer. - * @param hook, hook function of the viewer. - * @param hook_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void UnregUpdateFilter(lttv_hook *hook, Filter *hook_data, - MainWindow * main_win); - - -/** - * Function to register a hook function for a viewer to set/update its - * current time. - * It will be called by the constructor of the viewer. - * @param hook, hook function of the viewer. - * @param hook_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void RegUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, - MainWindow *main_win); - - -/** - * Function to unregister a viewer's hook function which is used to - * set/update the current time of the viewer. - * It will be called by the destructor of the viewer. - * @param hook, hook function of the viewer. - * @param hook_data, hook data associated with the hook function. - * @param main_win, the main window the viewer belongs to. - */ - -void UnregUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, - MainWindow * main_win); - -