1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca>
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.
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.
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/>.
25 #include "sync_chain.h"
26 #include "event_processing_lttng_common.h"
28 #include "event_processing_lttng_null.h"
31 // Functions common to all processing modules
32 static void initProcessingLTTVNull(SyncState
* const syncState
, ...);
33 static void destroyProcessingLTTVNull(SyncState
* const syncState
);
35 static AllFactors
* finalizeProcessingLTTVNull(SyncState
* const syncState
);
37 // Functions specific to this module
38 static gboolean
processEventLTTVNull(void* hookData
, void* callData
);
41 static ProcessingModule processingModuleLTTVNull
= {
43 .initProcessing
= &initProcessingLTTVNull
,
44 .destroyProcessing
= &destroyProcessingLTTVNull
,
45 .finalizeProcessing
= &finalizeProcessingLTTVNull
,
51 * Processing Module registering function
53 void registerProcessingLTTVNull()
55 g_queue_push_tail(&processingModules
, &processingModuleLTTVNull
);
62 * Allocate and initialize data structures for synchronizing a traceset.
63 * Register event hooks.
66 * syncState: container for synchronization data.
67 * This function allocates these processingData members:
69 * traceSetContext: LttvTracesetContext*, set of LTTV traces
71 static void initProcessingLTTVNull(SyncState
* const syncState
, ...)
73 ProcessingDataLTTVNull
* processingData
;
76 processingData
= malloc(sizeof(ProcessingDataLTTVNull
));
77 syncState
->processingData
= processingData
;
78 va_start(ap
, syncState
);
79 processingData
->traceSetContext
= va_arg(ap
, LttvTracesetContext
*);
82 lttv_traceset_number(processingData
->traceSetContext
->ts
);
83 processingData
->hookListList
= g_array_sized_new(FALSE
, FALSE
,
84 sizeof(GArray
*), syncState
->traceNb
);
86 registerHooks(processingData
->hookListList
,
87 processingData
->traceSetContext
, &processEventLTTVNull
, syncState
,
88 syncState
->matchingModule
->canMatch
);
96 * syncState container for synchronization data.
99 * AllFactors synchronization factors for each trace pair, all of them
102 static AllFactors
* finalizeProcessingLTTVNull(SyncState
* const syncState
)
104 return createAllFactors(syncState
->traceNb
);
109 * Unregister event hooks. Deallocate processingData.
112 * syncState: container for synchronization data.
113 * This function deallocates these members:
116 static void destroyProcessingLTTVNull(SyncState
* const syncState
)
118 ProcessingDataLTTVNull
* processingData
;
120 processingData
= (ProcessingDataLTTVNull
*) syncState
->processingData
;
122 if (processingData
== NULL
)
127 unregisterHooks(processingData
->hookListList
,
128 processingData
->traceSetContext
);
130 free(syncState
->processingData
);
131 syncState
->processingData
= NULL
;
136 * Lttv hook function that will be called for network events
139 * hookData: LttvTraceHook* for the type of event that generated the call
140 * callData: LttvTracefileContext* at the moment of the event
143 * FALSE Always returns FALSE, meaning to keep processing hooks for
146 static gboolean
processEventLTTVNull(void* hookData
, void* callData
)