1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
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;
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.
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,
26 #include "sync_chain.h"
27 #include "event_processing_lttng_common.h"
29 #include "event_processing_lttng_null.h"
32 // Functions common to all processing modules
33 static void initProcessingLTTVNull(SyncState
* const syncState
, ...);
34 static void destroyProcessingLTTVNull(SyncState
* const syncState
);
36 static void finalizeProcessingLTTVNull(SyncState
* const syncState
);
38 // Functions specific to this module
39 static void registerProcessingLTTVNull() __attribute__((constructor (102)));
40 static gboolean
processEventLTTVNull(void* hookData
, void* callData
);
43 static ProcessingModule processingModuleLTTVNull
= {
45 .initProcessing
= &initProcessingLTTVNull
,
46 .destroyProcessing
= &destroyProcessingLTTVNull
,
47 .finalizeProcessing
= &finalizeProcessingLTTVNull
,
53 * Processing Module registering function
55 static void registerProcessingLTTVNull()
57 g_queue_push_tail(&processingModules
, &processingModuleLTTVNull
);
64 * Allocate and initialize data structures for synchronizing a traceset.
65 * Register event hooks.
68 * syncState: container for synchronization data.
69 * This function allocates these processingData members:
71 * traceSetContext: LttvTracesetContext*, set of LTTV traces
73 static void initProcessingLTTVNull(SyncState
* const syncState
, ...)
75 ProcessingDataLTTVNull
* processingData
;
76 LttvTracesetContext
* traceSetContext
;
79 processingData
= malloc(sizeof(ProcessingDataLTTVNull
));
80 syncState
->processingData
= processingData
;
81 processingData
->traceSetContext
= traceSetContext
;
83 processingData
->hookListList
= g_array_sized_new(FALSE
, FALSE
,
84 sizeof(GArray
*), syncState
->traceNb
);
86 va_start(ap
, syncState
);
87 traceSetContext
= va_arg(ap
, LttvTracesetContext
*);
89 registerHooks(processingData
->hookListList
, traceSetContext
,
90 &processEventLTTVNull
, syncState
,
91 syncState
->matchingModule
->canMatch
);
99 * syncState container for synchronization data.
101 static void finalizeProcessingLTTVNull(SyncState
* const syncState
)
108 * Unregister event hooks. Deallocate processingData.
111 * syncState: container for synchronization data.
112 * This function deallocates these members:
115 static void destroyProcessingLTTVNull(SyncState
* const syncState
)
117 ProcessingDataLTTVNull
* processingData
;
119 processingData
= (ProcessingDataLTTVNull
*) syncState
->processingData
;
121 if (processingData
== NULL
)
126 unregisterHooks(processingData
->hookListList
,
127 processingData
->traceSetContext
);
129 free(syncState
->processingData
);
130 syncState
->processingData
= NULL
;
135 * Lttv hook function that will be called for network events
138 * hookData: LttvTraceHook* for the type of event that generated the call
139 * callData: LttvTracefileContext* at the moment of the event
142 * FALSE Always returns FALSE, meaning to keep processing hooks for
145 static gboolean
processEventLTTVNull(void* hookData
, void* callData
)