Commit | Line | Data |
---|---|---|
70407e86 | 1 | /* This file is part of the Linux Trace Toolkit viewer |
277e5b53 | 2 | * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca> |
70407e86 | 3 | * |
277e5b53 BP |
4 | * This program is free software: you can redistribute it and/or modify it |
5 | * under the terms of the GNU Lesser General Public License as published by | |
6 | * the Free Software Foundation, either version 2.1 of the License, or (at | |
7 | * your option) any later version. | |
70407e86 | 8 | * |
277e5b53 BP |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | |
12 | * License for more details. | |
70407e86 | 13 | * |
277e5b53 BP |
14 | * You should have received a copy of the GNU Lesser General Public License |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
70407e86 BP |
16 | */ |
17 | ||
18 | #ifdef HAVE_CONFIG_H | |
19 | #include <config.h> | |
20 | #endif | |
21 | ||
2f076594 | 22 | #include <stdarg.h> |
70407e86 BP |
23 | #include <stdlib.h> |
24 | ||
2bd4b3e4 | 25 | #include "sync_chain.h" |
10341d26 | 26 | #include "event_processing_lttng_common.h" |
70407e86 | 27 | |
10341d26 | 28 | #include "event_processing_lttng_null.h" |
70407e86 BP |
29 | |
30 | ||
08365995 | 31 | // Functions common to all processing modules |
2f076594 | 32 | static void initProcessingLTTVNull(SyncState* const syncState, ...); |
70407e86 BP |
33 | static void destroyProcessingLTTVNull(SyncState* const syncState); |
34 | ||
9c7696b8 | 35 | static GArray* finalizeProcessingLTTVNull(SyncState* const syncState); |
70407e86 BP |
36 | |
37 | // Functions specific to this module | |
70407e86 BP |
38 | static gboolean processEventLTTVNull(void* hookData, void* callData); |
39 | ||
40 | ||
41 | static ProcessingModule processingModuleLTTVNull = { | |
42 | .name= "LTTV-null", | |
43 | .initProcessing= &initProcessingLTTVNull, | |
44 | .destroyProcessing= &destroyProcessingLTTVNull, | |
45 | .finalizeProcessing= &finalizeProcessingLTTVNull, | |
70407e86 BP |
46 | }; |
47 | ||
48 | ||
49 | ||
50 | /* | |
51 | * Processing Module registering function | |
52 | */ | |
2f961b65 | 53 | void registerProcessingLTTVNull() |
70407e86 BP |
54 | { |
55 | g_queue_push_tail(&processingModules, &processingModuleLTTVNull); | |
56 | ||
57 | createQuarks(); | |
58 | } | |
59 | ||
60 | ||
61 | /* | |
62 | * Allocate and initialize data structures for synchronizing a traceset. | |
63 | * Register event hooks. | |
64 | * | |
65 | * Args: | |
66 | * syncState: container for synchronization data. | |
67 | * This function allocates these processingData members: | |
68 | * hookListList | |
2f076594 | 69 | * traceSetContext: LttvTracesetContext*, set of LTTV traces |
70407e86 | 70 | */ |
2f076594 | 71 | static void initProcessingLTTVNull(SyncState* const syncState, ...) |
70407e86 BP |
72 | { |
73 | ProcessingDataLTTVNull* processingData; | |
2f076594 | 74 | va_list ap; |
70407e86 BP |
75 | |
76 | processingData= malloc(sizeof(ProcessingDataLTTVNull)); | |
77 | syncState->processingData= processingData; | |
09857093 BP |
78 | va_start(ap, syncState); |
79 | processingData->traceSetContext= va_arg(ap, LttvTracesetContext*); | |
80 | va_end(ap); | |
81 | syncState->traceNb= | |
82 | lttv_traceset_number(processingData->traceSetContext->ts); | |
70407e86 BP |
83 | processingData->hookListList= g_array_sized_new(FALSE, FALSE, |
84 | sizeof(GArray*), syncState->traceNb); | |
85 | ||
09857093 BP |
86 | registerHooks(processingData->hookListList, |
87 | processingData->traceSetContext, &processEventLTTVNull, syncState, | |
f6691532 | 88 | syncState->matchingModule->canMatch); |
70407e86 BP |
89 | } |
90 | ||
91 | ||
92 | /* | |
93 | * Nothing to do | |
94 | * | |
95 | * Args: | |
96 | * syncState container for synchronization data. | |
9c7696b8 BP |
97 | * |
98 | * Returns: | |
99 | * Factors[traceNb] synchronization factors for each trace, empty in this | |
100 | * case | |
70407e86 | 101 | */ |
9c7696b8 | 102 | static GArray* finalizeProcessingLTTVNull(SyncState* const syncState) |
70407e86 | 103 | { |
9c7696b8 | 104 | return g_array_new(FALSE, FALSE, sizeof(Factors)); |
70407e86 BP |
105 | } |
106 | ||
107 | ||
108 | /* | |
109 | * Unregister event hooks. Deallocate processingData. | |
110 | * | |
111 | * Args: | |
112 | * syncState: container for synchronization data. | |
113 | * This function deallocates these members: | |
114 | * hookListList | |
115 | */ | |
116 | static void destroyProcessingLTTVNull(SyncState* const syncState) | |
117 | { | |
118 | ProcessingDataLTTVNull* processingData; | |
119 | ||
120 | processingData= (ProcessingDataLTTVNull*) syncState->processingData; | |
121 | ||
122 | if (processingData == NULL) | |
123 | { | |
124 | return; | |
125 | } | |
126 | ||
127 | unregisterHooks(processingData->hookListList, | |
08365995 | 128 | processingData->traceSetContext); |
70407e86 BP |
129 | |
130 | free(syncState->processingData); | |
131 | syncState->processingData= NULL; | |
132 | } | |
133 | ||
134 | ||
135 | /* | |
136 | * Lttv hook function that will be called for network events | |
137 | * | |
138 | * Args: | |
139 | * hookData: LttvTraceHook* for the type of event that generated the call | |
140 | * callData: LttvTracefileContext* at the moment of the event | |
141 | * | |
142 | * Returns: | |
143 | * FALSE Always returns FALSE, meaning to keep processing hooks for | |
144 | * this event | |
145 | */ | |
146 | static gboolean processEventLTTVNull(void* hookData, void* callData) | |
147 | { | |
148 | return FALSE; | |
149 | } |