1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Xiangxiu Yang
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 CHECK Rename to viewer.h
22 Things that can happen to a viewer:
32 Things that a viewer can do:
47 /*! \file gtktraceset.h
48 * \brief API used by the graphical viewers to interact with their top window.
50 * Main window (gui module) is the place to contain and display viewers.
51 * Viewers (lttv plugins) interacte with main window through this API and
53 * This header file should be included in each graphic module.
54 * This library is used by graphical modules to interact with the
61 #include <lttv/hook.h>
62 #include <lttvgui/common.h>
63 #include <lttv/stats.h>
66 * Function to register a view constructor so that main window can generate
67 * a toolbar item for the viewer in order to generate a new instance easily.
68 * It will be called by init function of the module.
69 * @param ButtonPixmap image shown on the toolbar item.
70 * @param tooltip tooltip of the toolbar item.
71 * @param view_constructor constructor of the viewer.
74 void toolbar_item_reg(char ** pixmap
, char *tooltip
, lttv_constructor view_constructor
);
78 * Function to unregister the viewer's constructor, release the space
79 * occupied by pixmap, tooltip and constructor of the viewer.
80 * It will be called when a module is unloaded.
81 * @param view_constructor constructor of the viewer which is used as
82 * a reference to find out where the pixmap and tooltip are.
85 void toolbar_item_unreg(lttv_constructor view_constructor
);
89 * Function to register a view constructor so that main window can generate
90 * a menu item for the viewer in order to generate a new instance easily.
91 * It will be called by init function of the module.
92 * @param menu_path path of the menu item.
93 * @param menu_text text of the menu item.
94 * @param view_constructor constructor of the viewer.
97 void menu_item_reg(char *menu_path
, char *menu_text
, lttv_constructor view_constructor
);
101 * Function to unregister the viewer's constructor, release the space
102 * occupied by menu_path, menu_text and constructor of the viewer.
103 * It will be called when a module is unloaded.
104 * @param view_constructor constructor of the viewer which is used as
105 * a reference to find out where the menu_path and menu_text are.
108 void menu_item_unreg(lttv_constructor view_constructor
);
112 * Update the status bar whenever something changed in the viewer.
113 * @param main_win the main window the viewer belongs to.
114 * @param info the message which will be shown in the status bar.
117 void update_status(MainWindow
*main_win
, char *info
);
121 * Function to get the current time window of the current tab.
122 * It will be called by a viewer's hook function to update the
123 * time window of the viewer and also be called by the constructor
125 * @param main_win the main window the viewer belongs to.
126 * @param time_interval a pointer where time interval will be stored.
129 void get_time_window(MainWindow
*main_win
, TimeWindow
*time_window
);
133 * Function to set the time interval of the current tab.
134 * It will be called by a viewer's signal handle associated with
135 * the move_slider signal
136 * @param main_win the main window the viewer belongs to.
137 * @param time_interval a pointer where time interval is stored.
140 void set_time_window(MainWindow
*main_win
, TimeWindow
*time_window
);
143 * Function to get the current time/event of the current tab.
144 * It will be called by a viewer's hook function to update the
145 * current time/event of the viewer.
146 * @param main_win the main window the viewer belongs to.
147 * @param time a pointer where time will be stored.
150 void get_current_time(MainWindow
*main_win
, LttTime
*time
);
154 * Function to set the current time/event of the current tab.
155 * It will be called by a viewer's signal handle associated with
156 * the button-release-event signal
157 * @param main_win the main window the viewer belongs to.
158 * @param time a pointer where time is stored.
161 void set_current_time(MainWindow
*main_win
, LttTime
*time
);
165 * Function to get the traceset from the current tab.
166 * It will be called by the constructor of the viewer and also be
167 * called by a hook funtion of the viewer to update its traceset.
168 * @param main_win the main window the viewer belongs to.
169 * @param traceset a pointer to a traceset.
172 //void get_traceset(MainWindow *main_win, Traceset *traceset);
176 * Function to get the filter of the current tab.
177 * It will be called by the constructor of the viewer and also be
178 * called by a hook funtion of the viewer to update its filter.
179 * @param main_win, the main window the viewer belongs to.
180 * @param filter, a pointer to a filter.
183 //void get_filter(MainWindow *main_win, Filter *filter);
187 * Function to register a hook function for a viewer to set/update its
189 * It will be called by the constructor of the viewer.
190 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
191 * @param hook_data hook data associated with the hook function.
192 * @param main_win the main window the viewer belongs to.
195 void reg_update_time_window(LttvHook hook
, gpointer hook_data
,
196 MainWindow
* main_win
);
200 * Function to unregister a viewer's hook function which is used to
201 * set/update the time interval of the viewer.
202 * It will be called by the destructor of the viewer.
203 * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
204 * @param hook_data hook data associated with the hook function.
205 * @param main_win the main window the viewer belongs to.
208 void unreg_update_time_window(LttvHook hook
, gpointer hook_data
,
209 MainWindow
* main_win
);
213 * Function to register a hook function for a viewer to set/update its
215 * It will be called by the constructor of the viewer.
216 * @param hook hook function of the viewer.
217 * @param hook_data hook data associated with the hook function.
218 * @param main_win the main window the viewer belongs to.
221 void reg_update_traceset(LttvHook hook
, gpointer hook_data
,
222 MainWindow
* main_win
);
226 * Function to unregister a viewer's hook function which is used to
227 * set/update the traceset of the viewer.
228 * It will be called by the destructor of the viewer.
229 * @param hook hook function of the viewer.
230 * @param hook_data hook data associated with the hook function.
231 * @param main_win the main window the viewer belongs to.
234 void unreg_update_traceset(LttvHook hook
, gpointer hook_data
,
235 MainWindow
* main_win
);
239 * Function to redraw each viewer belonging to the current tab
240 * @param main_win the main window the viewer belongs to.
243 void update_traceset(MainWindow
* main_win
);
247 * Function to register a hook function for a viewer to set/update its
249 * It will be called by the constructor of the viewer.
250 * @param hook hook function of the viewer.
251 * @param hook_data hook data associated with the hook function.
252 * @param main_win the main window the viewer belongs to.
255 void reg_update_filter(LttvHook hook
, gpointer hook_data
,
256 MainWindow
*main_win
);
260 * Function to unregister a viewer's hook function which is used to
261 * set/update the filter of the viewer.
262 * It will be called by the destructor of the viewer.
263 * @param hook hook function of the viewer.
264 * @param hook_data hook data associated with the hook function.
265 * @param main_win the main window the viewer belongs to.
268 void unreg_update_filter(LttvHook hook
, gpointer hook_data
,
269 MainWindow
* main_win
);
273 * Function to register a hook function for a viewer to set/update its
275 * It will be called by the constructor of the viewer.
276 * @param hook hook function of the viewer.
277 * @param hook_data hook data associated with the hook function.
278 * @param main_win the main window the viewer belongs to.
281 void reg_update_current_time(LttvHook hook
, gpointer hook_data
,
282 MainWindow
*main_win
);
286 * Function to unregister a viewer's hook function which is used to
287 * set/update the current time of the viewer.
288 * It will be called by the destructor 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 unreg_update_current_time(LttvHook hook
, gpointer hook_data
,
295 MainWindow
* main_win
);
299 * Function to register a hook function for a viewer to show
300 *the content of the viewer.
301 * It will be called by the constructor 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 reg_show_viewer(LttvHook hook
, gpointer hook_data
,
308 MainWindow
*main_win
);
312 * Function to unregister a viewer's hook function which is used to
313 * show the content of the viewer..
314 * It will be called by the destructor of the viewer.
315 * @param hook hook function of the viewer.
316 * @param hook_data hook data associated with the hook function.
317 * @param main_win the main window the viewer belongs to.
320 void unreg_show_viewer(LttvHook hook
, gpointer hook_data
,
321 MainWindow
* main_win
);
325 * Function to show each viewer in the current tab.
326 * It will be called by main window after it called process_traceset
327 * @param main_win the main window the viewer belongs to.
330 void show_viewer(MainWindow
*main_win
);
334 * Function to set the focused pane (viewer).
335 * It will be called by a viewer's signal handle associated with
336 * the grab_focus signal
337 * @param main_win the main window the viewer belongs to.
338 * @param paned a pointer to a pane where the viewer is contained.
341 void set_focused_pane(MainWindow
*main_win
, gpointer paned
);
345 * Function to register a hook function for a viewer to set/update the
346 * dividor of the hpane.
347 * It will be called by the constructor of the viewer.
348 * @param hook hook function of the viewer.
349 * @param hook_data hook data associated with the hook function.
350 * @param main_win the main window the viewer belongs to.
353 void reg_update_dividor(LttvHook hook
, gpointer hook_data
,
354 MainWindow
*main_win
);
358 * Function to unregister a viewer's hook function which is used to
359 * set/update hpane's dividor of the viewer.
360 * It will be called by the destructor of the viewer.
361 * @param hook hook function of the viewer.
362 * @param hook_data hook data associated with the hook function.
363 * @param main_win the main window the viewer belongs to.
366 void unreg_update_dividor(LttvHook hook
, gpointer hook_data
,
367 MainWindow
*main_win
);
371 * Function to set the position of the hpane's dividor (viewer).
372 * It will be called by a viewer's signal handle associated with
373 * the motion_notify_event event/signal
374 * @param main_win the main window the viewer belongs to.
375 * @param position position of the hpane's dividor.
378 void set_hpane_dividor(MainWindow
*main_win
, gint position
);
382 CHECK These functions really should not appear here. Directr calls would
383 be OK unless there is a linker problem.
386 * Function to process traceset. It will call lttv_process_trace,
387 * each view will call this api to get events.
388 * @param main_win the main window the viewer belongs to.
389 * @param start the start time of the first event to be processed.
390 * @param end the end time of the last event to be processed.
393 void process_traceset_api(MainWindow
*main_win
, LttTime start
,
394 LttTime end
, unsigned maxNumEvents
);
398 * Function to add hooks into the context of a traceset,
399 * before reading events from traceset, viewer will call this api to
401 * @param main_win the main window the viewer belongs to.
402 * @param LttvHooks hooks to be registered.
405 void context_add_hooks_api(MainWindow
*main_win
,
406 LttvHooks
*before_traceset
,
407 LttvHooks
*after_traceset
,
408 LttvHooks
*check_trace
,
409 LttvHooks
*before_trace
,
410 LttvHooks
*after_trace
,
411 LttvHooks
*check_tracefile
,
412 LttvHooks
*before_tracefile
,
413 LttvHooks
*after_tracefile
,
414 LttvHooks
*check_event
,
415 LttvHooks
*before_event
,
416 LttvHooks
*after_event
);
420 * Function to remove hooks from the context of a traceset,
421 * before reading events from traceset, viewer will call this api to
423 * @param main_win the main window the viewer belongs to.
424 * @param LttvHooks hooks to be registered.
427 void context_remove_hooks_api(MainWindow
*main_win
,
428 LttvHooks
*before_traceset
,
429 LttvHooks
*after_traceset
,
430 LttvHooks
*check_trace
,
431 LttvHooks
*before_trace
,
432 LttvHooks
*after_trace
,
433 LttvHooks
*check_tracefile
,
434 LttvHooks
*before_tracefile
,
435 LttvHooks
*after_tracefile
,
436 LttvHooks
*check_event
,
437 LttvHooks
*before_event
,
438 LttvHooks
*after_event
);
442 * Function to get the life span of the traceset
443 * @param main_win the main window the viewer belongs to.
444 * @param start start time of the traceset.
445 * @param end end time of the traceset.
448 void get_traceset_time_span(MainWindow
*main_win
, TimeInterval
*time_span
);
452 * Function to add/remove event hooks for state
453 * @param main_win the main window the viewer belongs to.
456 void state_add_event_hooks_api(MainWindow
*main_win
);
457 void state_remove_event_hooks_api(MainWindow
*main_win
);
461 * Function to add/remove event hooks for stats
462 * @param main_win the main window the viewer belongs to.
465 void stats_add_event_hooks_api(MainWindow
*main_win
);
466 void stats_remove_event_hooks_api(MainWindow
*main_win
);
470 * Function to get the stats of the traceset
471 * @param main_win the main window the viewer belongs to.
474 LttvTracesetStats
* get_traceset_stats_api(MainWindow
*main_win
);
476 LttvTracesetContext
* get_traceset_context(MainWindow
*main_win
);