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>
18 #include <lttv/mainWindow.h>
21 * Function to register a view constructor so that main window can generate
22 * a toolbar item for the viewer in order to generate a new instance easily.
23 * It will be called by init function of the module.
24 * @param ButtonPixmap image shown on the toolbar item.
25 * @param tooltip tooltip of the toolbar item.
26 * @param view_constructor constructor of the viewer.
29 void ToolbarItemReg(char ** pixmap
, char *tooltip
, lttv_constructor view_constructor
);
33 * Function to unregister the viewer's constructor, release the space
34 * occupied by pixmap, tooltip and constructor of the viewer.
35 * It will be called when a module is unloaded.
36 * @param view_constructor constructor of the viewer which is used as
37 * a reference to find out where the pixmap and tooltip are.
40 void ToolbarItemUnreg(lttv_constructor view_constructor
);
44 * Function to register a view constructor so that main window can generate
45 * a menu item for the viewer in order to generate a new instance easily.
46 * It will be called by init function of the module.
47 * @param menu_path path of the menu item.
48 * @param menu_text text of the menu item.
49 * @param view_constructor constructor of the viewer.
52 void MenuItemReg(char *menu_path
, char *menu_text
, lttv_constructor view_constructor
);
56 * Function to unregister the viewer's constructor, release the space
57 * occupied by menu_path, menu_text and constructor of the viewer.
58 * It will be called when a module is unloaded.
59 * @param view_constructor constructor of the viewer which is used as
60 * a reference to find out where the menu_path and menu_text are.
63 void MenuItemUnreg(lttv_constructor view_constructor
);
67 * Attach a viewer to the current tab.
68 * It will be called in the constructor of the viewer.
69 * @param main_win the main window the viewer belongs to.
70 * @param viewer viewer to be attached to the current tab
73 // Not Needed : Main window add widget returned by constructor
74 //void AttachViewer(mainWindow *main_win, GtkWidget *viewer);
77 /* ?? Maybe we do not need this function, when a widget is destroyed,
78 * it will be removed automatically from its container
82 * Detach a viewer from the current tab.
83 * It will be called in the destructor of the viewer.
84 * @param main_win the main window the viewer belongs to.
85 * @param viewer viewer to be detached from the current tab.
88 //void DetachViewer(mainWindow *main_win, GtkWidget *viewer);
92 * Update the status bar whenever something changed in the viewer.
93 * @param main_win the main window the viewer belongs to.
94 * @param info the message which will be shown in the status bar.
97 void UpdateStatus(mainWindow
*main_win
, char *info
);
101 * Function to get the current time window of the current tab.
102 * It will be called by a viewer's hook function to update the
103 * time window of the viewer and also be called by the constructor
105 * @param main_win the main window the viewer belongs to.
106 * @param time_interval a pointer where time interval will be stored.
109 void GetTimeWindow(mainWindow
*main_win
, TimeWindow
*Time_Window
);
113 * Function to set the time interval of the current tab.
114 * It will be called by a viewer's signal handle associated with
115 * the move_slider signal
116 * @param main_win the main window the viewer belongs to.
117 * @param time_interval a pointer where time interval is stored.
120 void SetTimeWindow(mainWindow
*main_win
, TimeWindow
*Time_Window
);
123 * Function to get the time span of the main window's traceset.
125 void GetTracesetTimeSpan(mainWindow
*main_win
, TimeInterval
*Time_Interval
);
128 * Function to get the current time/event of the current tab.
129 * It will be called by a viewer's hook function to update the
130 * current time/event of the viewer.
131 * @param main_win the main window the viewer belongs to.
132 * @param time a pointer where time will be stored.
135 void GetCurrentTime(mainWindow
*main_win
, LttTime
*time
);
139 * Function to set the current time/event of the current tab.
140 * It will be called by a viewer's signal handle associated with
141 * the button-release-event signal
142 * @param main_win the main window the viewer belongs to.
143 * @param time a pointer where time is stored.
146 void SetCurrentTime(mainWindow
*main_win
, LttTime
*time
);
150 * Function to get the traceset from the current tab.
151 * It will be called by the constructor of the viewer and also be
152 * called by a hook funtion of the viewer to update its traceset.
153 * @param main_win the main window the viewer belongs to.
154 * @param traceset a pointer to a traceset.
157 //void GetTraceset(mainWindow *main_win, Traceset *traceset);
161 * Function to get the filter of the current tab.
162 * It will be called by the constructor of the viewer and also be
163 * called by a hook funtion of the viewer to update its filter.
164 * @param main_win, the main window the viewer belongs to.
165 * @param filter, a pointer to a filter.
168 //void GetFilter(mainWindow *main_win, Filter *filter);
172 * Function to register a hook function for a viewer to set/update its
174 * It will be called by the constructor of the viewer.
175 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
176 * @param hook_data hook data associated with the hook function.
177 * @param main_win the main window the viewer belongs to.
180 void RegUpdateTimeInterval(LttvHook hook
, gpointer hook_data
,
181 mainWindow
* main_win
);
185 * Function to unregister a viewer's hook function which is used to
186 * set/update the time interval of the viewer.
187 * It will be called by the destructor of the viewer.
188 * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
189 * @param hook_data hook data associated with the hook function.
190 * @param main_win the main window the viewer belongs to.
193 void UnregUpdateTimeInterval(LttvHook hook
, gpointer hook_data
,
194 mainWindow
* main_win
);
198 * Function to register a hook function for a viewer to set/update its
200 * It will be called by the constructor of the viewer.
201 * @param hook hook function of the viewer.
202 * @param hook_data hook data associated with the hook function.
203 * @param main_win the main window the viewer belongs to.
206 void RegUpdateTraceset(LttvHook hook
, gpointer hook_data
,
207 mainWindow
* main_win
);
211 * Function to unregister a viewer's hook function which is used to
212 * set/update the traceset of the viewer.
213 * It will be called by the destructor of the viewer.
214 * @param hook hook function of the viewer.
215 * @param hook_data hook data associated with the hook function.
216 * @param main_win the main window the viewer belongs to.
219 void UnregUpdateTraceset(LttvHook hook
, gpointer hook_data
,
220 mainWindow
* main_win
);
224 * Function to register a hook function for a viewer to set/update its
226 * It will be called by the constructor of the viewer.
227 * @param hook hook function of the viewer.
228 * @param hook_data hook data associated with the hook function.
229 * @param main_win the main window the viewer belongs to.
232 void RegUpdateFilter(LttvHook hook
, gpointer hook_data
,
233 mainWindow
*main_win
);
237 * Function to unregister a viewer's hook function which is used to
238 * set/update the filter of the viewer.
239 * It will be called by the destructor of the viewer.
240 * @param hook hook function of the viewer.
241 * @param hook_data hook data associated with the hook function.
242 * @param main_win the main window the viewer belongs to.
245 void UnregUpdateFilter(LttvHook hook
, gpointer hook_data
,
246 mainWindow
* main_win
);
250 * Function to register a hook function for a viewer to set/update its
252 * It will be called by the constructor of the viewer.
253 * @param hook hook function of the viewer.
254 * @param hook_data hook data associated with the hook function.
255 * @param main_win the main window the viewer belongs to.
258 void RegUpdateCurrentTime(LttvHook hook
, gpointer hook_data
,
259 mainWindow
*main_win
);
263 * Function to unregister a viewer's hook function which is used to
264 * set/update the current time of the viewer.
265 * It will be called by the destructor of the viewer.
266 * @param hook hook function of the viewer.
267 * @param hook_data hook data associated with the hook function.
268 * @param main_win the main window the viewer belongs to.
271 void UnregUpdateCurrentTime(LttvHook hook
, gpointer hook_data
,
272 mainWindow
* main_win
);
276 * Function to set the focused pane (viewer).
277 * It will be called by a viewer's signal handle associated with
278 * the grab_focus signal
279 * @param main_win the main window the viewer belongs to.
280 * @param paned a pointer to a pane where the viewer is contained.
283 void SetFocusedPane(mainWindow
*main_win
, gpointer paned
);
287 * Function to register a hook function for a viewer to set/update the
288 * dividor of the hpane.
289 * It will be called by the constructor of the viewer.
290 * @param hook hook function of the viewer.
291 * @param hook_data hook data associated with the hook function.
292 * @param main_win the main window the viewer belongs to.
295 void RegUpdateDividor(LttvHook hook
, gpointer hook_data
,
296 mainWindow
*main_win
);
300 * Function to unregister a viewer's hook function which is used to
301 * set/update hpane's dividor of the viewer.
302 * It will be called by the destructor of the viewer.
303 * @param hook hook function of the viewer.
304 * @param hook_data hook data associated with the hook function.
305 * @param main_win the main window the viewer belongs to.
308 void UnregUpdateDividor(LttvHook hook
, gpointer hook_data
,
309 mainWindow
*main_win
);
313 * Function to set the position of the hpane's dividor (viewer).
314 * It will be called by a viewer's signal handle associated with
315 * the motion_notify_event event/signal
316 * @param main_win the main window the viewer belongs to.
317 * @param position position of the hpane's dividor.
320 void SetHPaneDividor(mainWindow
*main_win
, gint position
);
324 * Function to process traceset. It will call lttv_process_trace,
325 * each view will call this api to get events.
326 * @param main_win the main window the viewer belongs to.
327 * @param start the start time of the first event to be processed.
328 * @param end the end time of the last event to be processed.
331 void processTraceset(mainWindow
*main_win
, LttTime start
,
332 LttTime end
, unsigned maxNumEvents
);
336 * Function to add hooks into the context of a traceset,
337 * before reading events from traceset, viewer will call this api to
339 * @param main_win the main window the viewer belongs to.
340 * @param LttvHooks hooks to be registered.
343 void contextAddHooks(mainWindow
*main_win
,
344 LttvHooks
*before_traceset
,
345 LttvHooks
*after_traceset
,
346 LttvHooks
*check_trace
,
347 LttvHooks
*before_trace
,
348 LttvHooks
*after_trace
,
349 LttvHooks
*check_tracefile
,
350 LttvHooks
*before_tracefile
,
351 LttvHooks
*after_tracefile
,
352 LttvHooks
*check_event
,
353 LttvHooks
*before_event
,
354 LttvHooks
*after_event
);
358 * Function to remove hooks from the context of a traceset,
359 * before reading events from traceset, viewer will call this api to
361 * @param main_win the main window the viewer belongs to.
362 * @param LttvHooks hooks to be registered.
365 void contextRemoveHooks(mainWindow
*main_win
,
366 LttvHooks
*before_traceset
,
367 LttvHooks
*after_traceset
,
368 LttvHooks
*check_trace
,
369 LttvHooks
*before_trace
,
370 LttvHooks
*after_trace
,
371 LttvHooks
*check_tracefile
,
372 LttvHooks
*before_tracefile
,
373 LttvHooks
*after_tracefile
,
374 LttvHooks
*check_event
,
375 LttvHooks
*before_event
,
376 LttvHooks
*after_event
);
380 * Function to get the life span of the traceset
381 * @param main_win the main window the viewer belongs to.
382 * @param start start time of the traceset.
383 * @param end end time of the traceset.
386 void getTracesetTimeSpan(mainWindow
*main_win
, TimeInterval
*time_span
);
390 * Function to add/remove event hooks for state
391 * @param main_win the main window the viewer belongs to.
394 void stateAddEventHooks(mainWindow
*main_win
);
395 void stateRemoveEventHooks(mainWindow
*main_win
);
399 * Function to add/remove event hooks for stats
400 * @param main_win the main window the viewer belongs to.
403 void statsAddEventHooks(mainWindow
*main_win
);
404 void statsRemoveEventHooks(mainWindow
*main_win
);
408 * Function to get the stats of the traceset
409 * @param main_win the main window the viewer belongs to.
412 LttvTracesetStats
* getTracesetStats(mainWindow
*main_win
);