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,
19 /*! \file gtktraceset.h
20 * \brief API used by the graphical viewers to interact with their top window.
22 * Main window (gui module) is the place to contain and display viewers.
23 * Viewers (lttv plugins) interacte with main window through this API and
25 * This header file should be included in each graphic module.
26 * This library is used by graphical modules to interact with the
33 #include <lttv/hook.h>
34 #include <lttv/common.h>
35 #include <lttv/stats.h>
38 * Function to register a view constructor so that main window can generate
39 * a toolbar item for the viewer in order to generate a new instance easily.
40 * It will be called by init function of the module.
41 * @param ButtonPixmap image shown on the toolbar item.
42 * @param tooltip tooltip of the toolbar item.
43 * @param view_constructor constructor of the viewer.
46 void toolbar_item_reg(char ** pixmap
, char *tooltip
, lttv_constructor view_constructor
);
50 * Function to unregister the viewer's constructor, release the space
51 * occupied by pixmap, tooltip and constructor of the viewer.
52 * It will be called when a module is unloaded.
53 * @param view_constructor constructor of the viewer which is used as
54 * a reference to find out where the pixmap and tooltip are.
57 void toolbar_item_unreg(lttv_constructor view_constructor
);
61 * Function to register a view constructor so that main window can generate
62 * a menu item for the viewer in order to generate a new instance easily.
63 * It will be called by init function of the module.
64 * @param menu_path path of the menu item.
65 * @param menu_text text of the menu item.
66 * @param view_constructor constructor of the viewer.
69 void menu_item_reg(char *menu_path
, char *menu_text
, lttv_constructor view_constructor
);
73 * Function to unregister the viewer's constructor, release the space
74 * occupied by menu_path, menu_text and constructor of the viewer.
75 * It will be called when a module is unloaded.
76 * @param view_constructor constructor of the viewer which is used as
77 * a reference to find out where the menu_path and menu_text are.
80 void menu_item_unreg(lttv_constructor view_constructor
);
84 * Update the status bar whenever something changed in the viewer.
85 * @param main_win the main window the viewer belongs to.
86 * @param info the message which will be shown in the status bar.
89 void update_status(MainWindow
*main_win
, char *info
);
93 * Function to get the current time window of the current tab.
94 * It will be called by a viewer's hook function to update the
95 * time window of the viewer and also be called by the constructor
97 * @param main_win the main window the viewer belongs to.
98 * @param time_interval a pointer where time interval will be stored.
101 void get_time_window(MainWindow
*main_win
, TimeWindow
*time_window
);
105 * Function to set the time interval of the current tab.
106 * It will be called by a viewer's signal handle associated with
107 * the move_slider signal
108 * @param main_win the main window the viewer belongs to.
109 * @param time_interval a pointer where time interval is stored.
112 void set_time_window(MainWindow
*main_win
, TimeWindow
*time_window
);
115 * Function to get the current time/event of the current tab.
116 * It will be called by a viewer's hook function to update the
117 * current time/event of the viewer.
118 * @param main_win the main window the viewer belongs to.
119 * @param time a pointer where time will be stored.
122 void get_current_time(MainWindow
*main_win
, LttTime
*time
);
126 * Function to set the current time/event of the current tab.
127 * It will be called by a viewer's signal handle associated with
128 * the button-release-event signal
129 * @param main_win the main window the viewer belongs to.
130 * @param time a pointer where time is stored.
133 void set_current_time(MainWindow
*main_win
, LttTime
*time
);
137 * Function to get the traceset from the current tab.
138 * It will be called by the constructor of the viewer and also be
139 * called by a hook funtion of the viewer to update its traceset.
140 * @param main_win the main window the viewer belongs to.
141 * @param traceset a pointer to a traceset.
144 //void get_traceset(MainWindow *main_win, Traceset *traceset);
148 * Function to get the filter of the current tab.
149 * It will be called by the constructor of the viewer and also be
150 * called by a hook funtion of the viewer to update its filter.
151 * @param main_win, the main window the viewer belongs to.
152 * @param filter, a pointer to a filter.
155 //void get_filter(MainWindow *main_win, Filter *filter);
159 * Function to register a hook function for a viewer to set/update its
161 * It will be called by the constructor of the viewer.
162 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
163 * @param hook_data hook data associated with the hook function.
164 * @param main_win the main window the viewer belongs to.
167 void reg_update_time_window(LttvHook hook
, gpointer hook_data
,
168 MainWindow
* main_win
);
172 * Function to unregister a viewer's hook function which is used to
173 * set/update the time interval of the viewer.
174 * It will be called by the destructor 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 unreg_update_time_window(LttvHook hook
, gpointer hook_data
,
181 MainWindow
* main_win
);
185 * Function to register a hook function for a viewer to set/update its
187 * It will be called by the constructor of the viewer.
188 * @param hook hook function of the viewer.
189 * @param hook_data hook data associated with the hook function.
190 * @param main_win the main window the viewer belongs to.
193 void reg_update_traceset(LttvHook hook
, gpointer hook_data
,
194 MainWindow
* main_win
);
198 * Function to unregister a viewer's hook function which is used to
199 * set/update the traceset of the viewer.
200 * It will be called by the destructor 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 unreg_update_traceset(LttvHook hook
, gpointer hook_data
,
207 MainWindow
* main_win
);
211 * Function to redraw each viewer belonging to the current tab
212 * @param main_win the main window the viewer belongs to.
215 void update_traceset(MainWindow
* main_win
);
219 * Function to register a hook function for a viewer to set/update its
221 * It will be called by the constructor of the viewer.
222 * @param hook hook function of the viewer.
223 * @param hook_data hook data associated with the hook function.
224 * @param main_win the main window the viewer belongs to.
227 void reg_update_filter(LttvHook hook
, gpointer hook_data
,
228 MainWindow
*main_win
);
232 * Function to unregister a viewer's hook function which is used to
233 * set/update the filter of the viewer.
234 * It will be called by the destructor of the viewer.
235 * @param hook hook function of the viewer.
236 * @param hook_data hook data associated with the hook function.
237 * @param main_win the main window the viewer belongs to.
240 void unreg_update_filter(LttvHook hook
, gpointer hook_data
,
241 MainWindow
* main_win
);
245 * Function to register a hook function for a viewer to set/update its
247 * It will be called by the constructor of the viewer.
248 * @param hook hook function of the viewer.
249 * @param hook_data hook data associated with the hook function.
250 * @param main_win the main window the viewer belongs to.
253 void reg_update_current_time(LttvHook hook
, gpointer hook_data
,
254 MainWindow
*main_win
);
258 * Function to unregister a viewer's hook function which is used to
259 * set/update the current time of the viewer.
260 * It will be called by the destructor of the viewer.
261 * @param hook hook function of the viewer.
262 * @param hook_data hook data associated with the hook function.
263 * @param main_win the main window the viewer belongs to.
266 void unreg_update_current_time(LttvHook hook
, gpointer hook_data
,
267 MainWindow
* main_win
);
271 * Function to register a hook function for a viewer to show
272 *the content of the viewer.
273 * It will be called by the constructor of the viewer.
274 * @param hook hook function of the viewer.
275 * @param hook_data hook data associated with the hook function.
276 * @param main_win the main window the viewer belongs to.
279 void reg_show_viewer(LttvHook hook
, gpointer hook_data
,
280 MainWindow
*main_win
);
284 * Function to unregister a viewer's hook function which is used to
285 * show the content of the viewer..
286 * It will be called by the destructor of the viewer.
287 * @param hook hook function of the viewer.
288 * @param hook_data hook data associated with the hook function.
289 * @param main_win the main window the viewer belongs to.
292 void unreg_show_viewer(LttvHook hook
, gpointer hook_data
,
293 MainWindow
* main_win
);
297 * Function to show each viewer in the current tab.
298 * It will be called by main window after it called process_traceset
299 * @param main_win the main window the viewer belongs to.
302 void show_viewer(MainWindow
*main_win
);
306 * Function to set the focused pane (viewer).
307 * It will be called by a viewer's signal handle associated with
308 * the grab_focus signal
309 * @param main_win the main window the viewer belongs to.
310 * @param paned a pointer to a pane where the viewer is contained.
313 void set_focused_pane(MainWindow
*main_win
, gpointer paned
);
317 * Function to register a hook function for a viewer to set/update the
318 * dividor of the hpane.
319 * It will be called by the constructor of the viewer.
320 * @param hook hook function of the viewer.
321 * @param hook_data hook data associated with the hook function.
322 * @param main_win the main window the viewer belongs to.
325 void reg_update_dividor(LttvHook hook
, gpointer hook_data
,
326 MainWindow
*main_win
);
330 * Function to unregister a viewer's hook function which is used to
331 * set/update hpane's dividor of the viewer.
332 * It will be called by the destructor of the viewer.
333 * @param hook hook function of the viewer.
334 * @param hook_data hook data associated with the hook function.
335 * @param main_win the main window the viewer belongs to.
338 void unreg_update_dividor(LttvHook hook
, gpointer hook_data
,
339 MainWindow
*main_win
);
343 * Function to set the position of the hpane's dividor (viewer).
344 * It will be called by a viewer's signal handle associated with
345 * the motion_notify_event event/signal
346 * @param main_win the main window the viewer belongs to.
347 * @param position position of the hpane's dividor.
350 void set_hpane_dividor(MainWindow
*main_win
, gint position
);
354 * Function to process traceset. It will call lttv_process_trace,
355 * each view will call this api to get events.
356 * @param main_win the main window the viewer belongs to.
357 * @param start the start time of the first event to be processed.
358 * @param end the end time of the last event to be processed.
361 void process_traceset_api(MainWindow
*main_win
, LttTime start
,
362 LttTime end
, unsigned maxNumEvents
);
366 * Function to add hooks into the context of a traceset,
367 * before reading events from traceset, viewer will call this api to
369 * @param main_win the main window the viewer belongs to.
370 * @param LttvHooks hooks to be registered.
373 void context_add_hooks_api(MainWindow
*main_win
,
374 LttvHooks
*before_traceset
,
375 LttvHooks
*after_traceset
,
376 LttvHooks
*check_trace
,
377 LttvHooks
*before_trace
,
378 LttvHooks
*after_trace
,
379 LttvHooks
*check_tracefile
,
380 LttvHooks
*before_tracefile
,
381 LttvHooks
*after_tracefile
,
382 LttvHooks
*check_event
,
383 LttvHooks
*before_event
,
384 LttvHooks
*after_event
);
388 * Function to remove hooks from the context of a traceset,
389 * before reading events from traceset, viewer will call this api to
391 * @param main_win the main window the viewer belongs to.
392 * @param LttvHooks hooks to be registered.
395 void context_remove_hooks_api(MainWindow
*main_win
,
396 LttvHooks
*before_traceset
,
397 LttvHooks
*after_traceset
,
398 LttvHooks
*check_trace
,
399 LttvHooks
*before_trace
,
400 LttvHooks
*after_trace
,
401 LttvHooks
*check_tracefile
,
402 LttvHooks
*before_tracefile
,
403 LttvHooks
*after_tracefile
,
404 LttvHooks
*check_event
,
405 LttvHooks
*before_event
,
406 LttvHooks
*after_event
);
410 * Function to get the life span of the traceset
411 * @param main_win the main window the viewer belongs to.
412 * @param start start time of the traceset.
413 * @param end end time of the traceset.
416 void get_traceset_time_span(MainWindow
*main_win
, TimeInterval
*time_span
);
420 * Function to add/remove event hooks for state
421 * @param main_win the main window the viewer belongs to.
424 void state_add_event_hooks_api(MainWindow
*main_win
);
425 void state_remove_event_hooks_api(MainWindow
*main_win
);
429 * Function to add/remove event hooks for stats
430 * @param main_win the main window the viewer belongs to.
433 void stats_add_event_hooks_api(MainWindow
*main_win
);
434 void stats_remove_event_hooks_api(MainWindow
*main_win
);
438 * Function to get the stats of the traceset
439 * @param main_win the main window the viewer belongs to.
442 LttvTracesetStats
* get_traceset_stats_api(MainWindow
*main_win
);
444 LttvTracesetContext
* get_traceset_context(MainWindow
*main_win
);