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,
25 #include "sync_chain.h"
26 #include "event_processing_lttv_common.h"
28 #include "event_processing_lttv_null.h"
32 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
36 // Functions common to all matching modules
37 static void initProcessingLTTVNull(SyncState
* const syncState
,
38 LttvTracesetContext
* const traceSetContext
);
39 static void destroyProcessingLTTVNull(SyncState
* const syncState
);
41 static void finalizeProcessingLTTVNull(SyncState
* const syncState
);
43 // Functions specific to this module
44 static void registerProcessingLTTVNull() __attribute__((constructor (102)));
45 static gboolean
processEventLTTVNull(void* hookData
, void* callData
);
48 static ProcessingModule processingModuleLTTVNull
= {
50 .initProcessing
= &initProcessingLTTVNull
,
51 .destroyProcessing
= &destroyProcessingLTTVNull
,
52 .finalizeProcessing
= &finalizeProcessingLTTVNull
,
53 .printProcessingStats
= NULL
,
59 * Processing Module registering function
61 static void registerProcessingLTTVNull()
63 g_queue_push_tail(&processingModules
, &processingModuleLTTVNull
);
70 * Allocate and initialize data structures for synchronizing a traceset.
71 * Register event hooks.
74 * syncState: container for synchronization data.
75 * This function allocates these processingData members:
77 * traceSetContext: set of LTTV traces
79 static void initProcessingLTTVNull(SyncState
* const syncState
,
80 LttvTracesetContext
* const traceSetContext
)
82 ProcessingDataLTTVNull
* processingData
;
84 processingData
= malloc(sizeof(ProcessingDataLTTVNull
));
85 syncState
->processingData
= processingData
;
86 processingData
->traceSetContext
= traceSetContext
;
88 processingData
->hookListList
= g_array_sized_new(FALSE
, FALSE
,
89 sizeof(GArray
*), syncState
->traceNb
);
91 registerHooks(processingData
->hookListList
, traceSetContext
,
92 syncState
->traceNb
, &processEventLTTVNull
, syncState
);
100 * syncState container for synchronization data.
102 static void finalizeProcessingLTTVNull(SyncState
* const syncState
)
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
, syncState
->traceNb
);
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
)