1 /*! \file gtkTraceSet.h
2 * \brief API used by the graphical viewers to interact with their top window.
4 * Main window (gui module) is the place to contain and display viewers.
5 * Viewers (lttv plugins) interacte with main window through this API and
7 * This header file should be included in each graphic module.
8 * This library is used by graphical modules to interact with the
15 #include <lttv/hook.h>
16 #include <lttv/common.h>
17 #include <lttv/stats.h>
20 * Function to register a view constructor so that main window can generate
21 * a toolbar item for the viewer in order to generate a new instance easily.
22 * It will be called by init function of the module.
23 * @param ButtonPixmap image shown on the toolbar item.
24 * @param tooltip tooltip of the toolbar item.
25 * @param view_constructor constructor of the viewer.
28 void ToolbarItemReg(char ** pixmap
, char *tooltip
, lttv_constructor view_constructor
);
32 * Function to unregister the viewer's constructor, release the space
33 * occupied by pixmap, tooltip and constructor of the viewer.
34 * It will be called when a module is unloaded.
35 * @param view_constructor constructor of the viewer which is used as
36 * a reference to find out where the pixmap and tooltip are.
39 void ToolbarItemUnreg(lttv_constructor view_constructor
);
43 * Function to register a view constructor so that main window can generate
44 * a menu item for the viewer in order to generate a new instance easily.
45 * It will be called by init function of the module.
46 * @param menu_path path of the menu item.
47 * @param menu_text text of the menu item.
48 * @param view_constructor constructor of the viewer.
51 void MenuItemReg(char *menu_path
, char *menu_text
, lttv_constructor view_constructor
);
55 * Function to unregister the viewer's constructor, release the space
56 * occupied by menu_path, menu_text and constructor of the viewer.
57 * It will be called when a module is unloaded.
58 * @param view_constructor constructor of the viewer which is used as
59 * a reference to find out where the menu_path and menu_text are.
62 void MenuItemUnreg(lttv_constructor view_constructor
);
66 * Attach a viewer to the current tab.
67 * It will be called in the constructor of the viewer.
68 * @param main_win the main window the viewer belongs to.
69 * @param viewer viewer to be attached to the current tab
72 // Not Needed : Main window add widget returned by constructor
73 //void AttachViewer(mainWindow *main_win, GtkWidget *viewer);
76 /* ?? Maybe we do not need this function, when a widget is destroyed,
77 * it will be removed automatically from its container
81 * Detach a viewer from the current tab.
82 * It will be called in the destructor of the viewer.
83 * @param main_win the main window the viewer belongs to.
84 * @param viewer viewer to be detached from the current tab.
87 //void DetachViewer(mainWindow *main_win, GtkWidget *viewer);
91 * Update the status bar whenever something changed in the viewer.
92 * @param main_win the main window the viewer belongs to.
93 * @param info the message which will be shown in the status bar.
96 void UpdateStatus(mainWindow
*main_win
, char *info
);
100 * Function to get the current time window of the current tab.
101 * It will be called by a viewer's hook function to update the
102 * time window of the viewer and also be called by the constructor
104 * @param main_win the main window the viewer belongs to.
105 * @param time_interval a pointer where time interval will be stored.
108 void GetTimeWindow(mainWindow
*main_win
, TimeWindow
*Time_Window
);
112 * Function to set the time interval of the current tab.
113 * It will be called by a viewer's signal handle associated with
114 * the move_slider signal
115 * @param main_win the main window the viewer belongs to.
116 * @param time_interval a pointer where time interval is stored.
119 void SetTimeWindow(mainWindow
*main_win
, TimeWindow
*Time_Window
);
122 * Function to get the time span of the main window's traceset.
124 void GetTracesetTimeSpan(mainWindow
*main_win
, TimeInterval
*Time_Interval
);
127 * Function to get the current time/event of the current tab.
128 * It will be called by a viewer's hook function to update the
129 * current time/event of the viewer.
130 * @param main_win the main window the viewer belongs to.
131 * @param time a pointer where time will be stored.
134 void GetCurrentTime(mainWindow
*main_win
, LttTime
*time
);
138 * Function to set the current time/event of the current tab.
139 * It will be called by a viewer's signal handle associated with
140 * the button-release-event signal
141 * @param main_win the main window the viewer belongs to.
142 * @param time a pointer where time is stored.
145 void SetCurrentTime(mainWindow
*main_win
, LttTime
*time
);
149 * Function to get the traceset from the current tab.
150 * It will be called by the constructor of the viewer and also be
151 * called by a hook funtion of the viewer to update its traceset.
152 * @param main_win the main window the viewer belongs to.
153 * @param traceset a pointer to a traceset.
156 //void GetTraceset(mainWindow *main_win, Traceset *traceset);
160 * Function to get the filter of the current tab.
161 * It will be called by the constructor of the viewer and also be
162 * called by a hook funtion of the viewer to update its filter.
163 * @param main_win, the main window the viewer belongs to.
164 * @param filter, a pointer to a filter.
167 //void GetFilter(mainWindow *main_win, Filter *filter);
171 * Function to register a hook function for a viewer to set/update its
173 * It will be called by the constructor of the viewer.
174 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
175 * @param hook_data hook data associated with the hook function.
176 * @param main_win the main window the viewer belongs to.
179 void RegUpdateTimeInterval(LttvHook hook
, gpointer hook_data
,
180 mainWindow
* main_win
);
184 * Function to unregister a viewer's hook function which is used to
185 * set/update the time interval of the viewer.
186 * It will be called by the destructor of the viewer.
187 * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
188 * @param hook_data hook data associated with the hook function.
189 * @param main_win the main window the viewer belongs to.
192 void UnregUpdateTimeInterval(LttvHook hook
, gpointer hook_data
,
193 mainWindow
* main_win
);
197 * Function to register a hook function for a viewer to set/update its
199 * It will be called by the constructor of the viewer.
200 * @param hook hook function of the viewer.
201 * @param hook_data hook data associated with the hook function.
202 * @param main_win the main window the viewer belongs to.
205 void RegUpdateTraceset(LttvHook hook
, gpointer hook_data
,
206 mainWindow
* main_win
);
210 * Function to unregister a viewer's hook function which is used to
211 * set/update the traceset of the viewer.
212 * It will be called by the destructor of the viewer.
213 * @param hook hook function of the viewer.
214 * @param hook_data hook data associated with the hook function.
215 * @param main_win the main window the viewer belongs to.
218 void UnregUpdateTraceset(LttvHook hook
, gpointer hook_data
,
219 mainWindow
* main_win
);
223 * Function to register a hook function for a viewer to set/update its
225 * It will be called by the constructor of the viewer.
226 * @param hook hook function of the viewer.
227 * @param hook_data hook data associated with the hook function.
228 * @param main_win the main window the viewer belongs to.
231 void RegUpdateFilter(LttvHook hook
, gpointer hook_data
,
232 mainWindow
*main_win
);
236 * Function to unregister a viewer's hook function which is used to
237 * set/update the filter of the viewer.
238 * It will be called by the destructor of the viewer.
239 * @param hook hook function of the viewer.
240 * @param hook_data hook data associated with the hook function.
241 * @param main_win the main window the viewer belongs to.
244 void UnregUpdateFilter(LttvHook hook
, gpointer hook_data
,
245 mainWindow
* main_win
);
249 * Function to register a hook function for a viewer to set/update its
251 * It will be called by the constructor of the viewer.
252 * @param hook hook function of the viewer.
253 * @param hook_data hook data associated with the hook function.
254 * @param main_win the main window the viewer belongs to.
257 void RegUpdateCurrentTime(LttvHook hook
, gpointer hook_data
,
258 mainWindow
*main_win
);
262 * Function to unregister a viewer's hook function which is used to
263 * set/update the current time of the viewer.
264 * It will be called by the destructor of the viewer.
265 * @param hook hook function of the viewer.
266 * @param hook_data hook data associated with the hook function.
267 * @param main_win the main window the viewer belongs to.
270 void UnregUpdateCurrentTime(LttvHook hook
, gpointer hook_data
,
271 mainWindow
* main_win
);
275 * Function to set the focused pane (viewer).
276 * It will be called by a viewer's signal handle associated with
277 * the grab_focus signal
278 * @param main_win the main window the viewer belongs to.
279 * @param paned a pointer to a pane where the viewer is contained.
282 void SetFocusedPane(mainWindow
*main_win
, gpointer paned
);
286 * Function to register a hook function for a viewer to set/update the
287 * dividor of the hpane.
288 * It will be called by the constructor of the viewer.
289 * @param hook hook function of the viewer.
290 * @param hook_data hook data associated with the hook function.
291 * @param main_win the main window the viewer belongs to.
294 void RegUpdateDividor(LttvHook hook
, gpointer hook_data
,
295 mainWindow
*main_win
);
299 * Function to unregister a viewer's hook function which is used to
300 * set/update hpane's dividor of the viewer.
301 * It will be called by the destructor of the viewer.
302 * @param hook hook function of the viewer.
303 * @param hook_data hook data associated with the hook function.
304 * @param main_win the main window the viewer belongs to.
307 void UnregUpdateDividor(LttvHook hook
, gpointer hook_data
,
308 mainWindow
*main_win
);
312 * Function to set the position of the hpane's dividor (viewer).
313 * It will be called by a viewer's signal handle associated with
314 * the motion_notify_event event/signal
315 * @param main_win the main window the viewer belongs to.
316 * @param position position of the hpane's dividor.
319 void SetHPaneDividor(mainWindow
*main_win
, gint position
);
323 * Function to process traceset. It will call lttv_process_trace,
324 * each view will call this api to get events.
325 * @param main_win the main window the viewer belongs to.
326 * @param start the start time of the first event to be processed.
327 * @param end the end time of the last event to be processed.
330 void processTraceset(mainWindow
*main_win
, LttTime start
,
331 LttTime end
, unsigned maxNumEvents
);
335 * Function to add hooks into the context of a traceset,
336 * before reading events from traceset, viewer will call this api to
338 * @param main_win the main window the viewer belongs to.
339 * @param LttvHooks hooks to be registered.
342 void contextAddHooks(mainWindow
*main_win
,
343 LttvHooks
*before_traceset
,
344 LttvHooks
*after_traceset
,
345 LttvHooks
*check_trace
,
346 LttvHooks
*before_trace
,
347 LttvHooks
*after_trace
,
348 LttvHooks
*check_tracefile
,
349 LttvHooks
*before_tracefile
,
350 LttvHooks
*after_tracefile
,
351 LttvHooks
*check_event
,
352 LttvHooks
*before_event
,
353 LttvHooks
*after_event
);
357 * Function to remove hooks from the context of a traceset,
358 * before reading events from traceset, viewer will call this api to
360 * @param main_win the main window the viewer belongs to.
361 * @param LttvHooks hooks to be registered.
364 void contextRemoveHooks(mainWindow
*main_win
,
365 LttvHooks
*before_traceset
,
366 LttvHooks
*after_traceset
,
367 LttvHooks
*check_trace
,
368 LttvHooks
*before_trace
,
369 LttvHooks
*after_trace
,
370 LttvHooks
*check_tracefile
,
371 LttvHooks
*before_tracefile
,
372 LttvHooks
*after_tracefile
,
373 LttvHooks
*check_event
,
374 LttvHooks
*before_event
,
375 LttvHooks
*after_event
);
379 * Function to get the life span of the traceset
380 * @param main_win the main window the viewer belongs to.
381 * @param start start time of the traceset.
382 * @param end end time of the traceset.
385 void getTracesetTimeSpan(mainWindow
*main_win
, TimeInterval
*time_span
);
389 * Function to add/remove event hooks for state
390 * @param main_win the main window the viewer belongs to.
393 void stateAddEventHooks(mainWindow
*main_win
);
394 void stateRemoveEventHooks(mainWindow
*main_win
);
398 * Function to add/remove event hooks for stats
399 * @param main_win the main window the viewer belongs to.
402 void statsAddEventHooks(mainWindow
*main_win
);
403 void statsRemoveEventHooks(mainWindow
*main_win
);
407 * Function to get the stats of the traceset
408 * @param main_win the main window the viewer belongs to.
411 LttvTracesetStats
* getTracesetStats(mainWindow
*main_win
);