set_time_window updates horizontal scroll bar
[lttv.git] / ltt / branches / poly / lttv / modules / gui / API / gtkTraceSet.c
CommitLineData
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
561f5852 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
bca3b81f 35void SetTraceset(MainWindow * main_win, gpointer traceset)
561f5852 36{
37 LttvHooks * tmp;
38 LttvAttributeValue value;
39
bca3b81f 40 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
561f5852 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
bca3b81f 54void SetFilter(MainWindow * main_win, gpointer filter)
561f5852 55{
56 LttvHooks * tmp;
57 LttvAttributeValue value;
58
bca3b81f 59 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
561f5852 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
41a76985 82void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor)
561f5852 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
41a76985 108void toolbar_item_unreg(lttv_constructor view_constructor)
561f5852 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
2061e03d 118 main_window_remove_toolbar_item(view_constructor);
119
120 lttv_toolbars_remove(toolbar, view_constructor);
561f5852 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
41a76985 133void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor)
561f5852 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
41a76985 158void menu_item_unreg(lttv_constructor view_constructor)
561f5852 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,
c4c15b5e 165 "viewers/menu", LTTV_POINTER, &value));
561f5852 166 menu = (LttvMenus*)*(value.v_pointer);
167
2061e03d 168 main_window_remove_menu_item(view_constructor);
169
170 lttv_menus_remove(menu, view_constructor);
561f5852 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
41a76985 180void update_status(MainWindow *main_win, char *info)
561f5852 181{
182}
183
184
185/**
f7afe191 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
41a76985 194void get_time_window(MainWindow *main_win, TimeWindow *time_window)
f7afe191 195{
bca3b81f 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;
f7afe191 199}
200
201/**
202 * Function to get the current time interval of the current traceset.
561f5852 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
41a76985 210void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_interval)
561f5852 211{
bca3b81f 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;
716e4367 214 *time_interval = *(LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
215 traceset_context)->Time_Span);
561f5852 216}
217
218
f7afe191 219
561f5852 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
41a76985 228void set_time_window(MainWindow *main_win, TimeWindow *time_window)
561f5852 229{
230 LttvAttributeValue value;
231 LttvHooks * tmp;
bca3b81f 232 main_win->current_tab->time_window = *time_window;
bca085a1 233 gtk_multi_vpaned_set_scroll_value(main_win->current_tab->multi_vpaned,
234 ltt_time_to_double(time_window->start_time)
235 * NANOSECONDS_PER_SECOND );
bca3b81f 236 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
f7afe191 237 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 238 tmp = (LttvHooks*)*(value.v_pointer);
f7afe191 239 if(tmp == NULL) return;
a2eab0c9 240 lttv_hooks_call(tmp, time_window);
561f5852 241}
242
243
244/**
245 * Function to get the current time/event of the current tab.
246 * It will be called by a viewer's hook function to update the
247 * current time/event of the viewer.
248 * @param main_win the main window the viewer belongs to.
249 * @param time a pointer where time will be stored.
250 */
251
41a76985 252void get_current_time(MainWindow *main_win, LttTime *time)
561f5852 253{
bca3b81f 254 time = &main_win->current_tab->current_time;
561f5852 255}
256
257
258/**
259 * Function to set the current time/event of the current tab.
260 * It will be called by a viewer's signal handle associated with
261 * the button-release-event signal
262 * @param main_win the main window the viewer belongs to.
263 * @param time a pointer where time is stored.
264 */
265
41a76985 266void set_current_time(MainWindow *main_win, LttTime *time)
561f5852 267{
268 LttvAttributeValue value;
269 LttvHooks * tmp;
bca3b81f 270 main_win->current_tab->current_time = *time;
271 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 272 "hooks/updatecurrenttime", LTTV_POINTER, &value));
273 tmp = (LttvHooks*)*(value.v_pointer);
274
275 if(tmp == NULL)return;
276 lttv_hooks_call(tmp, time);
277}
278
279
280/**
281 * Function to get the traceset from the current tab.
282 * It will be called by the constructor of the viewer and also be
283 * called by a hook funtion of the viewer to update its traceset.
284 * @param main_win the main window the viewer belongs to.
285 * @param traceset a pointer to a traceset.
286 */
287/*
41a76985 288void get_traceset(MainWindow *main_win, Traceset *traceset)
561f5852 289{
290}
291*/
292
293/**
294 * Function to get the filter of the current tab.
295 * It will be called by the constructor of the viewer and also be
296 * called by a hook funtion of the viewer to update its filter.
297 * @param main_win, the main window the viewer belongs to.
298 * @param filter, a pointer to a filter.
299 */
300/*
41a76985 301void get_filter(MainWindow *main_win, Filter *filter)
561f5852 302{
303}
304*/
305
306/**
307 * Function to register a hook function for a viewer to set/update its
308 * time interval.
309 * It will be called by the constructor of the viewer.
310 * @param hook hook function of the viewer.
311 * @param hook_data hook data associated with the hook function.
312 * @param main_win the main window the viewer belongs to.
313 */
314
41a76985 315void reg_update_time_window(LttvHook hook, gpointer hook_data,
bca3b81f 316 MainWindow * main_win)
561f5852 317{
318 LttvAttributeValue value;
319 LttvHooks * tmp;
bca3b81f 320 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
f7afe191 321 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 322 tmp = (LttvHooks*)*(value.v_pointer);
323 if(tmp == NULL){
324 tmp = lttv_hooks_new();
325 *(value.v_pointer) = tmp;
326 }
327 lttv_hooks_add(tmp, hook,hook_data);
328}
329
330
331/**
332 * Function to unregister a viewer's hook function which is used to
333 * set/update the time interval of the viewer.
334 * It will be called by the destructor of the viewer.
335 * @param hook hook function of the viewer.
336 * @param hook_data hook data associated with the hook function.
337 * @param main_win the main window the viewer belongs to.
338 */
339
41a76985 340void unreg_update_time_window(LttvHook hook, gpointer hook_data,
bca3b81f 341 MainWindow * main_win)
561f5852 342{
343 LttvAttributeValue value;
344 LttvHooks * tmp;
bca3b81f 345 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
f7afe191 346 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 347 tmp = (LttvHooks*)*(value.v_pointer);
348 if(tmp == NULL) return;
349 lttv_hooks_remove_data(tmp, hook, hook_data);
350}
351
352
353/**
354 * Function to register a hook function for a viewer to set/update its
355 * traceset.
356 * It will be called by the constructor of the viewer.
357 * @param hook hook function of the viewer.
358 * @param hook_data hook data associated with the hook function.
359 * @param main_win the main window the viewer belongs to.
360 */
361
41a76985 362void reg_update_traceset(LttvHook hook, gpointer hook_data,
bca3b81f 363 MainWindow * main_win)
561f5852 364{
365 LttvAttributeValue value;
366 LttvHooks * tmp;
a8c0f09d 367 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 368 "hooks/updatetraceset", LTTV_POINTER, &value));
369 tmp = (LttvHooks*)*(value.v_pointer);
370 if(tmp == NULL){
371 tmp = lttv_hooks_new();
372 *(value.v_pointer) = tmp;
373 }
374 lttv_hooks_add(tmp, hook, hook_data);
375}
376
377
378/**
379 * Function to unregister a viewer's hook function which is used to
380 * set/update the traceset of the viewer.
381 * It will be called by the destructor of the viewer.
382 * @param hook hook function of the viewer.
383 * @param hook_data hook data associated with the hook function.
384 * @param main_win the main window the viewer belongs to.
385 */
386
41a76985 387void unreg_update_traceset(LttvHook hook, gpointer hook_data,
bca3b81f 388 MainWindow * main_win)
561f5852 389{
390 LttvAttributeValue value;
391 LttvHooks * tmp;
a8c0f09d 392 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 393 "hooks/updatetraceset", LTTV_POINTER, &value));
394 tmp = (LttvHooks*)*(value.v_pointer);
395 if(tmp == NULL) return;
396 lttv_hooks_remove_data(tmp, hook, hook_data);
397}
398
399
a8c0f09d 400/**
401 * Function to redraw each viewer belonging to the current tab
402 * @param main_win the main window the viewer belongs to.
403 */
404
405void update_traceset(MainWindow * main_win)
406{
407 LttvAttributeValue value;
408 LttvHooks * tmp;
409 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
410 "hooks/updatetraceset", LTTV_POINTER, &value));
411 tmp = (LttvHooks*)*(value.v_pointer);
412 if(tmp == NULL) return;
413 lttv_hooks_call(tmp, NULL);
414}
415
416
561f5852 417/**
418 * Function to register a hook function for a viewer to set/update its
419 * filter.
420 * It will be called by the constructor of the viewer.
421 * @param hook hook function of the viewer.
422 * @param hook_data hook data associated with the hook function.
423 * @param main_win the main window the viewer belongs to.
424 */
425
41a76985 426void reg_update_filter(LttvHook hook, gpointer hook_data,
bca3b81f 427 MainWindow *main_win)
561f5852 428{
429 LttvAttributeValue value;
430 LttvHooks * tmp;
bca3b81f 431 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
561f5852 432 "hooks/updatefilter", LTTV_POINTER, &value));
433 tmp = (LttvHooks*)*(value.v_pointer);
434 if(tmp == NULL){
435 tmp = lttv_hooks_new();
436 *(value.v_pointer) = tmp;
437 }
438 lttv_hooks_add(tmp, hook, hook_data);
439}
440
441
442/**
443 * Function to unregister a viewer's hook function which is used to
444 * set/update the filter of the viewer.
445 * It will be called by the destructor of the viewer.
446 * @param hook hook function of the viewer.
447 * @param hook_data hook data associated with the hook function.
448 * @param main_win the main window the viewer belongs to.
449 */
450
41a76985 451void unreg_update_filter(LttvHook hook, gpointer hook_data,
bca3b81f 452 MainWindow * main_win)
561f5852 453{
454 LttvAttributeValue value;
455 LttvHooks * tmp;
bca3b81f 456 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
561f5852 457 "hooks/updatefilter", LTTV_POINTER, &value));
458 tmp = (LttvHooks*)*(value.v_pointer);
459 if(tmp == NULL) return;
460 lttv_hooks_remove_data(tmp, hook, hook_data);
461}
462
463
464/**
465 * Function to register a hook function for a viewer to set/update its
466 * current time.
467 * It will be called by the constructor of the viewer.
468 * @param hook hook function of the viewer.
469 * @param hook_data hook data associated with the hook function.
470 * @param main_win the main window the viewer belongs to.
471 */
472
41a76985 473void reg_update_current_time(LttvHook hook, gpointer hook_data,
bca3b81f 474 MainWindow *main_win)
561f5852 475{
476 LttvAttributeValue value;
477 LttvHooks * tmp;
bca3b81f 478 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 479 "hooks/updatecurrenttime", LTTV_POINTER, &value));
480 tmp = (LttvHooks*)*(value.v_pointer);
481 if(tmp == NULL){
482 tmp = lttv_hooks_new();
483 *(value.v_pointer) = tmp;
484 }
485 lttv_hooks_add(tmp, hook, hook_data);
486}
487
488
489/**
490 * Function to unregister a viewer's hook function which is used to
491 * set/update the current time of the viewer.
492 * It will be called by the destructor of the viewer.
493 * @param hook hook function of the viewer.
494 * @param hook_data hook data associated with the hook function.
495 * @param main_win the main window the viewer belongs to.
496 */
497
41a76985 498void unreg_update_current_time(LttvHook hook, gpointer hook_data,
bca3b81f 499 MainWindow * main_win)
561f5852 500{
501 LttvAttributeValue value;
502 LttvHooks * tmp;
bca3b81f 503 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 504 "hooks/updatecurrenttime", LTTV_POINTER, &value));
505 tmp = (LttvHooks*)*(value.v_pointer);
506 if(tmp == NULL) return;
507 lttv_hooks_remove_data(tmp, hook, hook_data);
508}
509
510
202f6c8f 511/**
512 * Function to register a hook function for a viewer to show
513 *the content of the viewer.
514 * It will be called by the constructor of the viewer.
515 * @param hook hook function of the viewer.
516 * @param hook_data hook data associated with the hook function.
517 * @param main_win the main window the viewer belongs to.
518 */
519
520void reg_show_viewer(LttvHook hook, gpointer hook_data,
521 MainWindow *main_win)
522{
523 LttvAttributeValue value;
524 LttvHooks * tmp;
525 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
526 "hooks/showviewer", LTTV_POINTER, &value));
527 tmp = (LttvHooks*)*(value.v_pointer);
528 if(tmp == NULL){
529 tmp = lttv_hooks_new();
530 *(value.v_pointer) = tmp;
531 }
532 lttv_hooks_add(tmp, hook, hook_data);
533}
534
535
536/**
537 * Function to unregister a viewer's hook function which is used to
538 * show the content of the viewer..
539 * It will be called by the destructor of the viewer.
540 * @param hook hook function of the viewer.
541 * @param hook_data hook data associated with the hook function.
542 * @param main_win the main window the viewer belongs to.
543 */
544
545void unreg_show_viewer(LttvHook hook, gpointer hook_data,
546 MainWindow * main_win)
547{
548 LttvAttributeValue value;
549 LttvHooks * tmp;
550 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
551 "hooks/showviewer", LTTV_POINTER, &value));
552 tmp = (LttvHooks*)*(value.v_pointer);
553 if(tmp == NULL) return;
554 lttv_hooks_remove_data(tmp, hook, hook_data);
555}
556
557
558/**
559 * Function to show each viewer in the current tab.
560 * It will be called by main window after it called process_traceset
561 * @param main_win the main window the viewer belongs to.
562 */
563
564void show_viewer(MainWindow *main_win)
565{
566 LttvAttributeValue value;
567 LttvHooks * tmp;
568 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
569 "hooks/showviewer", LTTV_POINTER, &value));
570 tmp = (LttvHooks*)*(value.v_pointer);
571 if(tmp == NULL) return;
572 lttv_hooks_call(tmp, NULL);
573}
574
575
561f5852 576/**
577 * Function to set the focused pane (viewer).
578 * It will be called by a viewer's signal handle associated with
579 * the grab_focus signal
580 * @param main_win the main window the viewer belongs to.
581 * @param paned a pointer to a pane where the viewer is contained.
582 */
583
41a76985 584void set_focused_pane(MainWindow *main_win, gpointer paned)
561f5852 585{
daecc161 586 gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);
561f5852 587}
588
589
590/**
591 * Function to register a hook function for a viewer to set/update the
592 * dividor of the hpane.
593 * It will be called by the constructor of the viewer.
594 * @param hook hook function of the viewer.
595 * @param hook_data hook data associated with the hook function.
596 * @param main_win the main window the viewer belongs to.
597 */
598
41a76985 599void reg_update_dividor(LttvHook hook, gpointer hook_data,
bca3b81f 600 MainWindow *main_win)
561f5852 601{
602 LttvAttributeValue value;
603 LttvHooks * tmp;
bca3b81f 604 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 605 "hooks/hpanedividor", LTTV_POINTER, &value));
606 tmp = (LttvHooks*)*(value.v_pointer);
607 if(tmp == NULL){
608 tmp = lttv_hooks_new();
609 *(value.v_pointer) = tmp;
610 }
611 lttv_hooks_add(tmp, hook, hook_data);
612}
613
614
615/**
616 * Function to unregister a viewer's hook function which is used to
617 * set/update hpane's dividor of the viewer.
618 * It will be called by the destructor of the viewer.
619 * @param hook hook function of the viewer.
620 * @param hook_data hook data associated with the hook function.
621 * @param main_win the main window the viewer belongs to.
622 */
623
41a76985 624void unreg_update_dividor(LttvHook hook, gpointer hook_data,
bca3b81f 625 MainWindow *main_win)
561f5852 626{
627 LttvAttributeValue value;
628 LttvHooks * tmp;
bca3b81f 629 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 630 "hooks/hpanedividor", LTTV_POINTER, &value));
631 tmp = (LttvHooks*)*(value.v_pointer);
632 if(tmp == NULL) return;
633 lttv_hooks_remove_data(tmp, hook, hook_data);
634}
635
636
637/**
638 * Function to set the position of the hpane's dividor (viewer).
639 * It will be called by a viewer's signal handle associated with
640 * the motion_notify_event event/signal
641 * @param main_win the main window the viewer belongs to.
642 * @param position position of the hpane's dividor.
643 */
644
41a76985 645void set_hpane_dividor(MainWindow *main_win, gint position)
561f5852 646{
647 LttvAttributeValue value;
648 LttvHooks * tmp;
bca3b81f 649 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
561f5852 650 "hooks/hpanedividor", LTTV_POINTER, &value));
651 tmp = (LttvHooks*)*(value.v_pointer);
652 if(tmp == NULL) return;
653 lttv_hooks_call(tmp, &position);
654}
655
656
657/**
658 * Function to process traceset. It will call lttv_process_trace,
659 * each view will call this api to get events.
660 * @param main_win the main window the viewer belongs to.
661 * @param start the start time of the first event to be processed.
662 * @param end the end time of the last event to be processed.
663 */
664
41a76985 665void process_traceset_api(MainWindow *main_win, LttTime start,
666 LttTime end, unsigned maxNumEvents)
561f5852 667{
716e4367 668 lttv_process_traceset_seek_time(main_win->current_tab->traceset_info->
669 traceset_context, start);
670 lttv_process_traceset(main_win->current_tab->traceset_info->
671 traceset_context, end, maxNumEvents);
561f5852 672}
673
674/**
675 * Function to add hooks into the context of a traceset,
676 * before reading events from traceset, viewer will call this api to
677 * register hooks
678 * @param main_win the main window the viewer belongs to.
679 * @param LttvHooks hooks to be registered.
680 */
681
41a76985 682void context_add_hooks_api(MainWindow *main_win ,
683 LttvHooks *before_traceset,
684 LttvHooks *after_traceset,
685 LttvHooks *check_trace,
686 LttvHooks *before_trace,
687 LttvHooks *after_trace,
688 LttvHooks *check_tracefile,
689 LttvHooks *before_tracefile,
690 LttvHooks *after_tracefile,
691 LttvHooks *check_event,
692 LttvHooks *before_event,
693 LttvHooks *after_event)
561f5852 694{
f7afe191 695 LttvTracesetContext * tsc =
716e4367 696 LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
697 traceset_context);
561f5852 698 lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset,
699 check_trace,before_trace,after_trace,
700 check_tracefile,before_tracefile,after_tracefile,
701 check_event,before_event, after_event);
702}
703
704
705/**
706 * Function to remove hooks from the context of a traceset,
707 * before reading events from traceset, viewer will call this api to
708 * unregister hooks
709 * @param main_win the main window the viewer belongs to.
710 * @param LttvHooks hooks to be registered.
711 */
712
41a76985 713void context_remove_hooks_api(MainWindow *main_win ,
714 LttvHooks *before_traceset,
715 LttvHooks *after_traceset,
716 LttvHooks *check_trace,
717 LttvHooks *before_trace,
718 LttvHooks *after_trace,
719 LttvHooks *check_tracefile,
720 LttvHooks *before_tracefile,
721 LttvHooks *after_tracefile,
722 LttvHooks *check_event,
723 LttvHooks *before_event,
724 LttvHooks *after_event)
561f5852 725{
f7afe191 726 LttvTracesetContext * tsc =
716e4367 727 LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->traceset_context);
561f5852 728 lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset,
729 check_trace,before_trace,after_trace,
730 check_tracefile,before_tracefile,after_tracefile,
731 check_event,before_event, after_event);
732}
f735c59a 733
734
6b1d3120 735/**
736 * Function to add/remove event hooks for state
737 * @param main_win the main window the viewer belongs to.
738 */
739
41a76985 740void state_add_event_hooks_api(MainWindow *main_win )
6b1d3120 741{
f7afe191 742 lttv_state_add_event_hooks(
716e4367 743 (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
6b1d3120 744}
745
41a76985 746void state_remove_event_hooks_api(MainWindow *main_win )
6b1d3120 747{
f7afe191 748 lttv_state_remove_event_hooks(
716e4367 749 (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
6b1d3120 750}
751
752
753/**
754 * Function to add/remove event hooks for stats
755 * @param main_win the main window the viewer belongs to.
756 */
757
41a76985 758void stats_add_event_hooks_api(MainWindow *main_win )
6b1d3120 759{
f7afe191 760 lttv_stats_add_event_hooks(
716e4367 761 (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
6b1d3120 762}
763
41a76985 764void stats_remove_event_hooks_api(MainWindow *main_win )
6b1d3120 765{
f7afe191 766 lttv_stats_remove_event_hooks(
716e4367 767 (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
6b1d3120 768}
769
770/**
771 * Function to get the stats of the traceset
772 * @param main_win the main window the viewer belongs to.
773 */
774
41a76985 775LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win)
6b1d3120 776{
716e4367 777 return main_win->current_tab->traceset_info->traceset_context;
6b1d3120 778}
a8c0f09d 779
780
781LttvTracesetContext* get_traceset_context(MainWindow *main_win)
782{
783 return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
784}
This page took 0.056035 seconds and 4 git commands to generate.