Commit | Line | Data |
---|---|---|
7a4bdb54 YB |
1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2003-2004 Michel Dagenais | |
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 | ||
19 | #ifndef PROCESSTRACE_H | |
20 | #define PROCESSTRACE_H | |
21 | ||
22 | #include <string.h> | |
23 | #include <lttv/traceset.h> | |
24 | #include <lttv/attribute.h> | |
25 | #include <lttv/hook.h> | |
26 | ||
27 | //typedef void LttvFilter; /* TODO (MD) */ | |
28 | typedef struct _LttvFilter LttvFilter; | |
29 | ||
30 | /* Run through the events in a traceset in sorted order calling all the | |
31 | hooks appropriately. It starts at the current time and runs until end or | |
32 | nb_events are processed. */ | |
33 | ||
34 | void lttv_process_traceset(LttvTraceset *traceset, LttTime end, | |
35 | unsigned nb_events); | |
36 | ||
37 | /* Process traceset can also be done in smaller pieces calling begin, | |
38 | * then seek and middle repeatedly, and end. The middle function return the | |
39 | * number of events processed. It will be smaller than nb_events if the end time | |
40 | * or end position is reached. */ | |
41 | ||
42 | ||
43 | void lttv_process_traceset_begin(LttvTraceset *traceset, | |
44 | LttvHooks *before_traceset, | |
45 | LttvHooks *before_trace, | |
46 | LttvHooks *event); | |
47 | ||
48 | guint lttv_process_traceset_middle(LttvTraceset *traceset, | |
49 | LttTime end, | |
50 | gulong nb_events, | |
51 | const LttvTracesetPosition *end_position); | |
52 | ||
53 | void lttv_process_traceset_end(LttvTraceset *traceset, | |
54 | LttvHooks *after_traceset, | |
55 | LttvHooks *after_trace, | |
56 | LttvHooks *event); | |
57 | ||
58 | guint lttv_process_traceset_update(LttvTraceset *traceset); | |
59 | ||
60 | ||
61 | void lttv_process_traceset_seek_time(LttvTraceset *traceset, LttTime start); | |
62 | ||
63 | void lttv_traceset_compute_time_span(LttvTraceset *traceset, | |
64 | TimeInterval *time_span); | |
9a366873 | 65 | #ifdef BABEL_CLEANUP |
7a4bdb54 YB |
66 | gboolean lttv_process_traceset_seek_position(LttvTraceset *traceset, |
67 | const LttvTracesetPosition *pos); | |
9a366873 | 68 | #endif /*babel_cleanup*/ |
7a4bdb54 YB |
69 | void lttv_process_trace_seek_time(LttvTrace *trace, LttTime start); |
70 | ||
71 | void lttv_traceset_add_hooks(LttvTraceset *traceset, | |
72 | LttvHooks *before_traceset, | |
73 | LttvHooks *before_trace, | |
74 | LttvHooks *event); | |
75 | ||
76 | void lttv_traceset_remove_hooks(LttvTraceset *traceset, | |
77 | LttvHooks *after_traceset, | |
78 | LttvHooks *after_trace, | |
79 | LttvHooks *event); | |
80 | ||
81 | void lttv_trace_add_hooks(LttvTrace *trace, | |
82 | LttvHooks *before_trace, | |
83 | LttvHooks *event); | |
84 | ||
85 | void lttv_trace_remove_hooks(LttvTrace *trace, | |
86 | LttvHooks *after_trace, | |
87 | LttvHooks *event); | |
88 | ||
89 | LttvTracesetPosition * | |
90 | lttv_traceset_position_new(const LttvTraceset *traceset); | |
91 | ||
92 | void lttv_traceset_position_save(const LttvTraceset *traceset, | |
93 | LttvTracesetPosition *pos); | |
94 | ||
95 | void lttv_traceset_position_destroy(LttvTracesetPosition *pos); | |
96 | ||
97 | void lttv_traceset_position_copy(LttvTracesetPosition *dest, | |
98 | const LttvTracesetPosition *src); | |
99 | ||
100 | gint | |
101 | lttv_traceset_pos_pos_compare(const LttvTracesetPosition *pos1, | |
102 | const LttvTracesetPosition *pos2); | |
103 | ||
104 | gint lttv_traceset_ts_pos_compare(const LttvTraceset *traceset, | |
105 | const LttvTracesetPosition *pos2); | |
9a366873 | 106 | #ifdef BABEL_CLEANUP/*Already in traceset.h*/ |
7a4bdb54 YB |
107 | LttTime |
108 | lttv_traceset_position_get_time(const LttvTracesetPosition *pos); | |
9a366873 | 109 | #endif //babel_cleanup |
7a4bdb54 YB |
110 | /* Seek n events forward and backward (without filtering) : only use these where |
111 | * necessary : the seek backward is costy. */ | |
112 | ||
113 | #define BACKWARD_SEEK_MUL 2 /* Multiplication factor of time_offset between | |
114 | backward seek iterations */ | |
9a366873 FD |
115 | #ifdef BABEL_CLEANUP |
116 | static const gdouble seek_back_default_offset = 10; | |
117 | #endif //babel_cleanup | |
118 | static const gdouble SEEK_BACK_DEFAULT_RATIO = 20; | |
7a4bdb54 YB |
119 | |
120 | typedef gboolean check_handler(guint count, gboolean *stop_flag, gpointer data); | |
121 | ||
122 | guint lttv_process_traceset_seek_n_forward(LttvTraceset *traceset, | |
123 | guint n, | |
124 | check_handler *check, | |
125 | gboolean *stop_flag, | |
126 | LttvFilter *filter1, | |
127 | LttvFilter *filter2, | |
128 | LttvFilter *filter3, | |
129 | gpointer data); | |
130 | ||
131 | typedef void (*seek_time_fct)(LttvTraceset *traceset, LttTime start); | |
132 | ||
133 | /* If first_offset is ltt_time_zero, it will choose a default value */ | |
9a366873 FD |
134 | |
135 | ||
136 | guint lttv_process_traceset_seek_n_backward(LttvTraceset *self, | |
137 | guint n, | |
138 | gdouble ratio,/*nanosecond/event*/ | |
139 | check_handler *check, | |
140 | gboolean *stop_flag, | |
141 | LttvFilter *filter1, | |
142 | LttvFilter *filter2, | |
143 | LttvFilter *filter3, | |
144 | gpointer data); | |
7a4bdb54 YB |
145 | |
146 | #endif // PROCESSTRACE_H |