Commit | Line | Data |
---|---|---|
70407e86 BP |
1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca> | |
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 | #ifdef HAVE_CONFIG_H | |
20 | #include <config.h> | |
21 | #endif | |
22 | ||
2f076594 | 23 | #include <stdarg.h> |
70407e86 BP |
24 | #include <stdlib.h> |
25 | ||
2bd4b3e4 | 26 | #include "sync_chain.h" |
10341d26 | 27 | #include "event_processing_lttng_common.h" |
70407e86 | 28 | |
10341d26 | 29 | #include "event_processing_lttng_null.h" |
70407e86 BP |
30 | |
31 | ||
08365995 | 32 | // Functions common to all processing modules |
2f076594 | 33 | static void initProcessingLTTVNull(SyncState* const syncState, ...); |
70407e86 BP |
34 | static void destroyProcessingLTTVNull(SyncState* const syncState); |
35 | ||
36 | static void finalizeProcessingLTTVNull(SyncState* const syncState); | |
37 | ||
38 | // Functions specific to this module | |
70407e86 BP |
39 | static gboolean processEventLTTVNull(void* hookData, void* callData); |
40 | ||
41 | ||
42 | static ProcessingModule processingModuleLTTVNull = { | |
43 | .name= "LTTV-null", | |
44 | .initProcessing= &initProcessingLTTVNull, | |
45 | .destroyProcessing= &destroyProcessingLTTVNull, | |
46 | .finalizeProcessing= &finalizeProcessingLTTVNull, | |
70407e86 BP |
47 | }; |
48 | ||
49 | ||
50 | ||
51 | /* | |
52 | * Processing Module registering function | |
53 | */ | |
2f961b65 | 54 | void registerProcessingLTTVNull() |
70407e86 BP |
55 | { |
56 | g_queue_push_tail(&processingModules, &processingModuleLTTVNull); | |
57 | ||
58 | createQuarks(); | |
59 | } | |
60 | ||
61 | ||
62 | /* | |
63 | * Allocate and initialize data structures for synchronizing a traceset. | |
64 | * Register event hooks. | |
65 | * | |
66 | * Args: | |
67 | * syncState: container for synchronization data. | |
68 | * This function allocates these processingData members: | |
69 | * hookListList | |
2f076594 | 70 | * traceSetContext: LttvTracesetContext*, set of LTTV traces |
70407e86 | 71 | */ |
2f076594 | 72 | static void initProcessingLTTVNull(SyncState* const syncState, ...) |
70407e86 BP |
73 | { |
74 | ProcessingDataLTTVNull* processingData; | |
2f076594 | 75 | va_list ap; |
70407e86 BP |
76 | |
77 | processingData= malloc(sizeof(ProcessingDataLTTVNull)); | |
78 | syncState->processingData= processingData; | |
09857093 BP |
79 | va_start(ap, syncState); |
80 | processingData->traceSetContext= va_arg(ap, LttvTracesetContext*); | |
81 | va_end(ap); | |
82 | syncState->traceNb= | |
83 | lttv_traceset_number(processingData->traceSetContext->ts); | |
70407e86 BP |
84 | processingData->hookListList= g_array_sized_new(FALSE, FALSE, |
85 | sizeof(GArray*), syncState->traceNb); | |
86 | ||
09857093 BP |
87 | registerHooks(processingData->hookListList, |
88 | processingData->traceSetContext, &processEventLTTVNull, syncState, | |
f6691532 | 89 | syncState->matchingModule->canMatch); |
70407e86 BP |
90 | } |
91 | ||
92 | ||
93 | /* | |
94 | * Nothing to do | |
95 | * | |
96 | * Args: | |
97 | * syncState container for synchronization data. | |
98 | */ | |
99 | static void finalizeProcessingLTTVNull(SyncState* const syncState) | |
100 | { | |
101 | return; | |
102 | } | |
103 | ||
104 | ||
105 | /* | |
106 | * Unregister event hooks. Deallocate processingData. | |
107 | * | |
108 | * Args: | |
109 | * syncState: container for synchronization data. | |
110 | * This function deallocates these members: | |
111 | * hookListList | |
112 | */ | |
113 | static void destroyProcessingLTTVNull(SyncState* const syncState) | |
114 | { | |
115 | ProcessingDataLTTVNull* processingData; | |
116 | ||
117 | processingData= (ProcessingDataLTTVNull*) syncState->processingData; | |
118 | ||
119 | if (processingData == NULL) | |
120 | { | |
121 | return; | |
122 | } | |
123 | ||
124 | unregisterHooks(processingData->hookListList, | |
08365995 | 125 | processingData->traceSetContext); |
70407e86 BP |
126 | |
127 | free(syncState->processingData); | |
128 | syncState->processingData= NULL; | |
129 | } | |
130 | ||
131 | ||
132 | /* | |
133 | * Lttv hook function that will be called for network events | |
134 | * | |
135 | * Args: | |
136 | * hookData: LttvTraceHook* for the type of event that generated the call | |
137 | * callData: LttvTracefileContext* at the moment of the event | |
138 | * | |
139 | * Returns: | |
140 | * FALSE Always returns FALSE, meaning to keep processing hooks for | |
141 | * this event | |
142 | */ | |
143 | static gboolean processEventLTTVNull(void* hookData, void* callData) | |
144 | { | |
145 | return FALSE; | |
146 | } |