Do not use __attribute__((constructor))
[lttv.git] / lttv / lttv / sync / sync_chain_lttv.c
index 640042d1c61c92e583a9972874d998ab28578357..7fd0c6e435666300fa646cdddf90b692af97629e 100644 (file)
 #include <lttv/module.h>
 #include <lttv/option.h>
 
+
+#include "event_processing_lttng_standard.h"
+#include "event_processing_lttng_null.h"
+#include "event_matching_tcp.h"
+#include "event_matching_broadcast.h"
+#include "event_matching_distributor.h"
+#include "event_analysis_chull.h"
+#include "event_analysis_linreg.h"
+#include "event_analysis_eval.h"
 #include "sync_chain.h"
 #include "sync_chain_lttv.h"
 
@@ -80,13 +89,7 @@ static ModuleOption optionSyncGraphsDir= {
 /*
  * Module init function
  *
- * This function is declared to be the module initialization function. Event
- * modules are registered with a "constructor (102)" attribute except one in
- * each class (processing, matching, analysis) which is chosen to be the
- * default and which is registered with a "constructor (101)" attribute.
- * Constructors with no priority are called after constructors with
- * priorities. The result is that the list of event modules is known when this
- * function is executed.
+ * This function is declared to be the module initialization function.
  */
 static void init()
 {
@@ -94,6 +97,24 @@ static void init()
 
        g_debug("Sync init");
 
+       /*
+        * Initialize event modules
+        * Call the "constructor" or initialization function of each event module
+        * so it can register itself. This must be done before elements in
+        * processingModules, matchingModules, analysisModules or moduleOptions
+        * are accessed.
+        */
+       registerProcessingLTTVStandard();
+       registerProcessingLTTVNull();
+
+       registerMatchingTCP();
+       registerMatchingBroadcast();
+       registerMatchingDistributor();
+
+       registerAnalysisCHull();
+       registerAnalysisLinReg();
+       registerAnalysisEval();
+
        g_assert(g_queue_get_length(&analysisModules) > 0);
        optionSyncAnalysis.arg= ((AnalysisModule*)
                g_queue_peek_head(&analysisModules))->name;
@@ -147,8 +168,11 @@ static void destroy()
  *
  * Args:
  *   traceSetContext: traceset
+ *
+ * Returns:
+ *   false if synchronization was not performed, true otherwise
  */
-void syncTraceset(LttvTracesetContext* const traceSetContext)
+bool syncTraceset(LttvTracesetContext* const traceSetContext)
 {
        SyncState* syncState;
        struct timeval startTime, endTime;
@@ -160,7 +184,7 @@ void syncTraceset(LttvTracesetContext* const traceSetContext)
        if (!optionSync.present)
        {
                g_debug("Not synchronizing traceset because option is disabled");
-               return;
+               return false;
        }
 
        if (optionSyncStats.present)
@@ -299,6 +323,8 @@ void syncTraceset(LttvTracesetContext* const traceSetContext)
                printf("\tsystem time: %ld.%06ld\n", endUsage.ru_stime.tv_sec,
                        endUsage.ru_stime.tv_usec);
        }
+
+       return true;
 }
 
 
This page took 0.024347 seconds and 4 git commands to generate.