a1a2b649 |
1 | /* This file is part of the Linux Trace Toolkit Graphic User Interface |
2 | * Copyright (C) 2003-2004 Mathieu Desnoyers |
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 | /* This file is the API used to launch any background computation on a trace */ |
20 | |
21 | #ifndef LTTVWINDOWTRACES_H |
22 | #define LTTVWINDOWTRACES_H |
23 | |
24 | #include <ltt/time.h> |
25 | #include <glib.h> |
26 | |
27 | typedef GQuark LttvTraceInfo; |
28 | |
29 | extern LttvTraceInfo LTTV_TRACES, |
30 | LTTV_COMPUTATION, |
31 | LTTV_REQUESTS_QUEUE, |
32 | LTTV_REQUESTS_CURRENT, |
33 | LTTV_NOTIFY_QUEUE, |
8bc02ec8 |
34 | LTTV_NOTIFY_CURRENT, |
35 | LTTV_COMPUTATION_TRACESET, |
36 | LTTV_COMPUTATION_TRACESET_CONTEXT, |
37 | LTTV_BEFORE_CHUNK_TRACESET, |
38 | LTTV_BEFORE_CHUNK_TRACE, |
39 | LTTV_BEFORE_CHUNK_TRACEFILE, |
40 | LTTV_AFTER_CHUNK_TRACESET, |
41 | LTTV_AFTER_CHUNK_TRACE, |
42 | LTTV_AFTER_CHUNK_TRACEFILE, |
43 | LTTV_BEFORE_REQUEST, |
44 | LTTV_AFTER_REQUEST, |
45 | LTTV_EVENT_HOOK, |
46 | LTTV_EVENT_HOOK_BY_ID, |
47 | LTTV_IN_PROGRESS, |
48 | LTTV_READY; |
49 | |
50 | |
a1a2b649 |
51 | |
52 | /* Get a trace by its path name. |
53 | * |
54 | * @param path path of the trace on the virtual file system. |
55 | * @return Pointer to trace if found |
56 | * NULL is returned if the trace is not present |
57 | */ |
58 | |
59 | LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path); |
60 | |
61 | /* Get a trace by its number identifier */ |
62 | |
63 | LttvTrace *lttvwindowtraces_get_trace(guint num); |
64 | |
65 | /* Total number of traces */ |
66 | |
67 | guint lttvwindowtraces_get_number(); |
68 | |
69 | /* Add a trace to the global attributes */ |
70 | |
71 | void lttvwindowtraces_add_trace(LttvTrace *trace); |
72 | |
73 | /* Remove a trace from the global attributes */ |
74 | |
75 | void lttvwindowtraces_remove_trace(LttvTrace *trace); |
76 | |
77 | |
78 | /** |
79 | * Function to request data from a specific trace |
80 | * |
81 | * The memory allocated for the request will be managed by the API. |
82 | * |
83 | * @param trace the trace to compute |
84 | * @param module_name the name of the module which registered global computation |
85 | * hooks. |
86 | */ |
87 | |
88 | void lttvwindowtraces_background_request_queue |
89 | (LttvTrace *trace, gchar *module_name); |
90 | |
91 | /** |
92 | * Remove a background request from a trace. |
93 | * |
94 | * This should ONLY be used by the modules which registered the global hooks |
95 | * (module_name). If this is called by the viewers, it may lead to incomplete |
96 | * and incoherent background processing information. |
97 | * |
98 | * Even if the module which deals with the hooks removes the background |
99 | * requests, it may cause a problem if the module gets loaded again in the |
100 | * session : the data will be partially calculated. The calculation function |
101 | * must deal with this case correctly. |
102 | * |
103 | * @param trace the trace to compute |
104 | * @param module_name the name of the module which registered global computation |
105 | * hooks. |
106 | */ |
107 | |
108 | void lttvwindowtraces_background_request_remove |
109 | (LttvTrace *trace, gchar *module_name); |
110 | |
111 | /** |
112 | * Register a callback to be called when requested data is passed in the next |
113 | * queued background processing. |
114 | * |
115 | * @param owner owner of the background notification |
116 | * @param trace the trace computed |
117 | * @param notify_time time when notification hooks must be called |
118 | * @param notify_position position when notification hooks must be called |
119 | * @param notify Hook to call when the notify position is passed |
120 | */ |
121 | |
122 | void lttvwindowtraces_background_notify_queue |
123 | (gpointer owner, |
124 | LttvTrace *trace, |
125 | LttTime notify_time, |
126 | const LttvTracesetContextPosition *notify_position, |
127 | const LttvHooks *notify); |
128 | |
129 | /** |
130 | * Register a callback to be called when requested data is passed in the current |
131 | * background processing. |
132 | * |
133 | * @param owner owner of the background notification |
134 | * @param trace the trace computed |
135 | * @param notify_time time when notification hooks must be called |
136 | * @param notify_position position when notification hooks must be called |
137 | * @param notify Hook to call when the notify position is passed |
138 | */ |
139 | |
140 | void lttvwindowtraces_background_notify_current |
141 | (gpointer owner, |
142 | LttvTrace *trace, |
143 | LttTime notify_time, |
144 | const LttvTracesetContextPosition *notify_position, |
145 | const LttvHooks *notify); |
146 | |
147 | /** |
148 | * Removes all the notifications requests from a specific viewer. |
149 | * |
150 | * @param owner owner of the background notification |
151 | */ |
152 | |
153 | void lttvwindowtraces_background_notify_remove(gpointer owner); |
154 | |
155 | |
e62a7964 |
156 | /** |
157 | * Tells if the information computed by a module for a trace is ready. |
158 | * |
159 | * Must be checked before a background processing request. |
160 | * |
161 | * @param module_name A GQuark : the name of the module which computes the |
162 | * information. |
163 | * @param trace The trace for which the information is verified. |
164 | */ |
165 | |
166 | gboolean lttvwindowtraces_get_ready(LttvAttributeName module_name, |
167 | LttvTrace *trace); |
168 | |
169 | /** |
170 | * Tells if the information computed by a module for a trace is being processed. |
171 | * |
172 | * Must be checked before a background processing request. |
173 | * |
174 | * If it is effectively processed, the typical thing to do is to call |
175 | * lttvwindowtraces_background_notify_current to be notified when the current |
176 | * processing will be over. |
177 | * |
178 | * @param module_name A GQuark : the name of the module which computes the |
179 | * information. |
180 | * @param trace The trace for which the information is verified. |
181 | */ |
182 | |
183 | gboolean lttvwindowtraces_get_in_progress(LttvAttributeName module_name, |
184 | LttvTrace *trace); |
185 | |
186 | /** |
187 | * Register the background computation hooks for a specific module. It adds the |
188 | * computation hooks to the global attrubutes, under "computation/module name" |
189 | * |
190 | * @param module_name A GQuark : the name of the module which computes the |
191 | * information. |
192 | */ |
193 | void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name, |
194 | LttvHooks *before_chunk_traceset, |
195 | LttvHooks *before_chunk_trace, |
196 | LttvHooks *before_chunk_tracefile, |
197 | LttvHooks *after_chunk_traceset, |
198 | LttvHooks *after_chunk_trace, |
199 | LttvHooks *after_chunk_tracefile, |
200 | LttvHooks *before_request, |
201 | LttvHooks *after_request, |
202 | LttvHooks *event_hook, |
203 | LttvHooksById *event_hook_by_id); |
204 | /** |
205 | * Unregister the background computation hooks for a specific module. |
206 | * |
207 | * It also removes all the requests than can be currently processed by the |
208 | * background computation algorithm for all the traces (list_in and list_out). |
209 | * |
210 | * @param module_name A GQuark : the name of the module which computes the |
211 | * information. |
212 | */ |
213 | |
214 | void lttvwindowtraces_unregister_computation_hooks |
215 | (LttvAttributeName module_name); |
216 | |
217 | |
218 | /** |
219 | * It removes all the requests than can be currently processed by the |
220 | * background computation algorithm for all the traces (list_in and list_out). |
221 | * |
222 | * Leaves the flag to in_progress or none.. depending if current or queue |
223 | * |
224 | * @param module_name A GQuark : the name of the module which computes the |
225 | * information. |
226 | */ |
227 | void lttvwindowtraces_unregister_requests(LttvAttributeName module_name); |
228 | |
229 | |
a1a2b649 |
230 | #endif //LTTVWINDOWTRACES_H |