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