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