initProcessing takes a va_arg rather than an lttv-specific type
authorBenjamin Poirier <benjamin.poirier@polymtl.ca>
Thu, 26 Nov 2009 16:12:58 +0000 (11:12 -0500)
committerBenjamin Poirier <benjamin.poirier@polymtl.ca>
Fri, 18 Dec 2009 19:04:17 +0000 (14:04 -0500)
Makes the framework more general.

Signed-off-by: Benjamin Poirier <benjamin.poirier@polymtl.ca>
lttv/lttv/sync/event_analysis_chull.c
lttv/lttv/sync/event_processing.h
lttv/lttv/sync/event_processing_lttng_null.c
lttv/lttv/sync/event_processing_lttng_standard.c
lttv/lttv/sync/graph_functions.c
lttv/lttv/sync/sync_chain.c
lttv/lttv/sync/sync_chain.h
lttv/lttv/sync/sync_chain_lttv.c
lttv/lttv/sync/sync_chain_lttv.h [new file with mode: 0644]
lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
lttv/modules/text/batchAnalysis.c

index b89f89ca01c643a267f88d2f2f2e0ccc86e92419..d0dd0a70c88839d5b4564966d982358859e8a788 100644 (file)
@@ -26,6 +26,7 @@
 #include <float.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "sync_chain.h"
index d1ac7647ecf5b8210c5a87be9fef073bc6d25088..34ea8001d4ec798f22b9000257601afc513943ff 100644 (file)
@@ -22,8 +22,6 @@
 #include <glib.h>
 #include <stdio.h>
 
-#include <lttv/tracecontext.h>
-
 #include "data_structures.h"
 #include "graph_functions.h"
 
@@ -34,12 +32,9 @@ typedef struct
 {
        char* name;
 
-       void (*initProcessing)(struct _SyncState* const syncStateLttv,
-               LttvTracesetContext* const traceSetContext);
+       void (*initProcessing)(struct _SyncState* const syncStateLttv, ...);
        void (*destroyProcessing)(struct _SyncState* const syncState);
-
        void (*finalizeProcessing)(struct _SyncState* const syncState);
-
        void (*printProcessingStats)(struct _SyncState* const syncState);
        GraphFunctions graphFunctions;
 } ProcessingModule;
index 580185fb7ce2af36be72a6adb16ad84c56691415..28b97cca40420fcef04c4e4555d91b743dc24762 100644 (file)
@@ -20,6 +20,7 @@
 #include <config.h>
 #endif
 
+#include <stdarg.h>
 #include <stdlib.h>
 
 #include "sync_chain.h"
@@ -29,8 +30,7 @@
 
 
 // Functions common to all processing modules
-static void initProcessingLTTVNull(SyncState* const syncState,
-       LttvTracesetContext* const traceSetContext);
+static void initProcessingLTTVNull(SyncState* const syncState, ...);
 static void destroyProcessingLTTVNull(SyncState* const syncState);
 
 static void finalizeProcessingLTTVNull(SyncState* const syncState);
@@ -68,12 +68,13 @@ static void registerProcessingLTTVNull()
  *   syncState:    container for synchronization data.
  *                 This function allocates these processingData members:
  *                 hookListList
- *   traceSetContext: set of LTTV traces
+ *   traceSetContext: LttvTracesetContext*, set of LTTV traces
  */
