filter working: for selecting trace/tracefile
[lttv.git] / ltt / branches / poly / lttv / modules / gui / API / gtkTraceSet.c
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
13 #include <lttv/common.h>
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>
19 #include <lttv/toolbar.h>
20 #include <lttv/menu.h>
21 #include <lttv/state.h>
22 #include <lttv/stats.h>
23
24
25 /**
26 * Internal function parts
27 */
28
29 /**
30 * Function to set/update traceset for the viewers
31 * @param main_win main window
32 * @param traceset traceset of the main window.
33 */
34
35 void SetTraceset(MainWindow * main_win, gpointer traceset)
36 {
37 LttvHooks * tmp;
38 LttvAttributeValue value;
39
40 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
41 "hooks/updatetraceset", LTTV_POINTER, &value));
42 tmp = (LttvHooks*)*(value.v_pointer);
43 if(tmp == NULL)return;
44 lttv_hooks_call(tmp,traceset);
45 }
46
47
48 /**
49 * Function to set/update filter for the viewers
50 * @param main_win main window
51 * @param filter filter of the main window.
52 */
53
54 void SetFilter(MainWindow * main_win, gpointer filter)
55 {
56 LttvHooks * tmp;
57 LttvAttributeValue value;
58
59 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
60 "hooks/updatefilter", LTTV_POINTER, &value));
61 tmp = (LttvHooks*)*(value.v_pointer);
62
63 if(tmp == NULL)return;
64 lttv_hooks_call(tmp,filter);
65 }
66
67
68
69 /**
70 * API parts
71 */
72
73 /**
74 * Function to register a view constructor so that main window can generate
75 * a toolbar item for the viewer in order to generate a new instance easily.
76 * It will be called by init function of the module.
77 * @param ButtonPixmap image shown on the toolbar item.
78 * @param tooltip tooltip of the toolbar item.
79 * @param view_constructor constructor of the viewer.
80 */
81
82 void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor)
83 {
84 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
85 LttvToolbars * toolbar;
86 LttvAttributeValue value;
87
88 g_assert(lttv_iattribute_find_by_path(attributes_global,
89 "viewers/toolbar", LTTV_POINTER, &value));
90 toolbar = (LttvToolbars*)*(value.v_pointer);
91
92 if(toolbar == NULL){
93 toolbar = lttv_toolbars_new();
94 *(value.v_pointer) = toolbar;
95 }
96 lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap);
97 }
98
99
100 /**
101 * Function to unregister the viewer's constructor, release the space
102 * occupied by pixmap, tooltip 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 pixmap and tooltip are.
106 */
107
108 void toolbar_item_unreg(lttv_constructor view_constructor)
109 {
110 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
111 LttvToolbars * toolbar;
112 LttvAttributeValue value;
113
114 g_assert(lttv_iattribute_find_by_path(attributes_global,
115 "viewers/toolbar", LTTV_POINTER, &value));
116 toolbar = (LttvToolbars*)*(value.v_pointer);
117
118 main_window_remove_toolbar_item(view_constructor);
119
120 lttv_toolbars_remove(toolbar, view_constructor);
121 }
122
123
124 /**
125 * Function to register a view constructor so that main window can generate
126 * a menu item for the viewer in order to generate a new instance easily.
127 * It will be called by init function of the module.
128 * @param menu_path path of the menu item.
129 * @param menu_text text of the menu item.
130 * @param view_constructor constructor of the viewer.
131 */
132
133 void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor)
134 {
135 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
136 LttvMenus * menu;
137 LttvAttributeValue value;
138
139 g_assert(lttv_iattribute_find_by_path(attributes_global,
140 "viewers/menu", LTTV_POINTER, &value));
141 menu = (LttvMenus*)*(value.v_pointer);
142
143 if(menu == NULL){
144 menu = lttv_menus_new();
145 *(value.v_pointer) = menu;
146 }
147 lttv_menus_add(menu, view_constructor, menu_path, menu_text);
148 }
149
150 /**
151 * Function to unregister the viewer's constructor, release the space
152 * occupied by menu_path, menu_text and constructor of the viewer.
153 * It will be called when a module is unloaded.
154 * @param view_constructor constructor of the viewer which is used as
155 * a reference to find out where the menu_path and menu_text are.
156 */
157
158 void menu_item_unreg(lttv_constructor view_constructor)
159 {
160 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
161 LttvMenus * menu;
162 LttvAttributeValue value;
163
164 g_assert(lttv_iattribute_find_by_path(attributes_global,
165 "viewers/menu", LTTV_POINTER, &value));
166 menu = (LttvMenus*)*(value.v_pointer);
167
168 main_window_remove_menu_item(view_constructor);
169
170 lttv_menus_remove(menu, view_constructor);
171 }
172
173
174 /**
175 * Update the status bar whenever something changed in the viewer.
176 * @param main_win the main window the viewer belongs to.
177 * @param info the message which will be shown in the status bar.
178 */
179
180 void update_status(MainWindow *main_win, char *info)
181 {
182 }
183
184
185 /**
186 * Function to get the current time interval shown on the current tab.
187 * It will be called by a viewer's hook function to update the
188 * shown time interval of the viewer and also be called by the constructor
189 * of the viewer.
190 * @param main_win the main window the viewer belongs to.
191 * @param time_interval a pointer where time interval will be stored.
192 */
193
194 void get_time_window(MainWindow *main_win, TimeWindow *time_window)
195 {
196 //time_window->start_time = main_win->current_tab->time_window.start_time;
197 //time_window->time_width = main_win->current_tab->time_window.time_width;
198 *time_window = main_win->current_tab->time_window;
199 }
200
201 /**
202 * Function to get the current time interval of the current traceset.
203 * It will be called by a viewer's hook function to update the
204 * time interval of the viewer and also be called by the constructor
205 * of the viewer.
206 * @param main_win the main window the viewer belongs to.
207 * @param time_interval a pointer where time interval will be stored.
208 */
209
210 void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_interval)
211 {
212 //time_window->start_time = main_win->current_tab->time_window.start_time;
213 //time_window->time_width = main_win->current_tab->time_window.time_width;
214 *time_interval = *(LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
215 traceset_context)->Time_Span);
216 }
217
218
219
220 /**
221 * Function to set the time interval of the current tab.
222 * It will be called by a viewer's signal handle associated with
223 * the move_slider signal
224 * @param main_win the main window the viewer belongs to.
225 * @param time_interval a pointer where time interval is stored.
226 */
227
228 void set_time_window(MainWindow *main_win, TimeWindow *time_window)
229 {
230 LttvAttributeValue value;
231 LttvHooks * tmp;
232 main_win->current_tab->time_window = *time_window;
233 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
234 "hooks/updatetimewindow", LTTV_POINTER, &value));
235 tmp = (LttvHooks*)*(value.v_pointer);
236 if(tmp == NULL) return;
237 lttv_hooks_call(tmp, time_window);
238 }
239
240
241 /**
242 * Function to get the current time/event of the current tab.
243 * It will be called by a viewer's hook function to update the
244 * current time/event of the viewer.
245 * @param main_win the main window the viewer belongs to.
246 * @param time a pointer where time will be stored.
247 */
248
249 void get_current_time(MainWindow *main_win, LttTime *time)
250 {
251 time = &main_win->current_tab->current_time;
252 }
253
254
255 /**
256 * Function to set the current time/event of the current tab.
257 * It will be called by a viewer's signal handle associated with
258 * the button-release-event signal
259 * @param main_win the main window the viewer belongs to.
260 * @param time a pointer where time is stored.
261 */
262
263 void set_current_time(MainWindow *main_win, LttTime *time)
264 {
265 LttvAttributeValue value;
266 LttvHooks * tmp;
267 main_win->current_tab->current_time = *time;
268 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
269 "hooks/updatecurrenttime", LTTV_POINTER, &value));
270 tmp = (LttvHooks*)*(value.v_pointer);
271
272 if(tmp == NULL)return;
273 lttv_hooks_call(tmp, time);
274 }
275
276
277 /**
278 * Function to get the traceset from the current tab.
279 * It will be called by the constructor of the viewer and also be
280 * called by a hook funtion of the viewer to update its traceset.
281 * @param main_win the main window the viewer belongs to.
282 * @param traceset a pointer to a traceset.
283 */
284 /*
285 void get_traceset(MainWindow *main_win, Traceset *traceset)
286 {
287 }
288 */
289
290 /**
291 * Function to get the filter of the current tab.
292 * It will be called by the constructor of the viewer and also be
293 * called by a hook funtion of the viewer to update its filter.
294 * @param main_win, the main window the viewer belongs to.
295 * @param filter, a pointer to a filter.
296 */
297 /*
298 void get_filter(MainWindow *main_win, Filter *filter)
299 {
300 }
301 */
302
303 /**
304 * Function to register a hook function for a viewer to set/update its
305 * time interval.
306 * It will be called by the constructor of the viewer.
307 * @param hook hook function of the viewer.
308 * @param hook_data hook data associated with the hook function.
309 * @param main_win the main window the viewer belongs to.
310 */
311
312 void reg_update_time_window(LttvHook hook, gpointer hook_data,
313 MainWindow * main_win)
314 {
315 LttvAttributeValue value;
316 LttvHooks * tmp;
317 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
318 "hooks/updatetimewindow", LTTV_POINTER, &value));
319 tmp = (LttvHooks*)*(value.v_pointer);
320 if(tmp == NULL){
321 tmp = lttv_hooks_new();
322 *(value.v_pointer) = tmp;
323 }
324 lttv_hooks_add(tmp, hook,hook_data);
325 }
326
327
328 /**
329 * Function to unregister a viewer's hook function which is used to
330 * set/update the time interval of the viewer.
331 * It will be called by the destructor of the viewer.
332 * @param hook hook function of the viewer.
333 * @param hook_data hook data associated with the hook function.
334 * @param main_win the main window the viewer belongs to.
335 */
336
337 void unreg_update_time_window(LttvHook hook, gpointer hook_data,
338 MainWindow * main_win)
339 {
340 LttvAttributeValue value;
341 LttvHooks * tmp;
342 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
343 "hooks/updatetimewindow", LTTV_POINTER, &value));
344 tmp = (LttvHooks*)*(value.v_pointer);
345 if(tmp == NULL) return;
346 lttv_hooks_remove_data(tmp, hook, hook_data);
347 }
348
349
350 /**
351 * Function to register a hook function for a viewer to set/update its
352 * traceset.
353 * It will be called by the constructor of the viewer.
354 * @param hook hook function of the viewer.
355 * @param hook_data hook data associated with the hook function.
356 * @param main_win the main window the viewer belongs to.
357 */
358
359 void reg_update_traceset(LttvHook hook, gpointer hook_data,
360 MainWindow * main_win)
361 {
362 LttvAttributeValue value;
363 LttvHooks * tmp;
364 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
365 "hooks/updatetraceset", LTTV_POINTER, &value));
366 tmp = (LttvHooks*)*(value.v_pointer);
367 if(tmp == NULL){
368 tmp = lttv_hooks_new();
369 *(value.v_pointer) = tmp;
370 }
371 lttv_hooks_add(tmp, hook, hook_data);
372 }
373
374
375 /**
376 * Function to unregister a viewer's hook function which is used to
377 * set/update the traceset of the viewer.
378 * It will be called by the destructor of the viewer.
379 * @param hook hook function of the viewer.
380 * @param hook_data hook data associated with the hook function.
381 * @param main_win the main window the viewer belongs to.
382 */
383
384 void unreg_update_traceset(LttvHook hook, gpointer hook_data,
385 MainWindow * main_win)
386 {
387 LttvAttributeValue value;
388 LttvHooks * tmp;
389 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
390 "hooks/updatetraceset", LTTV_POINTER, &value));
391 tmp = (LttvHooks*)*(value.v_pointer);
392 if(tmp == NULL) return;
393 lttv_hooks_remove_data(tmp, hook, hook_data);
394 }
395
396
397 /**
398 * Function to redraw each viewer belonging to the current tab
399 * @param main_win the main window the viewer belongs to.
400 */
401
402 void update_traceset(MainWindow * main_win)
403 {
404 LttvAttributeValue value;
405 LttvHooks * tmp;
406 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
407 "hooks/updatetraceset", LTTV_POINTER, &value));
408 tmp = (LttvHooks*)*(value.v_pointer);
409 if(tmp == NULL) return;
410 lttv_hooks_call(tmp, NULL);
411 }
412
413
414 /**
415 * Function to register a hook function for a viewer to set/update its
416 * filter.
417 * It will be called by the constructor of the viewer.
418 * @param hook hook function of the viewer.
419 * @param hook_data hook data associated with the hook function.
420 * @param main_win the main window the viewer belongs to.
421 */
422
423 void reg_update_filter(LttvHook hook, gpointer hook_data,
424 MainWindow *main_win)
425 {
426 LttvAttributeValue value;
427 LttvHooks * tmp;
428 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
429 "hooks/updatefilter", LTTV_POINTER, &value));
430 tmp = (LttvHooks*)*(value.v_pointer);
431 if(tmp == NULL){
432 tmp = lttv_hooks_new();
433 *(value.v_pointer) = tmp;
434 }
435 lttv_hooks_add(tmp, hook, hook_data);
436 }
437
438
439 /**
440 * Function to unregister a viewer's hook function which is used to
441 * set/update the filter of the viewer.
442 * It will be called by the destructor of the viewer.
443 * @param hook hook function of the viewer.
444 * @param hook_data hook data associated with the hook function.
445 * @param main_win the main window the viewer belongs to.
446 */
447
448 void unreg_update_filter(LttvHook hook, gpointer hook_data,
449 MainWindow * main_win)
450 {
451 LttvAttributeValue value;
452 LttvHooks * tmp;
453 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
454 "hooks/updatefilter", LTTV_POINTER, &value));
455 tmp = (LttvHooks*)*(value.v_pointer);
456 if(tmp == NULL) return;
457 lttv_hooks_remove_data(tmp, hook, hook_data);
458 }
459
460
461 /**
462 * Function to register a hook function for a viewer to set/update its
463 * current time.
464 * It will be called by the constructor of the viewer.
465 * @param hook hook function of the viewer.
466 * @param hook_data hook data associated with the hook function.
467 * @param main_win the main window the viewer belongs to.
468 */
469
470 void reg_update_current_time(LttvHook hook, gpointer hook_data,
471 MainWindow *main_win)
472 {
473 LttvAttributeValue value;
474 LttvHooks * tmp;
475 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
476 "hooks/updatecurrenttime", LTTV_POINTER, &value));
477 tmp = (LttvHooks*)*(value.v_pointer);
478 if(tmp == NULL){
479 tmp = lttv_hooks_new();
480 *(value.v_pointer) = tmp;
481 }
482 lttv_hooks_add(tmp, hook, hook_data);
483 }
484
485
486 /**
487 * Function to unregister a viewer's hook function which is used to
488 * set/update the current time of the viewer.
489 * It will be called by the destructor of the viewer.
490 * @param hook hook function of the viewer.
491 * @param hook_data hook data associated with the hook function.
492 * @param main_win the main window the viewer belongs to.
493 */
494
495 void unreg_update_current_time(LttvHook hook, gpointer hook_data,
496 MainWindow * main_win)
497 {
498 LttvAttributeValue value;
499 LttvHooks * tmp;
500 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
501 "hooks/updatecurrenttime", LTTV_POINTER, &value));
502 tmp = (LttvHooks*)*(value.v_pointer);
503 if(tmp == NULL) return;
504 lttv_hooks_remove_data(tmp, hook, hook_data);
505 }
506
507
508 /**
509 * Function to register a hook function for a viewer to show
510 *the content of the viewer.
511 * It will be called by the constructor of the viewer.
512 * @param hook hook function of the viewer.
513 * @param hook_data hook data associated with the hook function.
514 * @param main_win the main window the viewer belongs to.
515 */
516
517 void reg_show_viewer(LttvHook hook, gpointer hook_data,
518 MainWindow *main_win)
519 {
520 LttvAttributeValue value;
521 LttvHooks * tmp;
522 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
523 "hooks/showviewer", LTTV_POINTER, &value));
524 tmp = (LttvHooks*)*(value.v_pointer);
525 if(tmp == NULL){
526 tmp = lttv_hooks_new();
527 *(value.v_pointer) = tmp;
528 }
529 lttv_hooks_add(tmp, hook, hook_data);
530 }
531
532
533 /**
534 * Function to unregister a viewer's hook function which is used to
535 * show the content of the viewer..
536 * It will be called by the destructor of the viewer.
537 * @param hook hook function of the viewer.
538 * @param hook_data hook data associated with the hook function.
539 * @param main_win the main window the viewer belongs to.
540 */
541
542 void unreg_show_viewer(LttvHook hook, gpointer hook_data,
543 MainWindow * main_win)
544 {
545 LttvAttributeValue value;
546 LttvHooks * tmp;
547 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
548 "hooks/showviewer", LTTV_POINTER, &value));
549 tmp = (LttvHooks*)*(value.v_pointer);
550 if(tmp == NULL) return;
551 lttv_hooks_remove_data(tmp, hook, hook_data);
552 }
553
554
555 /**
556 * Function to show each viewer in the current tab.
557 * It will be called by main window after it called process_traceset
558 * @param main_win the main window the viewer belongs to.
559 */
560
561 void show_viewer(MainWindow *main_win)
562 {
563 LttvAttributeValue value;
564 LttvHooks * tmp;
565 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
566 "hooks/showviewer", LTTV_POINTER, &value));
567 tmp = (LttvHooks*)*(value.v_pointer);
568 if(tmp == NULL) return;
569 lttv_hooks_call(tmp, NULL);
570 }
571
572
573 /**
574 * Function to set the focused pane (viewer).
575 * It will be called by a viewer's signal handle associated with
576 * the grab_focus signal
577 * @param main_win the main window the viewer belongs to.
578 * @param paned a pointer to a pane where the viewer is contained.
579 */
580
581 void set_focused_pane(MainWindow *main_win, gpointer paned)
582 {
583 gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);
584 }
585
586
587 /**
588 * Function to register a hook function for a viewer to set/update the
589 * dividor of the hpane.
590 * It will be called by the constructor of the viewer.
591 * @param hook hook function of the viewer.
592 * @param hook_data hook data associated with the hook function.
593 * @param main_win the main window the viewer belongs to.
594 */
595
596 void reg_update_dividor(LttvHook hook, gpointer hook_data,
597 MainWindow *main_win)
598 {
599 LttvAttributeValue value;
600 LttvHooks * tmp;
601 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
602 "hooks/hpanedividor", LTTV_POINTER, &value));
603 tmp = (LttvHooks*)*(value.v_pointer);
604 if(tmp == NULL){
605 tmp = lttv_hooks_new();
606 *(value.v_pointer) = tmp;
607 }
608 lttv_hooks_add(tmp, hook, hook_data);
609 }
610
611
612 /**
613 * Function to unregister a viewer's hook function which is used to
614 * set/update hpane's dividor of the viewer.
615 * It will be called by the destructor of the viewer.
616 * @param hook hook function of the viewer.
617 * @param hook_data hook data associated with the hook function.
618 * @param main_win the main window the viewer belongs to.
619 */
620
621 void unreg_update_dividor(LttvHook hook, gpointer hook_data,
622 MainWindow *main_win)
623 {
624 LttvAttributeValue value;
625 LttvHooks * tmp;
626 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
627 "hooks/hpanedividor", LTTV_POINTER, &value));
628 tmp = (LttvHooks*)*(value.v_pointer);
629 if(tmp == NULL) return;
630 lttv_hooks_remove_data(tmp, hook, hook_data);
631 }
632
633
634 /**
635 * Function to set the position of the hpane's dividor (viewer).
636 * It will be called by a viewer's signal handle associated with
637 * the motion_notify_event event/signal
638 * @param main_win the main window the viewer belongs to.
639 * @param position position of the hpane's dividor.
640 */
641
642 void set_hpane_dividor(MainWindow *main_win, gint position)
643 {
644 LttvAttributeValue value;
645 LttvHooks * tmp;
646 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
647 "hooks/hpanedividor", LTTV_POINTER, &value));
648 tmp = (LttvHooks*)*(value.v_pointer);
649 if(tmp == NULL) return;
650 lttv_hooks_call(tmp, &position);
651 }
652
653
654 /**
655 * Function to process traceset. It will call lttv_process_trace,
656 * each view will call this api to get events.
657 * @param main_win the main window the viewer belongs to.
658 * @param start the start time of the first event to be processed.
659 * @param end the end time of the last event to be processed.
660 */
661
662 void process_traceset_api(MainWindow *main_win, LttTime start,
663 LttTime end, unsigned maxNumEvents)
664 {
665 lttv_process_traceset_seek_time(main_win->current_tab->traceset_info->
666 traceset_context, start);
667 lttv_process_traceset(main_win->current_tab->traceset_info->
668 traceset_context, end, maxNumEvents);
669 }
670
671 /**
672 * Function to add hooks into the context of a traceset,
673 * before reading events from traceset, viewer will call this api to
674 * register hooks
675 * @param main_win the main window the viewer belongs to.
676 * @param LttvHooks hooks to be registered.
677 */
678
679 void context_add_hooks_api(MainWindow *main_win ,
680 LttvHooks *before_traceset,
681 LttvHooks *after_traceset,
682 LttvHooks *check_trace,
683 LttvHooks *before_trace,
684 LttvHooks *after_trace,
685 LttvHooks *check_tracefile,
686 LttvHooks *before_tracefile,
687 LttvHooks *after_tracefile,
688 LttvHooks *check_event,
689 LttvHooks *before_event,
690 LttvHooks *after_event)
691 {
692 LttvTracesetContext * tsc =
693 LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
694 traceset_context);
695 lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset,
696 check_trace,before_trace,after_trace,
697 check_tracefile,before_tracefile,after_tracefile,
698 check_event,before_event, after_event);
699 }
700
701
702 /**
703 * Function to remove hooks from the context of a traceset,
704 * before reading events from traceset, viewer will call this api to
705 * unregister hooks
706 * @param main_win the main window the viewer belongs to.
707 * @param LttvHooks hooks to be registered.
708 */
709
710 void context_remove_hooks_api(MainWindow *main_win ,
711 LttvHooks *before_traceset,
712 LttvHooks *after_traceset,
713 LttvHooks *check_trace,
714 LttvHooks *before_trace,
715 LttvHooks *after_trace,
716 LttvHooks *check_tracefile,
717 LttvHooks *before_tracefile,
718 LttvHooks *after_tracefile,
719 LttvHooks *check_event,
720 LttvHooks *before_event,
721 LttvHooks *after_event)
722 {
723 LttvTracesetContext * tsc =
724 LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->traceset_context);
725 lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset,
726 check_trace,before_trace,after_trace,
727 check_tracefile,before_tracefile,after_tracefile,
728 check_event,before_event, after_event);
729 }
730
731
732 /**
733 * Function to add/remove event hooks for state
734 * @param main_win the main window the viewer belongs to.
735 */
736
737 void state_add_event_hooks_api(MainWindow *main_win )
738 {
739 lttv_state_add_event_hooks(
740 (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
741 }
742
743 void state_remove_event_hooks_api(MainWindow *main_win )
744 {
745 lttv_state_remove_event_hooks(
746 (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
747 }
748
749
750 /**
751 * Function to add/remove event hooks for stats
752 * @param main_win the main window the viewer belongs to.
753 */
754
755 void stats_add_event_hooks_api(MainWindow *main_win )
756 {
757 lttv_stats_add_event_hooks(
758 (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
759 }
760
761 void stats_remove_event_hooks_api(MainWindow *main_win )
762 {
763 lttv_stats_remove_event_hooks(
764 (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
765 }
766
767 /**
768 * Function to get the stats of the traceset
769 * @param main_win the main window the viewer belongs to.
770 */
771
772 LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win)
773 {
774 return main_win->current_tab->traceset_info->traceset_context;
775 }
776
777
778 LttvTracesetContext* get_traceset_context(MainWindow *main_win)
779 {
780 return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
781 }
This page took 0.049063 seconds and 4 git commands to generate.