561f5852 |
1 | /*! \file gtkTraceSet.h |
2 | * \brief API used by the graphical viewers to interact with their top window. |
3 | * |
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 |
6 | * events sent by gtk. |
7 | * This header file should be included in each graphic module. |
8 | * This library is used by graphical modules to interact with the |
9 | * tracesetWindow. |
10 | * |
11 | */ |
12 | |
d0cf1bcd |
13 | #include <lttv/common.h> |
561f5852 |
14 | #include <ltt/ltt.h> |
15 | #include <lttv/lttv.h> |
16 | #include <lttv/mainWindow.h> |
17 | #include <lttv/gtkTraceSet.h> |
18 | #include <lttv/processTrace.h> |
c4c15b5e |
19 | #include <lttv/toolbar.h> |
20 | #include <lttv/menu.h> |
6b1d3120 |
21 | #include <lttv/state.h> |
22 | #include <lttv/stats.h> |
23 | |
561f5852 |
24 | |
25 | /** |
26 | * Internal function parts |
27 | */ |
28 | |
29 | /** |
30 | * Function to remove toolbar from the GUI |
31 | * @param view_constructor constructor of the viewer. |
32 | */ |
33 | |
c4c15b5e |
34 | void RemoveToolbar(lttv_constructor view_constructor) |
561f5852 |
35 | { |
36 | g_printf("Toolbar for the viewer will be removed\n"); |
37 | } |
38 | |
39 | /** |
40 | * Function to remove menu entry from the GUI |
41 | * @param view_constructor constructor of the viewer. |
42 | */ |
43 | |
c4c15b5e |
44 | void RemoveMenu(lttv_constructor view_constructor) |
561f5852 |
45 | { |
46 | g_printf("Menu entry for the viewer will be removed\n"); |
47 | } |
48 | |
49 | |
50 | /** |
51 | * Function to set/update traceset for the viewers |
52 | * @param main_win main window |
53 | * @param traceset traceset of the main window. |
54 | */ |
55 | |
56 | void SetTraceset(mainWindow * main_win, gpointer traceset) |
57 | { |
58 | LttvHooks * tmp; |
59 | LttvAttributeValue value; |
60 | |
61 | g_assert(lttv_iattribute_find_by_path(main_win->Attributes, |
62 | "hooks/updatetraceset", LTTV_POINTER, &value)); |
63 | tmp = (LttvHooks*)*(value.v_pointer); |
64 | if(tmp == NULL)return; |
65 | lttv_hooks_call(tmp,traceset); |
66 | } |
67 | |
68 | |
69 | /** |
70 | * Function to set/update filter for the viewers |
71 | * @param main_win main window |
72 | * @param filter filter of the main window. |
73 | */ |
74 | |
75 | void SetFilter(mainWindow * main_win, gpointer filter) |
76 | { |
77 | LttvHooks * tmp; |
78 | LttvAttributeValue value; |
79 | |
80 | g_assert(lttv_iattribute_find_by_path(main_win->Attributes, |
81 | "hooks/updatefilter", LTTV_POINTER, &value)); |
82 | tmp = (LttvHooks*)*(value.v_pointer); |
83 | |
84 | if(tmp == NULL)return; |
85 | lttv_hooks_call(tmp,filter); |
86 | } |
87 | |
88 | |
89 | |
90 | /** |
91 | * API parts |
92 | */ |
93 | |
94 | /** |
95 | * Function to register a view constructor so that main window can generate |
96 | * a toolbar item for the viewer in order to generate a new instance easily. |
97 | * It will be called by init function of the module. |
98 | * @param ButtonPixmap image shown on the toolbar item. |
99 | * @param tooltip tooltip of the toolbar item. |
100 | * @param view_constructor constructor of the viewer. |
101 | */ |
102 | |
c4c15b5e |
103 | void ToolbarItemReg(char ** pixmap, char *tooltip, lttv_constructor view_constructor) |
561f5852 |
104 | { |
105 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
106 | LttvToolbars * toolbar; |
107 | LttvAttributeValue value; |
108 | |
109 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
110 | "viewers/toolbar", LTTV_POINTER, &value)); |
111 | toolbar = (LttvToolbars*)*(value.v_pointer); |
112 | |
113 | if(toolbar == NULL){ |
114 | toolbar = lttv_toolbars_new(); |
115 | *(value.v_pointer) = toolbar; |
116 | } |
117 | lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap); |
118 | } |
119 | |
120 | |
121 | /** |
122 | * Function to unregister the viewer's constructor, release the space |
123 | * occupied by pixmap, tooltip and constructor of the viewer. |
124 | * It will be called when a module is unloaded. |
125 | * @param view_constructor constructor of the viewer which is used as |
126 | * a reference to find out where the pixmap and tooltip are. |
127 | */ |
128 | |
c4c15b5e |
129 | void ToolbarItemUnreg(lttv_constructor view_constructor) |
561f5852 |
130 | { |
131 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
132 | LttvToolbars * toolbar; |
133 | LttvAttributeValue value; |
134 | |
135 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
136 | "viewers/toolbar", LTTV_POINTER, &value)); |
137 | toolbar = (LttvToolbars*)*(value.v_pointer); |
138 | |
139 | if(lttv_toolbars_remove(toolbar, view_constructor)) |
140 | RemoveToolbar(view_constructor); |
141 | } |
142 | |
143 | |
144 | /** |
145 | * Function to register a view constructor so that main window can generate |
146 | * a menu item for the viewer in order to generate a new instance easily. |
147 | * It will be called by init function of the module. |
148 | * @param menu_path path of the menu item. |
149 | * @param menu_text text of the menu item. |
150 | * @param view_constructor constructor of the viewer. |
151 | */ |
152 | |
c4c15b5e |
153 | void MenuItemReg(char *menu_path, char *menu_text, lttv_constructor view_constructor) |
561f5852 |
154 | { |
155 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
156 | LttvMenus * menu; |
157 | LttvAttributeValue value; |
158 | |
159 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
160 | "viewers/menu", LTTV_POINTER, &value)); |
161 | menu = (LttvMenus*)*(value.v_pointer); |
162 | |
163 | if(menu == NULL){ |
164 | menu = lttv_menus_new(); |
165 | *(value.v_pointer) = menu; |
166 | } |
167 | lttv_menus_add(menu, view_constructor, menu_path, menu_text); |
168 | } |
169 | |
170 | /** |
171 | * Function to unregister the viewer's constructor, release the space |
172 | * occupied by menu_path, menu_text and constructor of the viewer. |
173 | * It will be called when a module is unloaded. |
174 | * @param view_constructor constructor of the viewer which is used as |
175 | * a reference to find out where the menu_path and menu_text are. |
176 | */ |
177 | |
c4c15b5e |
178 | void MenuItemUnreg(lttv_constructor view_constructor) |
561f5852 |
179 | { |
180 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
181 | LttvMenus * menu; |
182 | LttvAttributeValue value; |
183 | |
184 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
c4c15b5e |
185 | "viewers/menu", LTTV_POINTER, &value)); |
561f5852 |
186 | menu = (LttvMenus*)*(value.v_pointer); |
187 | |
188 | if(lttv_menus_remove(menu, view_constructor)) |
189 | RemoveMenu(view_constructor); |
190 | } |
191 | |
192 | |
193 | /** |
194 | * Update the status bar whenever something changed in the viewer. |
195 | * @param main_win the main window the viewer belongs to. |
196 | * @param info the message which will be shown in the status bar. |
197 | */ |
198 | |
199 | void UpdateStatus(mainWindow *main_win, char *info) |
200 | { |
201 | } |
202 | |
203 | |
204 | /** |
f7afe191 |
205 | * Function to get the current time interval shown on the current tab. |
206 | * It will be called by a viewer's hook function to update the |
207 | * shown time interval of the viewer and also be called by the constructor |
208 | * of the viewer. |
209 | * @param main_win the main window the viewer belongs to. |
210 | * @param time_interval a pointer where time interval will be stored. |
211 | */ |
212 | |
213 | void GetTimeWindow(mainWindow *main_win, TimeWindow *Time_Window) |
214 | { |
215 | //Time_Window->startTime = main_win->CurrentTab->Time_Window.startTime; |
216 | //Time_Window->Time_Width = main_win->CurrentTab->Time_Window.Time_Width; |
217 | *Time_Window = main_win->CurrentTab->Time_Window; |
218 | } |
219 | |
220 | /** |
221 | * Function to get the current time interval of the current traceset. |
561f5852 |
222 | * It will be called by a viewer's hook function to update the |
223 | * time interval of the viewer and also be called by the constructor |
224 | * of the viewer. |
225 | * @param main_win the main window the viewer belongs to. |
226 | * @param time_interval a pointer where time interval will be stored. |
227 | */ |
228 | |
f7afe191 |
229 | void getTracesetTimeSpan(mainWindow *main_win, TimeInterval *Time_Interval) |
561f5852 |
230 | { |
f7afe191 |
231 | //Time_Window->startTime = main_win->CurrentTab->Time_Window.startTime; |
232 | //Time_Window->Time_Width = main_win->CurrentTab->Time_Window.Time_Width; |
233 | *Time_Interval = *(LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext)->Time_Span); |
561f5852 |
234 | } |
235 | |
236 | |
f7afe191 |
237 | |
561f5852 |
238 | /** |
239 | * Function to set the time interval of the current tab. |
240 | * It will be called by a viewer's signal handle associated with |
241 | * the move_slider signal |
242 | * @param main_win the main window the viewer belongs to. |
243 | * @param time_interval a pointer where time interval is stored. |
244 | */ |
245 | |
f7afe191 |
246 | void SetTimeWindow(mainWindow *main_win, TimeWindow *Time_Window) |
561f5852 |
247 | { |
248 | LttvAttributeValue value; |
249 | LttvHooks * tmp; |
f7afe191 |
250 | main_win->CurrentTab->Time_Window = *Time_Window; |
561f5852 |
251 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
f7afe191 |
252 | "hooks/updatetimewindow", LTTV_POINTER, &value)); |
561f5852 |
253 | tmp = (LttvHooks*)*(value.v_pointer); |
f7afe191 |
254 | if(tmp == NULL) return; |
255 | lttv_hooks_call(tmp, Time_Window); |
561f5852 |
256 | } |
257 | |
258 | |
259 | /** |
260 | * Function to get the current time/event of the current tab. |
261 | * It will be called by a viewer's hook function to update the |
262 | * current time/event of the viewer. |
263 | * @param main_win the main window the viewer belongs to. |
264 | * @param time a pointer where time will be stored. |
265 | */ |
266 | |
267 | void GetCurrentTime(mainWindow *main_win, LttTime *time) |
268 | { |
269 | time = &main_win->CurrentTab->currentTime; |
270 | } |
271 | |
272 | |
273 | /** |
274 | * Function to set the current time/event of the current tab. |
275 | * It will be called by a viewer's signal handle associated with |
276 | * the button-release-event signal |
277 | * @param main_win the main window the viewer belongs to. |
278 | * @param time a pointer where time is stored. |
279 | */ |
280 | |
281 | void SetCurrentTime(mainWindow *main_win, LttTime *time) |
282 | { |
283 | LttvAttributeValue value; |
284 | LttvHooks * tmp; |
285 | main_win->CurrentTab->currentTime = *time; |
286 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
287 | "hooks/updatecurrenttime", LTTV_POINTER, &value)); |
288 | tmp = (LttvHooks*)*(value.v_pointer); |
289 | |
290 | if(tmp == NULL)return; |
291 | lttv_hooks_call(tmp, time); |
292 | } |
293 | |
294 | |
295 | /** |
296 | * Function to get the traceset from the current tab. |
297 | * It will be called by the constructor of the viewer and also be |
298 | * called by a hook funtion of the viewer to update its traceset. |
299 | * @param main_win the main window the viewer belongs to. |
300 | * @param traceset a pointer to a traceset. |
301 | */ |
302 | /* |
303 | void GetTraceset(mainWindow *main_win, Traceset *traceset) |
304 | { |
305 | } |
306 | */ |
307 | |
308 | /** |
309 | * Function to get the filter of the current tab. |
310 | * It will be called by the constructor of the viewer and also be |
311 | * called by a hook funtion of the viewer to update its filter. |
312 | * @param main_win, the main window the viewer belongs to. |
313 | * @param filter, a pointer to a filter. |
314 | */ |
315 | /* |
316 | void GetFilter(mainWindow *main_win, Filter *filter) |
317 | { |
318 | } |
319 | */ |
320 | |
321 | /** |
322 | * Function to register a hook function for a viewer to set/update its |
323 | * time interval. |
324 | * It will be called by the constructor of the viewer. |
325 | * @param hook hook function of the viewer. |
326 | * @param hook_data hook data associated with the hook function. |
327 | * @param main_win the main window the viewer belongs to. |
328 | */ |
329 | |
f7afe191 |
330 | void RegUpdateTimeWindow(LttvHook hook, gpointer hook_data, |
561f5852 |
331 | mainWindow * main_win) |
332 | { |
333 | LttvAttributeValue value; |
334 | LttvHooks * tmp; |
335 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
f7afe191 |
336 | "hooks/updatetimewindow", LTTV_POINTER, &value)); |
561f5852 |
337 | tmp = (LttvHooks*)*(value.v_pointer); |
338 | if(tmp == NULL){ |
339 | tmp = lttv_hooks_new(); |
340 | *(value.v_pointer) = tmp; |
341 | } |
342 | lttv_hooks_add(tmp, hook,hook_data); |
343 | } |
344 | |
345 | |
346 | /** |
347 | * Function to unregister a viewer's hook function which is used to |
348 | * set/update the time interval of the viewer. |
349 | * It will be called by the destructor of the viewer. |
350 | * @param hook hook function of the viewer. |
351 | * @param hook_data hook data associated with the hook function. |
352 | * @param main_win the main window the viewer belongs to. |
353 | */ |
354 | |
f7afe191 |
355 | void UnregUpdateTimeWindow(LttvHook hook, gpointer hook_data, |
561f5852 |
356 | mainWindow * main_win) |
357 | { |
358 | LttvAttributeValue value; |
359 | LttvHooks * tmp; |
360 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
f7afe191 |
361 | "hooks/updatetimewindow", LTTV_POINTER, &value)); |
561f5852 |
362 | tmp = (LttvHooks*)*(value.v_pointer); |
363 | if(tmp == NULL) return; |
364 | lttv_hooks_remove_data(tmp, hook, hook_data); |
365 | } |
366 | |
367 | |
368 | /** |
369 | * Function to register a hook function for a viewer to set/update its |
370 | * traceset. |
371 | * It will be called by the constructor of the viewer. |
372 | * @param hook hook function of the viewer. |
373 | * @param hook_data hook data associated with the hook function. |
374 | * @param main_win the main window the viewer belongs to. |
375 | */ |
376 | |
377 | void RegUpdateTraceset(LttvHook hook, gpointer hook_data, |
378 | mainWindow * main_win) |
379 | { |
380 | LttvAttributeValue value; |
381 | LttvHooks * tmp; |
382 | g_assert(lttv_iattribute_find_by_path(main_win->Attributes, |
383 | "hooks/updatetraceset", LTTV_POINTER, &value)); |
384 | tmp = (LttvHooks*)*(value.v_pointer); |
385 | if(tmp == NULL){ |
386 | tmp = lttv_hooks_new(); |
387 | *(value.v_pointer) = tmp; |
388 | } |
389 | lttv_hooks_add(tmp, hook, hook_data); |
390 | } |
391 | |
392 | |
393 | /** |
394 | * Function to unregister a viewer's hook function which is used to |
395 | * set/update the traceset of the viewer. |
396 | * It will be called by the destructor of the viewer. |
397 | * @param hook hook function of the viewer. |
398 | * @param hook_data hook data associated with the hook function. |
399 | * @param main_win the main window the viewer belongs to. |
400 | */ |
401 | |
402 | void UnregUpdateTraceset(LttvHook hook, gpointer hook_data, |
403 | mainWindow * main_win) |
404 | { |
405 | LttvAttributeValue value; |
406 | LttvHooks * tmp; |
407 | g_assert(lttv_iattribute_find_by_path(main_win->Attributes, |
408 | "hooks/updatetraceset", LTTV_POINTER, &value)); |
409 | tmp = (LttvHooks*)*(value.v_pointer); |
410 | if(tmp == NULL) return; |
411 | lttv_hooks_remove_data(tmp, hook, hook_data); |
412 | } |
413 | |
414 | |
415 | /** |
416 | * Function to register a hook function for a viewer to set/update its |
417 | * filter. |
418 | * It will be called by the constructor of the viewer. |
419 | * @param hook hook function of the viewer. |
420 | * @param hook_data hook data associated with the hook function. |
421 | * @param main_win the main window the viewer belongs to. |
422 | */ |
423 | |
424 | void RegUpdateFilter(LttvHook hook, gpointer hook_data, |
425 | mainWindow *main_win) |
426 | { |
427 | LttvAttributeValue value; |
428 | LttvHooks * tmp; |
429 | g_assert(lttv_iattribute_find_by_path(main_win->Attributes, |
430 | "hooks/updatefilter", LTTV_POINTER, &value)); |
431 | tmp = (LttvHooks*)*(value.v_pointer); |
432 | if(tmp == NULL){ |
433 | tmp = lttv_hooks_new(); |
434 | *(value.v_pointer) = tmp; |
435 | } |
436 | lttv_hooks_add(tmp, hook, hook_data); |
437 | } |
438 | |
439 | |
440 | /** |
441 | * Function to unregister a viewer's hook function which is used to |
442 | * set/update the filter of the viewer. |
443 | * It will be called by the destructor of the viewer. |
444 | * @param hook hook function of the viewer. |
445 | * @param hook_data hook data associated with the hook function. |
446 | * @param main_win the main window the viewer belongs to. |
447 | */ |
448 | |
449 | void UnregUpdateFilter(LttvHook hook, gpointer hook_data, |
450 | mainWindow * main_win) |
451 | { |
452 | LttvAttributeValue value; |
453 | LttvHooks * tmp; |
454 | g_assert(lttv_iattribute_find_by_path(main_win->Attributes, |
455 | "hooks/updatefilter", LTTV_POINTER, &value)); |
456 | tmp = (LttvHooks*)*(value.v_pointer); |
457 | if(tmp == NULL) return; |
458 | lttv_hooks_remove_data(tmp, hook, hook_data); |
459 | } |
460 | |
461 | |
462 | /** |
463 | * Function to register a hook function for a viewer to set/update its |
464 | * current time. |
465 | * It will be called by the constructor of the viewer. |
466 | * @param hook hook function of the viewer. |
467 | * @param hook_data hook data associated with the hook function. |
468 | * @param main_win the main window the viewer belongs to. |
469 | */ |
470 | |
471 | void RegUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
472 | mainWindow *main_win) |
473 | { |
474 | LttvAttributeValue value; |
475 | LttvHooks * tmp; |
476 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
477 | "hooks/updatecurrenttime", LTTV_POINTER, &value)); |
478 | tmp = (LttvHooks*)*(value.v_pointer); |
479 | if(tmp == NULL){ |
480 | tmp = lttv_hooks_new(); |
481 | *(value.v_pointer) = tmp; |
482 | } |
483 | lttv_hooks_add(tmp, hook, hook_data); |
484 | } |
485 | |
486 | |
487 | /** |
488 | * Function to unregister a viewer's hook function which is used to |
489 | * set/update the current time of the viewer. |
490 | * It will be called by the destructor of the viewer. |
491 | * @param hook hook function of the viewer. |
492 | * @param hook_data hook data associated with the hook function. |
493 | * @param main_win the main window the viewer belongs to. |
494 | */ |
495 | |
496 | void UnregUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
497 | mainWindow * main_win) |
498 | { |
499 | LttvAttributeValue value; |
500 | LttvHooks * tmp; |
501 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
502 | "hooks/updatecurrenttime", LTTV_POINTER, &value)); |
503 | tmp = (LttvHooks*)*(value.v_pointer); |
504 | if(tmp == NULL) return; |
505 | lttv_hooks_remove_data(tmp, hook, hook_data); |
506 | } |
507 | |
508 | |
509 | /** |
510 | * Function to set the focused pane (viewer). |
511 | * It will be called by a viewer's signal handle associated with |
512 | * the grab_focus signal |
513 | * @param main_win the main window the viewer belongs to. |
514 | * @param paned a pointer to a pane where the viewer is contained. |
515 | */ |
516 | |
517 | void SetFocusedPane(mainWindow *main_win, gpointer paned) |
518 | { |
519 | gtk_custom_set_focus((GtkWidget*)main_win->CurrentTab->custom,paned); |
520 | } |
521 | |
522 | |
523 | /** |
524 | * Function to register a hook function for a viewer to set/update the |
525 | * dividor of the hpane. |
526 | * It will be called by the constructor of the viewer. |
527 | * @param hook hook function of the viewer. |
528 | * @param hook_data hook data associated with the hook function. |
529 | * @param main_win the main window the viewer belongs to. |
530 | */ |
531 | |
532 | void RegUpdateDividor(LttvHook hook, gpointer hook_data, |
533 | mainWindow *main_win) |
534 | { |
535 | LttvAttributeValue value; |
536 | LttvHooks * tmp; |
537 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
538 | "hooks/hpanedividor", LTTV_POINTER, &value)); |
539 | tmp = (LttvHooks*)*(value.v_pointer); |
540 | if(tmp == NULL){ |
541 | tmp = lttv_hooks_new(); |
542 | *(value.v_pointer) = tmp; |
543 | } |
544 | lttv_hooks_add(tmp, hook, hook_data); |
545 | } |
546 | |
547 | |
548 | /** |
549 | * Function to unregister a viewer's hook function which is used to |
550 | * set/update hpane's dividor of the viewer. |
551 | * It will be called by the destructor of the viewer. |
552 | * @param hook hook function of the viewer. |
553 | * @param hook_data hook data associated with the hook function. |
554 | * @param main_win the main window the viewer belongs to. |
555 | */ |
556 | |
557 | void UnregUpdateDividor(LttvHook hook, gpointer hook_data, |
558 | mainWindow *main_win) |
559 | { |
560 | LttvAttributeValue value; |
561 | LttvHooks * tmp; |
562 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
563 | "hooks/hpanedividor", LTTV_POINTER, &value)); |
564 | tmp = (LttvHooks*)*(value.v_pointer); |
565 | if(tmp == NULL) return; |
566 | lttv_hooks_remove_data(tmp, hook, hook_data); |
567 | } |
568 | |
569 | |
570 | /** |
571 | * Function to set the position of the hpane's dividor (viewer). |
572 | * It will be called by a viewer's signal handle associated with |
573 | * the motion_notify_event event/signal |
574 | * @param main_win the main window the viewer belongs to. |
575 | * @param position position of the hpane's dividor. |
576 | */ |
577 | |
578 | void SetHPaneDividor(mainWindow *main_win, gint position) |
579 | { |
580 | LttvAttributeValue value; |
581 | LttvHooks * tmp; |
582 | g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes, |
583 | "hooks/hpanedividor", LTTV_POINTER, &value)); |
584 | tmp = (LttvHooks*)*(value.v_pointer); |
585 | if(tmp == NULL) return; |
586 | lttv_hooks_call(tmp, &position); |
587 | } |
588 | |
589 | |
590 | /** |
591 | * Function to process traceset. It will call lttv_process_trace, |
592 | * each view will call this api to get events. |
593 | * @param main_win the main window the viewer belongs to. |
594 | * @param start the start time of the first event to be processed. |
595 | * @param end the end time of the last event to be processed. |
596 | */ |
597 | |
f227416e |
598 | void processTraceset(mainWindow *main_win, LttTime start, |
599 | LttTime end, unsigned maxNumEvents) |
561f5852 |
600 | { |
308711e5 |
601 | lttv_process_traceset_seek_time(main_win->Traceset_Info->TracesetContext, start); |
a0d851ed |
602 | lttv_process_traceset(main_win->Traceset_Info->TracesetContext, end, maxNumEvents); |
561f5852 |
603 | } |
604 | |
605 | /** |
606 | * Function to add hooks into the context of a traceset, |
607 | * before reading events from traceset, viewer will call this api to |
608 | * register hooks |
609 | * @param main_win the main window the viewer belongs to. |
610 | * @param LttvHooks hooks to be registered. |
611 | */ |
612 | |
613 | void contextAddHooks(mainWindow *main_win , |
614 | LttvHooks *before_traceset, |
615 | LttvHooks *after_traceset, |
616 | LttvHooks *check_trace, |
617 | LttvHooks *before_trace, |
618 | LttvHooks *after_trace, |
619 | LttvHooks *check_tracefile, |
620 | LttvHooks *before_tracefile, |
621 | LttvHooks *after_tracefile, |
622 | LttvHooks *check_event, |
623 | LttvHooks *before_event, |
624 | LttvHooks *after_event) |
625 | { |
f7afe191 |
626 | LttvTracesetContext * tsc = |
627 | LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext); |
561f5852 |
628 | lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset, |
629 | check_trace,before_trace,after_trace, |
630 | check_tracefile,before_tracefile,after_tracefile, |
631 | check_event,before_event, after_event); |
632 | } |
633 | |
634 | |
635 | /** |
636 | * Function to remove hooks from the context of a traceset, |
637 | * before reading events from traceset, viewer will call this api to |
638 | * unregister hooks |
639 | * @param main_win the main window the viewer belongs to. |
640 | * @param LttvHooks hooks to be registered. |
641 | */ |
642 | |
643 | void contextRemoveHooks(mainWindow *main_win , |
644 | LttvHooks *before_traceset, |
645 | LttvHooks *after_traceset, |
646 | LttvHooks *check_trace, |
647 | LttvHooks *before_trace, |
648 | LttvHooks *after_trace, |
649 | LttvHooks *check_tracefile, |
650 | LttvHooks *before_tracefile, |
651 | LttvHooks *after_tracefile, |
652 | LttvHooks *check_event, |
653 | LttvHooks *before_event, |
654 | LttvHooks *after_event) |
655 | { |
f7afe191 |
656 | LttvTracesetContext * tsc = |
657 | LTTV_TRACESET_CONTEXT(main_win->Traceset_Info->TracesetContext); |
561f5852 |
658 | lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset, |
659 | check_trace,before_trace,after_trace, |
660 | check_tracefile,before_tracefile,after_tracefile, |
661 | check_event,before_event, after_event); |
662 | } |
f735c59a |
663 | |
664 | |
6b1d3120 |
665 | /** |
666 | * Function to add/remove event hooks for state |
667 | * @param main_win the main window the viewer belongs to. |
668 | */ |
669 | |
670 | void stateAddEventHooks(mainWindow *main_win ) |
671 | { |
f7afe191 |
672 | lttv_state_add_event_hooks( |
673 | (LttvTracesetState*)main_win->Traceset_Info->TracesetContext); |
6b1d3120 |
674 | } |
675 | |
676 | void stateRemoveEventHooks(mainWindow *main_win ) |
677 | { |
f7afe191 |
678 | lttv_state_remove_event_hooks( |
679 | (LttvTracesetState*)main_win->Traceset_Info->TracesetContext); |
6b1d3120 |
680 | } |
681 | |
682 | |
683 | /** |
684 | * Function to add/remove event hooks for stats |
685 | * @param main_win the main window the viewer belongs to. |
686 | */ |
687 | |
688 | void statsAddEventHooks(mainWindow *main_win ) |
689 | { |
f7afe191 |
690 | lttv_stats_add_event_hooks( |
691 | (LttvTracesetStats*)main_win->Traceset_Info->TracesetContext); |
6b1d3120 |
692 | } |
693 | |
694 | void statsRemoveEventHooks(mainWindow *main_win ) |
695 | { |
f7afe191 |
696 | lttv_stats_remove_event_hooks( |
697 | (LttvTracesetStats*)main_win->Traceset_Info->TracesetContext); |
6b1d3120 |
698 | } |
699 | |
700 | /** |
701 | * Function to get the stats of the traceset |
702 | * @param main_win the main window the viewer belongs to. |
703 | */ |
704 | |
705 | LttvTracesetStats* getTracesetStats(mainWindow *main_win) |
706 | { |
f7afe191 |
707 | return main_win->Traceset_Info->TracesetContext; |
6b1d3120 |
708 | } |