97e879d2 |
1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2003-2004 Xiangxiu Yang |
3 | * |
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; |
7 | * |
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. |
12 | * |
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, |
16 | * MA 02111-1307, USA. |
17 | */ |
18 | |
fcdf0ec2 |
19 | /*! \file gtkTraceSet.h |
20 | * \brief API used by the graphical viewers to interact with their top window. |
21 | * |
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 |
24 | * events sent by gtk. |
c5d77517 |
25 | * This header file should be included in each graphic module. |
fcdf0ec2 |
26 | * This library is used by graphical modules to interact with the |
27 | * tracesetWindow. |
28 | * |
c5d77517 |
29 | */ |
30 | |
31 | #include <gtk/gtk.h> |
32 | #include <ltt/ltt.h> |
33 | #include <lttv/hook.h> |
9af25d1f |
34 | #include <lttv/common.h> |
6b1d3120 |
35 | #include <lttv/stats.h> |
c5d77517 |
36 | |
37 | /** |
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. |
fcdf0ec2 |
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. |
c5d77517 |
44 | */ |
45 | |
41a76985 |
46 | void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor); |
c5d77517 |
47 | |
48 | |
49 | /** |
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. |
fcdf0ec2 |
53 | * @param view_constructor constructor of the viewer which is used as |
c5d77517 |
54 | * a reference to find out where the pixmap and tooltip are. |
55 | */ |
56 | |
41a76985 |
57 | void toolbar_item_unreg(lttv_constructor view_constructor); |
c5d77517 |
58 | |
59 | |
60 | /** |
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. |
fcdf0ec2 |
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. |
c5d77517 |
67 | */ |
68 | |
41a76985 |
69 | void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor); |
c5d77517 |
70 | |
71 | |
72 | /** |
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. |
fcdf0ec2 |
76 | * @param view_constructor constructor of the viewer which is used as |
c5d77517 |
77 | * a reference to find out where the menu_path and menu_text are. |
78 | */ |
79 | |
41a76985 |
80 | void menu_item_unreg(lttv_constructor view_constructor); |
c5d77517 |
81 | |
82 | |
83 | /** |
84 | * Update the status bar whenever something changed in the viewer. |
fcdf0ec2 |
85 | * @param main_win the main window the viewer belongs to. |
86 | * @param info the message which will be shown in the status bar. |
c5d77517 |
87 | */ |
88 | |
41a76985 |
89 | void update_status(MainWindow *main_win, char *info); |
c5d77517 |
90 | |
91 | |
92 | /** |
f7afe191 |
93 | * Function to get the current time window of the current tab. |
c5d77517 |
94 | * It will be called by a viewer's hook function to update the |
f7afe191 |
95 | * time window of the viewer and also be called by the constructor |
c5d77517 |
96 | * of the viewer. |
fcdf0ec2 |
97 | * @param main_win the main window the viewer belongs to. |
98 | * @param time_interval a pointer where time interval will be stored. |
c5d77517 |
99 | */ |
100 | |
41a76985 |
101 | void get_time_window(MainWindow *main_win, TimeWindow *time_window); |
c5d77517 |
102 | |
103 | |
104 | /** |
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 |
fcdf0ec2 |
108 | * @param main_win the main window the viewer belongs to. |
109 | * @param time_interval a pointer where time interval is stored. |
c5d77517 |
110 | */ |
111 | |
41a76985 |
112 | void set_time_window(MainWindow *main_win, TimeWindow *time_window); |
c5d77517 |
113 | |
114 | /** |
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. |
fcdf0ec2 |
118 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
119 | * @param time a pointer where time will be stored. |
c5d77517 |
120 | */ |
121 | |
41a76985 |
122 | void get_current_time(MainWindow *main_win, LttTime *time); |
c5d77517 |
123 | |
124 | |
125 | /** |
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 |
fcdf0ec2 |
129 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
130 | * @param time a pointer where time is stored. |
c5d77517 |
131 | */ |
132 | |
41a76985 |
133 | void set_current_time(MainWindow *main_win, LttTime *time); |
c5d77517 |
134 | |
135 | |
136 | /** |
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. |
fcdf0ec2 |
140 | * @param main_win the main window the viewer belongs to. |
141 | * @param traceset a pointer to a traceset. |
c5d77517 |
142 | */ |
143 | |
41a76985 |
144 | //void get_traceset(MainWindow *main_win, Traceset *traceset); |
c5d77517 |
145 | |
146 | |
147 | /** |
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. |
153 | */ |
154 | |
41a76985 |
155 | //void get_filter(MainWindow *main_win, Filter *filter); |
c5d77517 |
156 | |
157 | |
158 | /** |
159 | * Function to register a hook function for a viewer to set/update its |
160 | * time interval. |
161 | * It will be called by the constructor of the viewer. |
f7afe191 |
162 | * @param hook hook function of the viewer. Takes a TimeInterval* as call_data. |
fcdf0ec2 |
163 | * @param hook_data hook data associated with the hook function. |
164 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
165 | */ |
166 | |
41a76985 |
167 | void reg_update_time_window(LttvHook hook, gpointer hook_data, |
168 | MainWindow * main_win); |
c5d77517 |
169 | |
170 | |
171 | /** |
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. |
f7afe191 |
175 | * @param hook hook function of the viewer. Takes a TimeInterval as call_data. |
fcdf0ec2 |
176 | * @param hook_data hook data associated with the hook function. |
177 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
178 | */ |
179 | |
41a76985 |
180 | void unreg_update_time_window(LttvHook hook, gpointer hook_data, |
181 | MainWindow * main_win); |
c5d77517 |
182 | |
183 | |
184 | /** |
185 | * Function to register a hook function for a viewer to set/update its |
186 | * traceset. |
187 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
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. |
c5d77517 |
191 | */ |
192 | |
41a76985 |
193 | void reg_update_traceset(LttvHook hook, gpointer hook_data, |
bca3b81f |
194 | MainWindow * main_win); |
c5d77517 |
195 | |
196 | |
197 | /** |
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. |
fcdf0ec2 |
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. |
c5d77517 |
204 | */ |
205 | |
41a76985 |
206 | void unreg_update_traceset(LttvHook hook, gpointer hook_data, |
bca3b81f |
207 | MainWindow * main_win); |
c5d77517 |
208 | |
209 | |
a8c0f09d |
210 | /** |
211 | * Function to redraw each viewer belonging to the current tab |
212 | * @param main_win the main window the viewer belongs to. |
213 | */ |
214 | |
215 | void update_traceset(MainWindow * main_win); |
216 | |
217 | |
c5d77517 |
218 | /** |
219 | * Function to register a hook function for a viewer to set/update its |
220 | * filter. |
221 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
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. |
c5d77517 |
225 | */ |
226 | |
41a76985 |
227 | void reg_update_filter(LttvHook hook, gpointer hook_data, |
bca3b81f |
228 | MainWindow *main_win); |
c5d77517 |
229 | |
230 | |
231 | /** |
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. |
fcdf0ec2 |
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. |
c5d77517 |
238 | */ |
239 | |
41a76985 |
240 | void unreg_update_filter(LttvHook hook, gpointer hook_data, |
bca3b81f |
241 | MainWindow * main_win); |
c5d77517 |
242 | |
243 | |
244 | /** |
245 | * Function to register a hook function for a viewer to set/update its |
246 | * current time. |
247 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
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. |
c5d77517 |
251 | */ |
252 | |
41a76985 |
253 | void reg_update_current_time(LttvHook hook, gpointer hook_data, |
bca3b81f |
254 | MainWindow *main_win); |
c5d77517 |
255 | |
256 | |
257 | /** |
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. |
fcdf0ec2 |
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. |
c5d77517 |
264 | */ |
265 | |
41a76985 |
266 | void unreg_update_current_time(LttvHook hook, gpointer hook_data, |
bca3b81f |
267 | MainWindow * main_win); |
10bc4f50 |
268 | |
269 | |
202f6c8f |
270 | /** |
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. |
277 | */ |
278 | |
279 | void reg_show_viewer(LttvHook hook, gpointer hook_data, |
280 | MainWindow *main_win); |
281 | |
282 | |
283 | /** |
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. |
290 | */ |
291 | |
292 | void unreg_show_viewer(LttvHook hook, gpointer hook_data, |
293 | MainWindow * main_win); |
294 | |
295 | |
296 | /** |
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. |
300 | */ |
301 | |
302 | void show_viewer(MainWindow *main_win); |
303 | |
304 | |
10bc4f50 |
305 | /** |
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. |
311 | */ |
312 | |
41a76985 |
313 | void set_focused_pane(MainWindow *main_win, gpointer paned); |
10bc4f50 |
314 | |
315 | |
316 | /** |
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. |
323 | */ |
324 | |
41a76985 |
325 | void reg_update_dividor(LttvHook hook, gpointer hook_data, |
bca3b81f |
326 | MainWindow *main_win); |
10bc4f50 |
327 | |
328 | |
329 | /** |
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. |
336 | */ |
337 | |
41a76985 |
338 | void unreg_update_dividor(LttvHook hook, gpointer hook_data, |
bca3b81f |
339 | MainWindow *main_win); |
10bc4f50 |
340 | |
341 | |
342 | /** |
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. |
348 | */ |
349 | |
41a76985 |
350 | void set_hpane_dividor(MainWindow *main_win, gint position); |
10bc4f50 |
351 | |
352 | |
353 | /** |
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. |
359 | */ |
360 | |
41a76985 |
361 | void process_traceset_api(MainWindow *main_win, LttTime start, |
362 | LttTime end, unsigned maxNumEvents); |
10bc4f50 |
363 | |
364 | |
365 | /** |
366 | * Function to add hooks into the context of a traceset, |
367 | * before reading events from traceset, viewer will call this api to |
368 | * register hooks |
369 | * @param main_win the main window the viewer belongs to. |
370 | * @param LttvHooks hooks to be registered. |
371 | */ |
372 | |
41a76985 |
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); |
10bc4f50 |
385 | |
386 | |
387 | /** |
388 | * Function to remove hooks from the context of a traceset, |
389 | * before reading events from traceset, viewer will call this api to |
390 | * unregister hooks |
391 | * @param main_win the main window the viewer belongs to. |
392 | * @param LttvHooks hooks to be registered. |
393 | */ |
394 | |
41a76985 |
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); |
c5d77517 |
407 | |
408 | |
fb1a869e |
409 | /** |
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. |
414 | */ |
415 | |
41a76985 |
416 | void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_span); |
6b1d3120 |
417 | |
418 | |
419 | /** |
420 | * Function to add/remove event hooks for state |
421 | * @param main_win the main window the viewer belongs to. |
422 | */ |
423 | |
41a76985 |
424 | void state_add_event_hooks_api(MainWindow *main_win ); |
425 | void state_remove_event_hooks_api(MainWindow *main_win ); |
6b1d3120 |
426 | |
427 | |
428 | /** |
429 | * Function to add/remove event hooks for stats |
430 | * @param main_win the main window the viewer belongs to. |
431 | */ |
432 | |
41a76985 |
433 | void stats_add_event_hooks_api(MainWindow *main_win ); |
434 | void stats_remove_event_hooks_api(MainWindow *main_win ); |
6b1d3120 |
435 | |
436 | |
437 | /** |
438 | * Function to get the stats of the traceset |
439 | * @param main_win the main window the viewer belongs to. |
440 | */ |
441 | |
41a76985 |
442 | LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win); |
a8c0f09d |
443 | |
444 | LttvTracesetContext* get_traceset_context(MainWindow *main_win); |