enhancements and bugfixes
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / lttvwindowtraces.h
CommitLineData
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
27typedef GQuark LttvTraceInfo;
28
29extern 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,
313bd6fc 47 LTTV_HOOK_ADDER,
48 LTTV_HOOK_REMOVER,
8bc02ec8 49 LTTV_IN_PROGRESS,
50 LTTV_READY;
51
52
a1a2b649 53
54/* Get a trace by its path name.
55 *
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
59 */
60
61LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path);
62
63/* Get a trace by its number identifier */
64
65LttvTrace *lttvwindowtraces_get_trace(guint num);
66
67/* Total number of traces */
68
69guint lttvwindowtraces_get_number();
70
71/* Add a trace to the global attributes */
72
73void lttvwindowtraces_add_trace(LttvTrace *trace);
74
75/* Remove a trace from the global attributes */
76
77void lttvwindowtraces_remove_trace(LttvTrace *trace);
78
79
80/**
81 * Function to request data from a specific trace
82 *
83 * The memory allocated for the request will be managed by the API.
84 *
85 * @param trace the trace to compute
86 * @param module_name the name of the module which registered global computation
87 * hooks.
88 */
89
90void lttvwindowtraces_background_request_queue
91 (LttvTrace *trace, gchar *module_name);
92
93/**
94 * Remove a background request from a trace.
95 *
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.
99 *
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.
104 *
105 * @param trace the trace to compute
106 * @param module_name the name of the module which registered global computation
107 * hooks.
108 */
109
110void lttvwindowtraces_background_request_remove
111 (LttvTrace *trace, gchar *module_name);
112
113/**
114 * Register a callback to be called when requested data is passed in the next
115 * queued background processing.
116 *
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
122 */
123
124void lttvwindowtraces_background_notify_queue
125 (gpointer owner,
126 LttvTrace *trace,
127 LttTime notify_time,
128 const LttvTracesetContextPosition *notify_position,
129 const LttvHooks *notify);
130
131/**
132 * Register a callback to be called when requested data is passed in the current
133 * background processing.
134 *
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
140 */
141
142void lttvwindowtraces_background_notify_current
143 (gpointer owner,
144 LttvTrace *trace,
145 LttTime notify_time,
146 const LttvTracesetContextPosition *notify_position,
147 const LttvHooks *notify);
148
149/**
150 * Removes all the notifications requests from a specific viewer.
151 *
152 * @param owner owner of the background notification
153 */
154
155void lttvwindowtraces_background_notify_remove(gpointer owner);
156
157
e62a7964 158/**
159 * Tells if the information computed by a module for a trace is ready.
160 *
161 * Must be checked before a background processing request.
162 *
163 * @param module_name A GQuark : the name of the module which computes the
164 * information.
165 * @param trace The trace for which the information is verified.
166 */
167
168gboolean lttvwindowtraces_get_ready(LttvAttributeName module_name,
169 LttvTrace *trace);
170
171/**
172 * Tells if the information computed by a module for a trace is being processed.
173 *
174 * Must be checked before a background processing request.
175 *
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.
179 *
180 * @param module_name A GQuark : the name of the module which computes the
181 * information.
182 * @param trace The trace for which the information is verified.
183 */
184
185gboolean lttvwindowtraces_get_in_progress(LttvAttributeName module_name,
186 LttvTrace *trace);
187
188/**
189 * Register the background computation hooks for a specific module. It adds the
190 * computation hooks to the global attrubutes, under "computation/module name"
191 *
192 * @param module_name A GQuark : the name of the module which computes the
193 * information.
194 */
195void 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,
313bd6fc 205 LttvHooksById *event_hook_by_id,
206 LttvHooks *hook_adder,
207 LttvHooks *hook_remover);
e62a7964 208/**
209 * Unregister the background computation hooks for a specific module.
210 *
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).
213 *
214 * @param module_name A GQuark : the name of the module which computes the
215 * information.
216 */
217
218void lttvwindowtraces_unregister_computation_hooks
219 (LttvAttributeName module_name);
220
221
222/**
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).
225 *
226 * Leaves the flag to in_progress or none.. depending if current or queue
227 *
228 * @param module_name A GQuark : the name of the module which computes the
229 * information.
230 */
231void lttvwindowtraces_unregister_requests(LttvAttributeName module_name);
232
233
a1a2b649 234#endif //LTTVWINDOWTRACES_H
This page took 0.030827 seconds and 4 git commands to generate.