1 /* This file is part of the Linux Trace Toolkit Graphic User Interface
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
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;
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.
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,
19 /* This file is the API used to launch any background computation on a trace */
21 #ifndef LTTVWINDOWTRACES_H
22 #define LTTVWINDOWTRACES_H
27 typedef GQuark LttvTraceInfo
;
29 extern LttvTraceInfo LTTV_TRACES
,
32 LTTV_REQUESTS_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
,
46 LTTV_EVENT_HOOK_BY_ID
,
54 /* Get a trace by its path name.
56 * @param path path of the trace on the virtual file system.
57 * @return Pointer to trace if found
58 * NULL is returned if the trace is not present
61 LttvTrace
*lttvwindowtraces_get_trace_by_name(gchar
*path
);
63 /* Get a trace by its number identifier */
65 LttvTrace
*lttvwindowtraces_get_trace(guint num
);
67 /* Total number of traces */
69 guint
lttvwindowtraces_get_number();
71 /* Add a trace to the global attributes */
73 void lttvwindowtraces_add_trace(LttvTrace
*trace
);
75 /* Remove a trace from the global attributes */
77 void lttvwindowtraces_remove_trace(LttvTrace
*trace
);
81 * Function to request data from a specific trace
83 * The memory allocated for the request will be managed by the API.
85 * @param trace the trace to compute
86 * @param module_name the name of the module which registered global computation
90 void lttvwindowtraces_background_request_queue
91 (LttvTrace
*trace
, gchar
*module_name
);
94 * Remove a background request from a trace.
96 * This should ONLY be used by the modules which registered the global hooks
97 * (module_name). If this is called by the viewers, it may lead to incomplete
98 * and incoherent background processing information.
100 * Even if the module which deals with the hooks removes the background
101 * requests, it may cause a problem if the module gets loaded again in the
102 * session : the data will be partially calculated. The calculation function
103 * must deal with this case correctly.
105 * @param trace the trace to compute
106 * @param module_name the name of the module which registered global computation
110 void lttvwindowtraces_background_request_remove
111 (LttvTrace
*trace
, gchar
*module_name
);
114 * Register a callback to be called when requested data is passed in the next
115 * queued background processing.
117 * @param owner owner of the background notification
118 * @param trace the trace computed
119 * @param notify_time time when notification hooks must be called
120 * @param notify_position position when notification hooks must be called
121 * @param notify Hook to call when the notify position is passed
124 void lttvwindowtraces_background_notify_queue
128 const LttvTracesetContextPosition
*notify_position
,
129 const LttvHooks
*notify
);
132 * Register a callback to be called when requested data is passed in the current
133 * background processing.
135 * @param owner owner of the background notification
136 * @param trace the trace computed
137 * @param notify_time time when notification hooks must be called
138 * @param notify_position position when notification hooks must be called
139 * @param notify Hook to call when the notify position is passed
142 void lttvwindowtraces_background_notify_current
146 const LttvTracesetContextPosition
*notify_position
,
147 const LttvHooks
*notify
);
150 * Removes all the notifications requests from a specific viewer.
152 * @param owner owner of the background notification
155 void lttvwindowtraces_background_notify_remove(gpointer owner
);
159 * Tells if the information computed by a module for a trace is ready.
161 * Must be checked before a background processing request.
163 * @param module_name A GQuark : the name of the module which computes the
165 * @param trace The trace for which the information is verified.
168 gboolean
lttvwindowtraces_get_ready(LttvAttributeName module_name
,
172 * Tells if the information computed by a module for a trace is being processed.
174 * Must be checked before a background processing request.
176 * If it is effectively processed, the typical thing to do is to call
177 * lttvwindowtraces_background_notify_current to be notified when the current
178 * processing will be over.
180 * @param module_name A GQuark : the name of the module which computes the
182 * @param trace The trace for which the information is verified.
185 gboolean
lttvwindowtraces_get_in_progress(LttvAttributeName module_name
,
189 * Register the background computation hooks for a specific module. It adds the
190 * computation hooks to the global attrubutes, under "computation/module name"
192 * @param module_name A GQuark : the name of the module which computes the
195 void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name
,
196 LttvHooks
*before_chunk_traceset
,
197 LttvHooks
*before_chunk_trace
,
198 LttvHooks
*before_chunk_tracefile
,
199 LttvHooks
*after_chunk_traceset
,
200 LttvHooks
*after_chunk_trace
,
201 LttvHooks
*after_chunk_tracefile
,
202 LttvHooks
*before_request
,
203 LttvHooks
*after_request
,
204 LttvHooks
*event_hook
,
205 LttvHooksById
*event_hook_by_id
,
206 LttvHooks
*hook_adder
,
207 LttvHooks
*hook_remover
);
209 * Unregister the background computation hooks for a specific module.
211 * It also removes all the requests than can be currently processed by the
212 * background computation algorithm for all the traces (list_in and list_out).
214 * @param module_name A GQuark : the name of the module which computes the
218 void lttvwindowtraces_unregister_computation_hooks
219 (LttvAttributeName module_name
);
223 * It removes all the requests than can be currently processed by the
224 * background computation algorithm for all the traces (list_in and list_out).
226 * Leaves the flag to in_progress or none.. depending if current or queue
228 * @param module_name A GQuark : the name of the module which computes the
231 void lttvwindowtraces_unregister_requests(LttvAttributeName module_name
);
234 #endif //LTTVWINDOWTRACES_H