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 | |
39 | static void registerProcessingLTTVNull() __attribute__((constructor (102))); | |
40 | static gboolean processEventLTTVNull(void* hookData, void* callData); | |
41 | ||
42 | ||
43 | static ProcessingModule processingModuleLTTVNull = { | |
44 | .name= "LTTV-null", | |
45 | .initProcessing= &initProcessingLTTVNull, | |
46 | .destroyProcessing= &destroyProcessingLTTVNull, | |
47 | .finalizeProcessing= &finalizeProcessingLTTVNull, | |
70407e86 BP |
48 | }; |
49 | ||
50 | ||
51 | ||
52 | /* | |
53 | * Processing Module registering function | |
54 | */ | |
55 | static void registerProcessingLTTVNull() | |
56 | { | |
57 | g_queue_push_tail(&processingModules, &processingModuleLTTVNull); | |
58 | ||
59 | createQuarks(); | |
60 | } | |
61 | ||
62 | ||
63 | /* | |
64 | * Allocate and initialize data structures for synchronizing a traceset. | |
65 | * Register event hooks. | |
66 | * | |
67 | * Args: | |
68 | * syncState: container for synchronization data. | |
69 | * This function allocates these processingData members: | |
70 | * hookListList | |
2f076594 | 71 | * traceSetContext: LttvTracesetContext*, set of LTTV traces |
70407e86 | 72 | */ |
2f076594 | 73 | static void initProcessingLTTVNull(SyncState* const syncState, ...) |
70407e86 BP |
74 | { |
75 | ProcessingDataLTTVNull* processingData; | |
2f076594 | 76 | va_list ap; |
70407e86 BP |
77 | |
78 | processingData= malloc(sizeof(ProcessingDataLTTVNull)); | |
79 | syncState->processingData= processingData; | |
09857093 BP |
80 | va_start(ap, syncState); |
81 | processingData->traceSetContext= va_arg(ap, LttvTracesetContext*); | |
82 | va_end(ap); | |
83 | syncState->traceNb= | |
84 | lttv_traceset_number(processingData->traceSetContext->ts); | |
70407e86 BP |
85 | processingData->hookListList= g_array_sized_new(FALSE, FALSE, |
86 | sizeof(GArray*), syncState->traceNb); | |
87 | ||
09857093 BP |
88 | registerHooks(processingData->hookListList, |
89 | processingData->traceSetContext, &processEventLTTVNull, syncState, | |
f6691532 | 90 | syncState->matchingModule->canMatch); |
70407e86 BP |
91 | } |
92 | ||
93 | ||
94 | /* | |
95 | * Nothing to do | |
96 | * | |
97 | * Args: | |
98 | * syncState container for synchronization data. | |
99 | */ | |
100 | static void finalizeProcessingLTTVNull(SyncState* const syncState) | |
101 | { | |
102 | return; | |
103 | } | |
104 | ||
105 | ||
106 | /* | |
107 | * Unregister event hooks. Deallocate processingData. | |
108 | * | |
109 | * Args: | |
110 | * syncState: container for synchronization data. | |
111 | * This function deallocates these members: | |
112 | * hookListList | |
113 | */ | |
114 | static void destroyProcessingLTTVNull(SyncState* const syncState) | |
115 | { | |
116 | ProcessingDataLTTVNull* processingData; | |
117 | ||
118 | processingData= (ProcessingDataLTTVNull*) syncState->processingData; | |
119 | ||
120 | if (processingData == NULL) | |
121 | { | |
122 | return; | |
123 | } | |
124 | ||
125 | unregisterHooks(processingData->hookListList, | |
08365995 | 126 | processingData->traceSetContext); |
70407e86 BP |
127 | |
128 | free(syncState->processingData); | |
129 | syncState->processingData= NULL; | |
130 | } | |
131 | ||
132 | ||
133 | /* | |
134 | * Lttv hook function that will be called for network events | |
135 | * | |
136 | * Args: | |
137 | * hookData: LttvTraceHook* for the type of event that generated the call | |
138 | * callData: LttvTracefileContext* at the moment of the event | |
139 | * | |
140 | * Returns: | |
141 | * FALSE Always returns FALSE, meaning to keep processing hooks for | |
142 | * this event | |
143 | */ | |
144 | static gboolean processEventLTTVNull(void* hookData, void* callData) | |
145 | { | |
146 | return FALSE; | |
147 | } |