enhancements and bugfixes
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / lttvwindowtraces.c
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/* Here is the implementation of the API */
22
0fdb8bb0 23#include <sys/types.h>
24#include <sys/stat.h>
25#include <unistd.h>
26
a1a2b649 27#include <ltt/time.h>
28#include <ltt/trace.h>
29#include <glib.h>
30#include <lttv/lttv.h>
31#include <lttv/traceset.h>
32#include <lttv/attribute.h>
33#include <lttv/tracecontext.h>
34#include <lttvwindow/lttvwindowtraces.h>
8bc02ec8 35#include <lttvwindow/lttvwindow.h> // for CHUNK_NUM_EVENTS
a1a2b649 36
37
38typedef struct _BackgroundRequest {
39 LttvAttributeName module_name; /* Hook path in global attributes,
40 where all standard hooks under computation/.
41 i.e. modulename */
42 LttvTrace *trace; /* trace concerned */
43} BackgroundRequest;
44
45typedef struct _BackgroundNotify {
46 gpointer owner;
47 LttvTrace *trace; /* trace */
48 LttTime notify_time;
49 LttvTracesetContextPosition *notify_position;
50 LttvHooks *notify; /* Hook to call when the notify is
51 passed, or at the end of trace */
52} BackgroundNotify;
53
54
55
313bd6fc 56/* Prototypes */
57gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace);
58
a1a2b649 59/* Get a trace by its path name.
60 *
61 * @param path path of the trace on the virtual file system.
62 * @return Pointer to trace if found
63 * NULL is returned if the trace is not present
64 */
65
66LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path)
67{
68 LttvAttribute *attribute = lttv_global_attributes();
69 guint i;
70
71 for(i=0;i<lttvwindowtraces_get_number();i++) {
72 LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
73 LttTrace *trace;
74 gchar *name;
a1a2b649 75 g_assert(trace_v != NULL);
76
77 trace = lttv_trace(trace_v);
78 g_assert(trace != NULL);
79 name = ltt_trace_name(trace);
80
81 if(strcmp(name, path) == 0) {
82 /* Found */
83 return trace_v;
84 }
85 }
86
87 return NULL;
88}
89
90/* Get a trace by its number identifier */
91
92LttvTrace *lttvwindowtraces_get_trace(guint num)
93{
94 LttvAttribute *g_attribute = lttv_global_attributes();
95 LttvAttribute *attribute;
96 LttvAttributeType type;
97 LttvAttributeName name;
98 LttvAttributeValue value;
99
100 g_assert(attribute =
101 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
102 LTTV_TRACES)));
103
104 type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), num, &name, &value);
105
106 if(type == LTTV_POINTER) {
107 return (LttvTrace *)*(value.v_pointer);
108 }
109
110 return NULL;
111}
112
113/* Total number of traces */
114
115guint lttvwindowtraces_get_number()
116{
117 LttvAttribute *g_attribute = lttv_global_attributes();
118 LttvAttribute *attribute;
119 LttvAttributeValue value;
120
121 g_assert(attribute =
122 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
123 LTTV_TRACES)));
124
125 return ( lttv_iattribute_get_number(LTTV_IATTRIBUTE(attribute)) );
126}
127
128/* Add a trace to the global attributes */
129
130void lttvwindowtraces_add_trace(LttvTrace *trace)
131{
132 LttvAttribute *g_attribute = lttv_global_attributes();
133 LttvAttribute *attribute;
134 LttvAttributeValue value;
135 guint num;
0fdb8bb0 136 struct stat buf;
137 gchar attribute_path[PATH_MAX];
a1a2b649 138
0fdb8bb0 139 if(stat(ltt_trace_name(lttv_trace(trace)), &buf)) {
140 g_warning("lttvwindowtraces_add_trace: Trace %s not found",
141 ltt_trace_name(lttv_trace(trace)));
142 return;
143 }
144 g_assert(
145 snprintf(attribute_path, PATH_MAX, "%lu:%lu", buf.st_dev, buf.st_ino) >= 0);
146
a1a2b649 147 g_assert(attribute =
148 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
149 LTTV_TRACES)));
0fdb8bb0 150
a1a2b649 151 value = lttv_attribute_add(attribute,
0fdb8bb0 152 g_quark_from_string(attribute_path),
a1a2b649 153 LTTV_POINTER);
154
155 *(value.v_pointer) = (gpointer)trace;
8bc02ec8 156
157 /* create new traceset and tracesetcontext */
158 LttvTraceset *ts;
313bd6fc 159 LttvTracesetStats *tss;
8bc02ec8 160
161 attribute = lttv_trace_attribute(trace);
162 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
163 LTTV_COMPUTATION_TRACESET,
164 LTTV_POINTER,
165 &value));
166 ts = lttv_traceset_new();
167 *(value.v_pointer) = ts;
168
169 lttv_traceset_add(ts,trace);
170
171 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
172 LTTV_COMPUTATION_TRACESET_CONTEXT,
173 LTTV_POINTER,
174 &value));
313bd6fc 175 tss = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
176 *(value.v_pointer) = tss;
8bc02ec8 177
313bd6fc 178 lttv_context_init(LTTV_TRACESET_CONTEXT(tss), ts);
8bc02ec8 179
180 value = lttv_attribute_add(attribute,
181 LTTV_REQUESTS_QUEUE,
182 LTTV_POINTER);
183
184 value = lttv_attribute_add(attribute,
185 LTTV_REQUESTS_CURRENT,
186 LTTV_POINTER);
187
188 value = lttv_attribute_add(attribute,
189 LTTV_NOTIFY_QUEUE,
190 LTTV_POINTER);
191
192 value = lttv_attribute_add(attribute,
193 LTTV_NOTIFY_CURRENT,
194 LTTV_POINTER);
195
a1a2b649 196}
197
198/* Remove a trace from the global attributes */
199
200void lttvwindowtraces_remove_trace(LttvTrace *trace)
201{
202 LttvAttribute *g_attribute = lttv_global_attributes();
203 LttvAttribute *attribute;
204 LttvAttributeValue value;
205 guint i;
206
207 g_assert(attribute =
208 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
209 LTTV_TRACES)));
210
211 for(i=0;i<lttvwindowtraces_get_number();i++) {
212 LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
213
214 g_assert(trace_v != NULL);
215
216 if(trace_v == trace) {
217 /* Found */
8bc02ec8 218 LttvAttribute *l_attribute;
219
220 /* create new traceset and tracesetcontext */
221 LttvTraceset *ts;
313bd6fc 222 LttvTracesetStats *tss;
8bc02ec8 223
224 l_attribute = lttv_trace_attribute(trace);
225
226
227 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
228 LTTV_REQUESTS_QUEUE);
229
230 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
231 LTTV_REQUESTS_CURRENT);
232
233 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
234 LTTV_NOTIFY_QUEUE);
235
236 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
237 LTTV_NOTIFY_CURRENT);
238
239 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(l_attribute),
240 LTTV_COMPUTATION_TRACESET,
241 LTTV_POINTER,
242 &value));
243 ts = (LttvTraceset*)*(value.v_pointer);
244
245 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(l_attribute),
246 LTTV_COMPUTATION_TRACESET_CONTEXT,
247 LTTV_POINTER,
248 &value));
313bd6fc 249 tss = (LttvTracesetStats*)*(value.v_pointer);
8bc02ec8 250
313bd6fc 251 lttv_context_fini(LTTV_TRACESET_CONTEXT(tss));
252 g_object_unref(tss);
8bc02ec8 253 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
254 LTTV_COMPUTATION_TRACESET_CONTEXT);
255 lttv_traceset_destroy(ts);
256 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
257 LTTV_COMPUTATION_TRACESET);
258
259 /* finally, remove the global attribute */
a1a2b649 260 lttv_attribute_remove(attribute, i);
8bc02ec8 261
a1a2b649 262 return;
263 }
264 }
265}
266
267
268/**
269 * Function to request data from a specific trace
270 *
271 * The memory allocated for the request will be managed by the API.
272 *
273 * @param trace the trace to compute
274 * @param module_name the name of the module which registered global computation
275 * hooks.
276 */
277
278void lttvwindowtraces_background_request_queue
279 (LttvTrace *trace, gchar *module_name)
280{
281 BackgroundRequest *bg_req;
282 LttvAttribute *attribute = lttv_trace_attribute(trace);
283 LttvAttributeValue value;
284 GSList **slist;
285 guint num;
286
287 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
288 LTTV_REQUESTS_QUEUE,
289 LTTV_POINTER,
290 &value));
291 slist = (GSList**)(value.v_pointer);
292
293 bg_req = g_new(BackgroundRequest,1);
294 bg_req->module_name = g_quark_from_string(module_name);
295 bg_req->trace = trace;
296
297 *slist = g_slist_append(*slist, bg_req);
313bd6fc 298
299 /* Priority lower than live servicing */
300 g_idle_remove_by_data(trace);
301 g_idle_add_full((G_PRIORITY_HIGH_IDLE + 23),
302 (GSourceFunc)lttvwindowtraces_process_pending_requests,
303 trace,
304 NULL);
a1a2b649 305}
306
307/**
308 * Remove a background request from a trace.
309 *
310 * This should ONLY be used by the modules which registered the global hooks
311 * (module_name). If this is called by the viewers, it may lead to incomplete
312 * and incoherent background processing information.
313 *
314 * Even if the module which deals with the hooks removes the background
315 * requests, it may cause a problem if the module gets loaded again in the
316 * session : the data will be partially calculated. The calculation function
317 * must deal with this case correctly.
318 *
319 * @param trace the trace to compute
320 * @param module_name the name of the module which registered global computation
321 * hooks.
322 */
323
324void lttvwindowtraces_background_request_remove
325 (LttvTrace *trace, gchar *module_name)
326{
327 LttvAttribute *attribute = lttv_trace_attribute(trace);
328 LttvAttributeValue value;
329 GSList *iter = NULL;
330 GSList **slist;
331
332 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
333 LTTV_REQUESTS_QUEUE,
334 LTTV_POINTER,
335 &value));
336 slist = (GSList**)(value.v_pointer);
337
338 for(iter=*slist;iter!=NULL;) {
339 BackgroundRequest *bg_req =
340 (BackgroundRequest *)iter->data;
341
342 if(bg_req->module_name == g_quark_from_string(module_name)) {
343 GSList *rem_iter = iter;
344 iter=g_slist_next(iter);
345 g_free(bg_req);
346 *slist = g_slist_delete_link(*slist, rem_iter);
347 } else {
348 iter=g_slist_next(iter);
349 }
350 }
351}
352
353
354/**
355 * Register a callback to be called when requested data is passed in the next
356 * queued background processing.
357 *
358 * @param owner owner of the background notification
359 * @param trace the trace computed
360 * @param notify_time time when notification hooks must be called
361 * @param notify_position position when notification hooks must be called
362 * @param notify Hook to call when the notify position is passed
363 */
364
365void lttvwindowtraces_background_notify_queue
366 (gpointer owner,
367 LttvTrace *trace,
368 LttTime notify_time,
369 const LttvTracesetContextPosition *notify_position,
370 const LttvHooks *notify)
371{
372 BackgroundNotify *bg_notify;
373 LttvAttribute *attribute = lttv_trace_attribute(trace);
374 LttvAttributeValue value;
375 GSList **slist;
376
377 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
378 LTTV_NOTIFY_QUEUE,
379 LTTV_POINTER,
380 &value));
381 slist = (GSList**)(value.v_pointer);
382
383
384 bg_notify = g_new(BackgroundNotify,1);
385
386 bg_notify->owner = owner;
387 bg_notify->trace = trace;
388 bg_notify->notify_time = notify_time;
313bd6fc 389 if(notify_position != NULL) {
390 bg_notify->notify_position = ltt_traceset_context_position_new();
391 lttv_traceset_context_position_copy(bg_notify->notify_position,
392 notify_position);
393 } else {
394 bg_notify->notify_position = NULL;
395 }
396
a1a2b649 397 bg_notify->notify = lttv_hooks_new();
398 lttv_hooks_add_list(bg_notify->notify, notify);
399
400 *slist = g_slist_append(*slist, bg_notify);
401}
402
403/**
404 * Register a callback to be called when requested data is passed in the current
405 * background processing.
406 *
407 * @param owner owner of the background notification
408 * @param trace the trace computed
409 * @param notify_time time when notification hooks must be called
410 * @param notify_position position when notification hooks must be called
411 * @param notify Hook to call when the notify position is passed
412 */
413
414void lttvwindowtraces_background_notify_current
415 (gpointer owner,
416 LttvTrace *trace,
417 LttTime notify_time,
418 const LttvTracesetContextPosition *notify_position,
419 const LttvHooks *notify)
420{
421 BackgroundNotify *bg_notify;
422 LttvAttribute *attribute = lttv_trace_attribute(trace);
423 LttvAttributeValue value;
424 GSList **slist;
425
426 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
427 LTTV_NOTIFY_CURRENT,
428 LTTV_POINTER,
429 &value));
430 slist = (GSList**)(value.v_pointer);
431
432 bg_notify = g_new(BackgroundNotify,1);
433
434 bg_notify->owner = owner;
435 bg_notify->trace = trace;
436 bg_notify->notify_time = notify_time;
313bd6fc 437 if(notify_position!= NULL) {
438 bg_notify->notify_position = ltt_traceset_context_position_new();
439 lttv_traceset_context_position_copy(bg_notify->notify_position,
440 notify_position);
441 } else {
442 bg_notify->notify_position = NULL;
443 }
a1a2b649 444 bg_notify->notify = lttv_hooks_new();
445 lttv_hooks_add_list(bg_notify->notify, notify);
446
447 *slist = g_slist_append(*slist, bg_notify);
448}
449
450/**
451 * Removes all the notifications requests from a specific viewer.
452 *
453 * @param owner owner of the background notification
454 */
455
456void lttvwindowtraces_background_notify_remove(gpointer owner)
457{
458 guint i;
459
460 for(i=0;i<lttvwindowtraces_get_number();i++) {
461 LttvAttribute *attribute;
462 LttvAttributeValue value;
463 LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
464 GSList **slist;
465 GSList *iter = NULL;
466
467 g_assert(trace_v != NULL);
468
469 LttvAttribute *t_a = lttv_trace_attribute(trace_v);
470
471 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
472 LTTV_NOTIFY_QUEUE,
473 LTTV_POINTER,
474 &value));
475 slist = (GSList**)(value.v_pointer);
476
477 for(iter=*slist;iter!=NULL;) {
478
479 BackgroundNotify *bg_notify = (BackgroundNotify*)iter->data;
480
481 if(bg_notify->owner == owner) {
482 GSList *rem_iter = iter;
483 iter=g_slist_next(iter);
313bd6fc 484 if(bg_notify->notify_position != NULL)
485 lttv_traceset_context_position_destroy(
486 bg_notify->notify_position);
a1a2b649 487 lttv_hooks_destroy(bg_notify->notify);
488 g_free(bg_notify);
489 g_slist_remove_link(*slist, rem_iter);
490 } else {
491 iter=g_slist_next(iter);
492 }
493 }
494
495 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
496 LTTV_NOTIFY_CURRENT,
497 LTTV_POINTER,
498 &value));
499 slist = (GSList**)(value.v_pointer);
500
501 for(iter=*slist;iter!=NULL;) {
502
503 BackgroundNotify *bg_notify = (BackgroundNotify*)iter->data;
504
505 if(bg_notify->owner == owner) {
506 GSList *rem_iter = iter;
507 iter=g_slist_next(iter);
313bd6fc 508 if(bg_notify->notify_position != NULL)
509 lttv_traceset_context_position_destroy(
510 bg_notify->notify_position);
a1a2b649 511 lttv_hooks_destroy(bg_notify->notify);
512 g_free(bg_notify);
513 g_slist_remove_link(*slist, rem_iter);
514 } else {
515 iter=g_slist_next(iter);
516 }
517 }
518 }
519}
520
8bc02ec8 521
522/* Background processing helper functions */
523
524void lttvwindowtraces_add_computation_hooks(LttvAttributeName module_name,
525 LttvTracesetContext *tsc)
526{
527 LttvAttribute *g_attribute = lttv_global_attributes();
528 LttvAttribute *module_attribute;
529 LttvAttributeType type;
530 LttvAttributeValue value;
531 LttvHooks *before_chunk_traceset=NULL;
532 LttvHooks *before_chunk_trace=NULL;
533 LttvHooks *before_chunk_tracefile=NULL;
534 LttvHooks *event_hook=NULL;
535 LttvHooksById *event_hook_by_id=NULL;
313bd6fc 536 LttvTracesetStats *tss = LTTV_TRACESET_STATS(tsc);
8bc02ec8 537
538
539 g_assert(module_attribute =
540 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
541 LTTV_COMPUTATION)));
542
543 g_assert(module_attribute =
544 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
545 LTTV_IATTRIBUTE(module_attribute),
546 module_name)));
547
548 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
549 LTTV_BEFORE_CHUNK_TRACESET,
550 &value);
551 if(type == LTTV_POINTER) {
552 before_chunk_traceset = (LttvHooks*)*(value.v_pointer);
553 }
554
555 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
556 LTTV_BEFORE_CHUNK_TRACE,
557 &value);
558 if(type == LTTV_POINTER) {
559 before_chunk_trace = (LttvHooks*)*(value.v_pointer);
560 }
561
562 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
563 LTTV_BEFORE_CHUNK_TRACEFILE,
564 &value);
565 if(type == LTTV_POINTER) {
566 before_chunk_tracefile = (LttvHooks*)*(value.v_pointer);
567 }
568
569 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
570 LTTV_EVENT_HOOK,
571 &value);
572 if(type == LTTV_POINTER) {
573 event_hook = (LttvHooks*)*(value.v_pointer);
574 }
575
576 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
577 LTTV_EVENT_HOOK_BY_ID,
578 &value);
579 if(type == LTTV_POINTER) {
580 event_hook_by_id = (LttvHooksById*)*(value.v_pointer);
581 }
582
313bd6fc 583 /* Call the module's hook adder */
584 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
585 LTTV_HOOK_ADDER,
586 &value);
587 if(type == LTTV_POINTER) {
588 lttv_hooks_call((LttvHooks*)*(value.v_pointer), (gpointer)tss);
589 }
590
591
8bc02ec8 592
593 lttv_process_traceset_begin(tsc,
594 before_chunk_traceset,
595 before_chunk_trace,
596 before_chunk_tracefile,
597 event_hook,
598 event_hook_by_id);
599
600}
601
602void lttvwindowtraces_remove_computation_hooks(LttvAttributeName module_name,
603 LttvTracesetContext *tsc)
604{
605 LttvAttribute *g_attribute = lttv_global_attributes();
606 LttvAttribute *module_attribute;
607 LttvAttributeType type;
608 LttvAttributeValue value;
609 LttvHooks *after_chunk_traceset=NULL;
610 LttvHooks *after_chunk_trace=NULL;
611 LttvHooks *after_chunk_tracefile=NULL;
612 LttvHooks *event_hook=NULL;
613 LttvHooksById *event_hook_by_id=NULL;
313bd6fc 614 LttvTracesetStats *tss = LTTV_TRACESET_STATS(tsc);
8bc02ec8 615
616 g_assert(module_attribute =
617 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
618 LTTV_COMPUTATION)));
619
620 g_assert(module_attribute =
621 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
622 LTTV_IATTRIBUTE(module_attribute),
623 module_name)));
624
625 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
626 LTTV_AFTER_CHUNK_TRACESET,
627 &value);
628 if(type == LTTV_POINTER) {
629 after_chunk_traceset = (LttvHooks*)*(value.v_pointer);
630 }
631
632 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
633 LTTV_AFTER_CHUNK_TRACE,
634 &value);
635 if(type == LTTV_POINTER) {
636 after_chunk_trace = (LttvHooks*)*(value.v_pointer);
637 }
638
639 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
640 LTTV_AFTER_CHUNK_TRACEFILE,
641 &value);
642 if(type == LTTV_POINTER) {
643 after_chunk_tracefile = (LttvHooks*)*(value.v_pointer);
644 }
645
646 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
647 LTTV_EVENT_HOOK,
648 &value);
649 if(type == LTTV_POINTER) {
650 event_hook = (LttvHooks*)*(value.v_pointer);
651 }
652
653 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
654 LTTV_EVENT_HOOK_BY_ID,
655 &value);
656 if(type == LTTV_POINTER) {
657 event_hook_by_id = (LttvHooksById*)*(value.v_pointer);
658 }
313bd6fc 659
8bc02ec8 660 lttv_process_traceset_end(tsc,
661 after_chunk_traceset,
662 after_chunk_trace,
663 after_chunk_tracefile,
664 event_hook,
665 event_hook_by_id);
313bd6fc 666
667 /* Call the module's hook remover */
668 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
669 LTTV_HOOK_REMOVER,
670 &value);
671 if(type == LTTV_POINTER) {
672 lttv_hooks_call((LttvHooks*)*(value.v_pointer), (gpointer)tss);
673 }
8bc02ec8 674}
675
676
677void lttvwindowtraces_set_in_progress(LttvAttributeName module_name,
678 LttvTrace *trace)
679{
680 LttvAttribute *attribute = lttv_trace_attribute(trace);
681 LttvAttributeValue value;
682
683 g_assert(attribute =
684 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
685 module_name)));
686
687 value = lttv_iattribute_add(LTTV_IATTRIBUTE(attribute),
688 LTTV_IN_PROGRESS,
689 LTTV_INT);
690 /* the value is left unset. The only presence of the attribute is necessary.
691 */
692}
693
694void lttvwindowtraces_unset_in_progress(LttvAttributeName module_name,
695 LttvTrace *trace)
696{
697 LttvAttribute *attribute = lttv_trace_attribute(trace);
698
699 g_assert(attribute =
700 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
701 module_name)));
702
313bd6fc 703 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
8bc02ec8 704 LTTV_IN_PROGRESS);
705}
706
707gboolean lttvwindowtraces_get_in_progress(LttvAttributeName module_name,
708 LttvTrace *trace)
709{
710 LttvAttribute *attribute = lttv_trace_attribute(trace);
711 LttvAttributeType type;
712 LttvAttributeValue value;
713
714 g_assert(attribute =
715 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
716 module_name)));
717
718 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
719 LTTV_IN_PROGRESS,
720 &value);
721 /* The only presence of the attribute is necessary. */
722 if(type == LTTV_NONE)
723 return FALSE;
724 else
725 return TRUE;
726}
727
728void lttvwindowtraces_set_ready(LttvAttributeName module_name,
729 LttvTrace *trace)
730{
731 LttvAttribute *attribute = lttv_trace_attribute(trace);
732 LttvAttributeValue value;
733
734 g_assert(attribute =
735 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
736 module_name)));
737
738 value = lttv_iattribute_add(LTTV_IATTRIBUTE(attribute),
739 LTTV_READY,
740 LTTV_INT);
741 /* the value is left unset. The only presence of the attribute is necessary.
742 */
743}
744
745void lttvwindowtraces_unset_ready(LttvAttributeName module_name,
746 LttvTrace *trace)
747{
748 LttvAttribute *attribute = lttv_trace_attribute(trace);
749
750 g_assert(attribute =
751 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
752 module_name)));
753
313bd6fc 754 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
8bc02ec8 755 LTTV_READY);
756}
757
758gboolean lttvwindowtraces_get_ready(LttvAttributeName module_name,
759 LttvTrace *trace)
760{
761 LttvAttribute *attribute = lttv_trace_attribute(trace);
762 LttvAttributeType type;
763 LttvAttributeValue value;
764
765 g_assert(attribute =
766 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
767 module_name)));
768
769 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
770 LTTV_READY,
771 &value);
772 /* The only presence of the attribute is necessary. */
773 if(type == LTTV_NONE)
774 return FALSE;
775 else
776 return TRUE;
777}
778
779
780
781/* lttvwindowtraces_process_pending_requests
782 *
783 * This internal function gets called by g_idle, taking care of the pending
784 * requests.
785 *
786 */
787
788
789gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
790{
791 LttvTracesetContext *tsc;
313bd6fc 792 LttvTracesetStats *tss;
8bc02ec8 793 LttvTraceset *ts;
794 LttvAttribute *attribute;
313bd6fc 795 GSList **list_out, **list_in, **notify_in, **notify_out;
8bc02ec8 796 LttvAttributeValue value;
797 LttvAttributeType type;
798
313bd6fc 799 if(trace == NULL)
8bc02ec8 800 return FALSE;
801
802 attribute = lttv_trace_attribute(trace);
803
804 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
805 LTTV_REQUESTS_QUEUE,
806 &value);
807 g_assert(type == LTTV_POINTER);
313bd6fc 808 list_out = (GSList**)(value.v_pointer);
8bc02ec8 809
810 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
811 LTTV_REQUESTS_CURRENT,
812 &value);
813 g_assert(type == LTTV_POINTER);
313bd6fc 814 list_in = (GSList**)(value.v_pointer);
8bc02ec8 815
816 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
817 LTTV_NOTIFY_QUEUE,
818 &value);
819 g_assert(type == LTTV_POINTER);
313bd6fc 820 notify_out = (GSList**)(value.v_pointer);
8bc02ec8 821
822 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
823 LTTV_NOTIFY_CURRENT,
824 &value);
825 g_assert(type == LTTV_POINTER);
313bd6fc 826 notify_in = (GSList**)(value.v_pointer);
8bc02ec8 827
828 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
829 LTTV_COMPUTATION_TRACESET,
830 &value);
831 g_assert(type == LTTV_POINTER);
832 ts = (LttvTraceset*)*(value.v_pointer);
833
834 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
835 LTTV_COMPUTATION_TRACESET_CONTEXT,
836 &value);
837 g_assert(type == LTTV_POINTER);
838 tsc = (LttvTracesetContext*)*(value.v_pointer);
313bd6fc 839 tss = (LttvTracesetStats*)*(value.v_pointer);
8bc02ec8 840 g_assert(LTTV_IS_TRACESET_CONTEXT(tsc));
313bd6fc 841 g_assert(LTTV_IS_TRACESET_STATS(tss));
8bc02ec8 842
843 /* There is no events requests pending : we should never have been called! */
313bd6fc 844 g_assert(g_slist_length(*list_out) != 0 || g_slist_length(*list_in) != 0);
8bc02ec8 845
846
847
848 /* 1. Before processing */
849 {
850 /* if list_in is empty */
313bd6fc 851 if(g_slist_length(*list_in) == 0) {
8bc02ec8 852
853 {
854 /* - Add all requests in list_out to list_in, empty list_out */
313bd6fc 855 GSList *iter = *list_out;
8bc02ec8 856
857 while(iter != NULL) {
858 gboolean remove = FALSE;
859 gboolean free_data = FALSE;
860
861 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
862
863 remove = TRUE;
864 free_data = FALSE;
313bd6fc 865 *list_in = g_slist_append(*list_in, bg_req);
8bc02ec8 866
867 /* Go to next */
868 if(remove)
869 {
870 GSList *remove_iter = iter;
871
872 iter = g_slist_next(iter);
873 if(free_data) g_free(remove_iter->data);
313bd6fc 874 *list_out = g_slist_remove_link(*list_out, remove_iter);
8bc02ec8 875 } else { // not remove
876 iter = g_slist_next(iter);
877 }
878 }
879 }
880
881 {
313bd6fc 882 GSList *iter = *list_in;
8bc02ec8 883 /* - for each request in list_in */
884 while(iter != NULL) {
885
886 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
887 /*- add hooks to context*/
888 lttvwindowtraces_set_in_progress(bg_req->module_name,
889 bg_req->trace);
890
891 iter = g_slist_next(iter);
892 }
893 }
894
895 /* - seek trace to start */
896 {
897 LttTime start = { 0, 0};
898 lttv_process_traceset_seek_time(tsc, start);
899 }
900
901 /* - Move all notifications from notify_out to notify_in. */
902 {
313bd6fc 903 GSList *iter = *notify_out;
904 g_assert(g_slist_length(*notify_in) == 0);
8bc02ec8 905
906 while(iter != NULL) {
907 gboolean remove = FALSE;
908 gboolean free_data = FALSE;
909
910 BackgroundNotify *notify_req = (BackgroundNotify*)iter->data;
911
912 remove = TRUE;
913 free_data = FALSE;
313bd6fc 914 *notify_in = g_slist_append(*notify_in, notify_req);
8bc02ec8 915
916 /* Go to next */
917 if(remove)
918 {
919 GSList *remove_iter = iter;
920
921 iter = g_slist_next(iter);
922 if(free_data) g_free(remove_iter->data);
313bd6fc 923 *notify_out = g_slist_remove_link(*notify_out, remove_iter);
8bc02ec8 924 } else { // not remove
925 iter = g_slist_next(iter);
926 }
927 }
928 }
929 }
930
931 {
313bd6fc 932 GSList *iter = *list_in;
8bc02ec8 933 /* - for each request in list_in */
934 while(iter != NULL) {
935
936 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
937 /*- Call before chunk hooks for list_in*/
938 /*- add hooks to context*/
939 lttvwindowtraces_add_computation_hooks(bg_req->module_name,
940 tsc);
941 iter = g_slist_next(iter);
942 }
943 }
944 }
945
946 /* 2. call process traceset middle for a chunk */
947 {
948 /*(assert list_in is not empty! : should not even be called in that case)*/
949 LttTime end = { G_MAXUINT, G_MAXUINT };
313bd6fc 950 g_assert(g_slist_length(*list_in) != 0);
8bc02ec8 951
952 lttv_process_traceset_middle(tsc, end, CHUNK_NUM_EVENTS, NULL);
953 }
954
955 /* 3. After the chunk */
956 {
957 /* 3.1 call after_chunk hooks for list_in */
958 {
313bd6fc 959 GSList *iter = *list_in;
8bc02ec8 960 /* - for each request in list_in */
961 while(iter != NULL) {
962
963 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
964 /* - Call after chunk hooks for list_in */
965 /* - remove hooks from context */
966 lttvwindowtraces_remove_computation_hooks(bg_req->module_name,
967 tsc);
968 iter = g_slist_next(iter);
969 }
970 }
971
972 /* 3.2 for each notify_in */
973 {
313bd6fc 974 GSList *iter = *notify_in;
8bc02ec8 975 LttvTracefileContext *tfc = lttv_traceset_context_get_current_tfc(tsc);
976
977 while(iter != NULL) {
978 gboolean remove = FALSE;
979 gboolean free_data = FALSE;
980
981 BackgroundNotify *notify_req = (BackgroundNotify*)iter->data;
982
983 /* - if current time >= notify time, call notify and remove from
984 * notify_in.
985 * - if current position >= notify position, call notify and remove
986 * from notify_in.
987 */
988 if( (tfc != NULL &&
313bd6fc 989 ltt_time_compare(notify_req->notify_time, tfc->timestamp) <= 0)
8bc02ec8 990 ||
313bd6fc 991 (notify_req->notify_position != NULL &&
992 lttv_traceset_context_ctx_pos_compare(tsc,
993 notify_req->notify_position) >= 0)
8bc02ec8 994 ) {
995
996 lttv_hooks_call(notify_req->notify, notify_req);
997
998 remove = TRUE;
999 free_data = TRUE;
1000 }
1001
1002 /* Go to next */
1003 if(remove)
1004 {
1005 GSList *remove_iter = iter;
1006
1007 iter = g_slist_next(iter);
1008 if(free_data) g_free(remove_iter->data);
313bd6fc 1009 *notify_in = g_slist_remove_link(*notify_in, remove_iter);
8bc02ec8 1010 } else { // not remove
1011 iter = g_slist_next(iter);
1012 }
1013 }
1014 }
1015
1016 {
1017 LttvTracefileContext *tfc = lttv_traceset_context_get_current_tfc(tsc);
1018 /* 3.3 if end of trace reached */
313bd6fc 1019 if(tfc != NULL)
1020 g_debug("Current time : %lu sec, %lu nsec",
1021 tfc->timestamp.tv_sec, tfc->timestamp.tv_nsec);
8bc02ec8 1022 if(tfc == NULL || ltt_time_compare(tfc->timestamp,
1023 tsc->time_span.end_time) > 0) {
1024
1025 /* - for each request in list_in */
1026 {
313bd6fc 1027 GSList *iter = *list_in;
8bc02ec8 1028
1029 while(iter != NULL) {
1030 gboolean remove = FALSE;
1031 gboolean free_data = FALSE;
1032
1033 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
1034
1035 /* - set hooks'in_progress flag to FALSE */
1036 lttvwindowtraces_unset_in_progress(bg_req->module_name,
1037 bg_req->trace);
1038 /* - set hooks'ready flag to TRUE */
1039 lttvwindowtraces_set_ready(bg_req->module_name,
1040 bg_req->trace);
1041 /* - remove request */
1042 remove = TRUE;
1043 free_data = TRUE;
1044
1045 /* Go to next */
1046 if(remove)
1047 {
1048 GSList *remove_iter = iter;
1049
1050 iter = g_slist_next(iter);
1051 if(free_data) g_free(remove_iter->data);
313bd6fc 1052 *list_in = g_slist_remove_link(*list_in, remove_iter);
8bc02ec8 1053 } else { // not remove
1054 iter = g_slist_next(iter);
1055 }
1056 }
1057 }
1058
1059 /* - for each notifications in notify_in */
1060 {
313bd6fc 1061 GSList *iter = *notify_in;
8bc02ec8 1062
1063 while(iter != NULL) {
1064 gboolean remove = FALSE;
1065 gboolean free_data = FALSE;
1066
1067 BackgroundNotify *notify_req = (BackgroundNotify*)iter->data;
1068
1069 /* - call notify and remove from notify_in */
1070 lttv_hooks_call(notify_req->notify, notify_req);
1071 remove = TRUE;
1072 free_data = TRUE;
1073
1074 /* Go to next */
1075 if(remove)
1076 {
1077 GSList *remove_iter = iter;
1078
1079 iter = g_slist_next(iter);
1080 if(free_data) g_free(remove_iter->data);
313bd6fc 1081 *notify_in = g_slist_remove_link(*notify_in, remove_iter);
8bc02ec8 1082 } else { // not remove
1083 iter = g_slist_next(iter);
1084 }
1085 }
1086 }
1087
1088 /* - return FALSE (scheduler stopped) */
313bd6fc 1089 g_debug("Background computation scheduler stopped");
8bc02ec8 1090 return FALSE;
1091 } else {
1092 /* 3.4 else, end of trace not reached */
1093 /* - return TRUE (scheduler still registered) */
313bd6fc 1094 g_debug("Background computation left");
8bc02ec8 1095 return TRUE;
1096 }
1097 }
1098 }
1099}
e62a7964 1100
1101
1102
1103/**
1104 * Register the background computation hooks for a specific module. It adds the
313bd6fc 1105 * computation hooks to the global attrubutes, under "computation/module name".
e62a7964 1106 *
1107 * @param module_name A GQuark : the name of the module which computes the
1108 * information.
1109 */
1110void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name,
1111 LttvHooks *before_chunk_traceset,
1112 LttvHooks *before_chunk_trace,
1113 LttvHooks *before_chunk_tracefile,
1114 LttvHooks *after_chunk_traceset,
1115 LttvHooks *after_chunk_trace,
1116 LttvHooks *after_chunk_tracefile,
1117 LttvHooks *before_request,
1118 LttvHooks *after_request,
1119 LttvHooks *event_hook,
313bd6fc 1120 LttvHooksById *event_hook_by_id,
1121 LttvHooks *hook_adder,
1122 LttvHooks *hook_remover)
e62a7964 1123{
1124 LttvAttribute *g_attribute = lttv_global_attributes();
1125 LttvAttribute *attribute;
1126 LttvAttributeValue value;
1127
1128 g_assert(attribute =
1129 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
1130 LTTV_COMPUTATION)));
1131
1132 g_assert(attribute =
1133 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
1134 module_name)));
1135
1136 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1137 LTTV_BEFORE_CHUNK_TRACESET,
1138 LTTV_POINTER,
1139 &value));
1140 *(value.v_pointer) = before_chunk_traceset;
1141
1142 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1143 LTTV_BEFORE_CHUNK_TRACE,
1144 LTTV_POINTER,
1145 &value));
1146 *(value.v_pointer) = before_chunk_trace;
1147
1148 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1149 LTTV_BEFORE_CHUNK_TRACEFILE,
1150 LTTV_POINTER,
1151 &value));
1152 *(value.v_pointer) = before_chunk_tracefile;
1153
1154 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1155 LTTV_AFTER_CHUNK_TRACESET,
1156 LTTV_POINTER,
1157 &value));
1158 *(value.v_pointer) = after_chunk_traceset;
1159
1160 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1161 LTTV_AFTER_CHUNK_TRACE,
1162 LTTV_POINTER,
1163 &value));
1164 *(value.v_pointer) = after_chunk_trace;
1165
1166 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1167 LTTV_AFTER_CHUNK_TRACEFILE,
1168 LTTV_POINTER,
1169 &value));
1170 *(value.v_pointer) = after_chunk_tracefile;
1171
1172 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1173 LTTV_BEFORE_REQUEST,
1174 LTTV_POINTER,
1175 &value));
1176 *(value.v_pointer) = before_request;
1177
1178 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1179 LTTV_AFTER_REQUEST,
1180 LTTV_POINTER,
1181 &value));
1182 *(value.v_pointer) = after_request;
1183
1184 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1185 LTTV_EVENT_HOOK,
1186 LTTV_POINTER,
1187 &value));
1188 *(value.v_pointer) = event_hook;
1189
1190 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1191 LTTV_EVENT_HOOK_BY_ID,
1192 LTTV_POINTER,
1193 &value));
1194 *(value.v_pointer) = event_hook_by_id;
1195
313bd6fc 1196 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1197 LTTV_HOOK_ADDER,
1198 LTTV_POINTER,
1199 &value));
1200 *(value.v_pointer) = hook_adder;
1201
1202 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1203 LTTV_HOOK_REMOVER,
1204 LTTV_POINTER,
1205 &value));
1206 *(value.v_pointer) = hook_remover;
1207
e62a7964 1208}
1209
1210
1211/**
1212 * It removes all the requests than can be currently processed by the
1213 * background computation algorithm for all the traces (list_in and list_out).
1214 *
1215 * Leaves the flag to in_progress or none.. depending if current or queue
1216 *
1217 * @param module_name A GQuark : the name of the module which computes the
1218 * information.
1219 */
1220void lttvwindowtraces_unregister_requests(LttvAttributeName module_name)
1221{
1222 guint i;
1223
1224 for(i=0;i<lttvwindowtraces_get_number();i++) {
1225 LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
1226 g_assert(trace_v != NULL);
1227 LttTrace *trace;
1228 LttvAttribute *attribute = lttv_trace_attribute(trace_v);
1229 LttvAttributeValue value;
313bd6fc 1230 GSList **queue, **current;
e62a7964 1231 GSList *iter;
1232
1233 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1234 LTTV_REQUESTS_QUEUE,
1235 LTTV_POINTER,
1236 &value));
313bd6fc 1237 queue = (GSList**)(value.v_pointer);
e62a7964 1238
313bd6fc 1239 iter = *queue;
e62a7964 1240 while(iter != NULL) {
1241 gboolean remove = FALSE;
1242 gboolean free_data = FALSE;
1243
1244 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
1245
1246 if(bg_req->module_name == module_name) {
1247 remove = TRUE;
1248 free_data = TRUE;
1249 }
1250
1251 /* Go to next */
1252 if(remove)
1253 {
1254 GSList *remove_iter = iter;
1255
1256 iter = g_slist_next(iter);
1257 if(free_data) g_free(remove_iter->data);
313bd6fc 1258 *queue = g_slist_remove_link(*queue, remove_iter);
e62a7964 1259 } else { // not remove
1260 iter = g_slist_next(iter);
1261 }
1262 }
1263
1264
1265 g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
1266 LTTV_REQUESTS_CURRENT,
1267 LTTV_POINTER,
1268 &value));
313bd6fc 1269 current = (GSList**)(value.v_pointer);
e62a7964 1270
313bd6fc 1271 iter = *current;
e62a7964 1272 while(iter != NULL) {
1273 gboolean remove = FALSE;
1274 gboolean free_data = FALSE;
1275
1276 BackgroundRequest *bg_req = (BackgroundRequest*)iter->data;
1277
1278 if(bg_req->module_name == module_name) {
1279 remove = TRUE;
1280 free_data = TRUE;
1281 }
1282
1283 /* Go to next */
1284 if(remove)
1285 {
1286 GSList *remove_iter = iter;
1287
1288 iter = g_slist_next(iter);
1289 if(free_data) g_free(remove_iter->data);
313bd6fc 1290 *current = g_slist_remove_link(*current, remove_iter);
e62a7964 1291 } else { // not remove
1292 iter = g_slist_next(iter);
1293 }
1294 }
1295 }
1296}
1297
1298
1299/**
1300 * Unregister the background computation hooks for a specific module.
1301 *
1302 * It also removes all the requests than can be currently processed by the
1303 * background computation algorithm for all the traces (list_in and list_out).
1304 *
1305 * @param module_name A GQuark : the name of the module which computes the
1306 * information.
1307 */
1308
1309void lttvwindowtraces_unregister_computation_hooks
1310 (LttvAttributeName module_name)
1311{
1312 LttvAttribute *g_attribute = lttv_global_attributes();
1313 LttvAttribute *attribute;
1314
1315 g_assert(attribute =
1316 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
1317 LTTV_COMPUTATION)));
1318 g_assert(attribute =
1319 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(attribute),
1320 module_name)));
1321
1322
1323 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1324 LTTV_EVENT_HOOK_BY_ID);
1325 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1326 LTTV_EVENT_HOOK);
1327
1328 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1329 LTTV_AFTER_REQUEST);
1330 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1331 LTTV_BEFORE_REQUEST);
1332
1333 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1334 LTTV_AFTER_CHUNK_TRACEFILE);
1335 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1336 LTTV_AFTER_CHUNK_TRACE);
1337 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1338 LTTV_AFTER_CHUNK_TRACESET);
1339
1340 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1341 LTTV_BEFORE_CHUNK_TRACEFILE);
1342 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1343 LTTV_BEFORE_CHUNK_TRACE);
1344 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1345 LTTV_BEFORE_CHUNK_TRACESET);
313bd6fc 1346 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1347 LTTV_HOOK_ADDER);
1348 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1349 LTTV_HOOK_REMOVER);
1350
e62a7964 1351 /* finally, remove module name */
1352 g_assert(attribute =
1353 LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
1354 LTTV_COMPUTATION)));
1355 lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
1356 module_name);
1357
1358}
1359
1360
This page took 0.075641 seconds and 4 git commands to generate.