-static void initProcessingLTTVNull(SyncState* const syncState,
-       LttvTracesetContext* const traceSetContext)
+static void initProcessingLTTVNull(SyncState* const syncState, ...)
 {
        ProcessingDataLTTVNull* processingData;
+       LttvTracesetContext* traceSetContext;
+       va_list ap;
 
        processingData= malloc(sizeof(ProcessingDataLTTVNull));
        syncState->processingData= processingData;
@@ -82,6 +83,9 @@ static void initProcessingLTTVNull(SyncState* const syncState,
        processingData->hookListList= g_array_sized_new(FALSE, FALSE,
                sizeof(GArray*), syncState->traceNb);
 
+       va_start(ap, syncState);
+       traceSetContext= va_arg(ap, LttvTracesetContext*);
+       va_end(ap);
        registerHooks(processingData->hookListList, traceSetContext,
                &processEventLTTVNull, syncState,
                syncState->matchingModule->canMatch);
index 1bec81f0ef01058a445adb91a88f6945a3231e4b..4b5f69ecd839c82ee37980034767d81411cdb4b0 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/if_ether.h>
 #include <math.h>
 #include <netinet/in.h>
+#include <stdarg.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
@@ -36,8 +37,7 @@
 
 
 // Functions common to all processing modules
-static void initProcessingLTTVStandard(SyncState* const syncState,
-       LttvTracesetContext* const traceSetContext);
+static void initProcessingLTTVStandard(SyncState* const syncState, ...);
 static void destroyProcessingLTTVStandard(SyncState* const syncState);
 
 static void finalizeProcessingLTTVStandard(SyncState* const syncState);
@@ -91,17 +91,19 @@ static void registerProcessingLTTVStandard()
  *                 pendingRecv
  *                 hookListList
  *                 stats
- *   traceSetContext: set of LTTV traces
+ *   traceSetContext: LttvTracesetContext*, set of LTTV traces
  */
-static void initProcessingLTTVStandard(SyncState* const syncState, LttvTracesetContext*
-       const traceSetContext)
+static void initProcessingLTTVStandard(SyncState* const syncState, ...)
 {
        unsigned int i;
        ProcessingDataLTTVStandard* processingData;
+       va_list ap;
 
        processingData= malloc(sizeof(ProcessingDataLTTVStandard));
        syncState->processingData= processingData;
-       processingData->traceSetContext= traceSetContext;
+       va_start(ap, syncState);
+       processingData->traceSetContext= va_arg(ap, LttvTracesetContext*);
+       va_end(ap);
 
        if (syncState->stats)
        {
@@ -131,7 +133,7 @@ static void initProcessingLTTVStandard(SyncState* const syncState, LttvTracesetC
 
                for(i= 0; i < syncState->traceNb; i++)
                {
-                       LttTrace* traceI= traceSetContext->traces[i]->t;
+                       LttTrace* traceI= processingData->traceSetContext->traces[i]->t;
 
                        processingData->graphs[i].startFreq= traceI->start_freq;
                        processingData->graphs[i].freqScale= traceI->freq_scale;
@@ -148,8 +150,8 @@ static void initProcessingLTTVStandard(SyncState* const syncState, LttvTracesetC
                        NULL, NULL, &gdnDestroyEvent);
        }
 
-       registerHooks(processingData->hookListList, traceSetContext,
-               &processEventLTTVStandard, syncState,
+       registerHooks(processingData->hookListList,
+               processingData->traceSetContext, &processEventLTTVStandard, syncState,
                syncState->matchingModule->canMatch);
 }
 
index 6bd28b8091ed26354b1d7a308934543ac0556c3f..85adcf37c46de6a34843832d753d1fc6ca554673 100644 (file)
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
index 30593508471324b148567380acc457d67c7f5765..e65415971f6f148ad7c308a821ce8525dc4b5716 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 #include <errno.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "sync_chain.h"
index ee81308f1638d52c1b476ea32d5f7e682058b09c..852e8e4a0ad855f448f6ee210e3dd23534ca0541 100644 (file)
@@ -66,8 +66,6 @@ extern GQueue analysisModules;
 extern GQueue moduleOptions;
 
 
-void syncTraceset(LttvTracesetContext* const traceSetContext);
-
 void timeDiff(struct timeval* const end, const struct timeval* const start);
 
 gint gcfCompareProcessing(gconstpointer a, gconstpointer b);
index 58ef078df37e4eca867023816bfbfabe53f737d4..5dd10bf9fb827deaa5ea6ea1777a2cee4a955b82 100644 (file)
@@ -34,6 +34,7 @@
 #include <lttv/option.h>
 
 #include "sync_chain.h"
+#include "sync_chain_lttv.h"
 
 
 static void init();
diff --git a/lttv/lttv/sync/sync_chain_lttv.h b/lttv/lttv/sync/sync_chain_lttv.h
new file mode 100644 (file)
index 0000000..0688f96
--- /dev/null
@@ -0,0 +1,26 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#ifndef SYNC_CHAIN_LTTV_H
+#define SYNC_CHAIN_LTTV_H
+
+#include <lttv/tracecontext.h>
+
+void syncTraceset(LttvTracesetContext* const traceSetContext);
+
+#endif
index 53681f48bb4dbb775b1509bd8307a15c982c2632..6514ef0a5ccd9e9203840e509f815da870f3f391 100644 (file)
@@ -39,7 +39,7 @@
 #include <lttv/iattribute.h>
 #include <lttv/stats.h>
 #include <lttv/filter.h>
-#include <lttv/sync/sync_chain.h>
+#include <lttv/sync/sync_chain_lttv.h>
 #include <lttvwindow/mainwindow.h>
 #include <lttvwindow/mainwindow-private.h>
 #include <lttvwindow/menu.h>
index 3ee4d021fc6539c4f804b086fd2bac7596a8f99e..4b02f33250f886c17082ed4e18537355e7627b5f 100644 (file)
@@ -34,7 +34,7 @@
 #include <lttv/stats.h>
 #include <lttv/filter.h>
 #include <ltt/trace.h>
-#include <lttv/sync/sync_chain.h>
+#include <lttv/sync/sync_chain_lttv.h>
 
 static LttvTraceset *traceset;
 
This page took 0.044095 seconds and 4 git commands to generate.