-
- g_debug("\t\t\tXXXX sync init\n");
-
- optionSync= FALSE;
- lttv_option_add("sync", '\0', "synchronize the time between the traces" ,
- "none", LTTV_OPT_NONE, &optionSync, NULL, NULL);
-
- optionSyncStats= FALSE;
- lttv_option_add("sync-stats", '\0', "print statistics about the time "
- "synchronization", "none", LTTV_OPT_NONE, &optionSyncStats, NULL,
- NULL);
-
- optionSyncNull= FALSE;
- lttv_option_add("sync-null", '\0', "read the events but do not perform "
- "any processing", "none", LTTV_OPT_NONE, &optionSyncNull, NULL, NULL);
-
- g_assert(g_queue_get_length(&analysisModules) > 0);
- optionSyncAnalysis= ((AnalysisModule*)
- g_queue_peek_head(&analysisModules))->name;
- analysisModulesNames= g_string_new("");
- g_queue_foreach(&analysisModules, &gfAppendAnalysisName,
- analysisModulesNames);
- // remove the last ", "
- g_string_truncate(analysisModulesNames, analysisModulesNames->len - 2);
- lttv_option_add("sync-analysis", '\0', "specify the algorithm to use for "
- "event analysis" , analysisModulesNames->str, LTTV_OPT_STRING,
- &optionSyncAnalysis, NULL, NULL);
- g_string_free(analysisModulesNames, TRUE);
-
- optionSyncGraphs= FALSE;
- lttv_option_add("sync-graphs", '\0', "output gnuplot graph showing "
- "synchronization points", "none", LTTV_OPT_NONE, &optionSyncGraphs,
- NULL, NULL);
+ unsigned int i;
+ const struct
+ {
+ GQueue* modules;
+ ModuleOption* option;
+ size_t nameOffset;
+ GString** names;
+ void (*gfAppendName)(gpointer data, gpointer user_data);
+ } loopValues[]= {
+ {&analysisModules, &optionSyncAnalysis, offsetof(AnalysisModule,
+ name), &analysisModulesNames, &gfAppendAnalysisName},
+ {&reductionModules, &optionSyncReduction, offsetof(ReductionModule,
+ name), &reductionModulesNames, &gfAppendReductionName},
+ };
+
+ 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();
+
+ registerReductionAccuracy();
+
+ // Build module names lists for option and help string
+ for (i= 0; i < ARRAY_SIZE(loopValues); i++)
+ {
+ g_assert(g_queue_get_length(loopValues[i].modules) > 0);
+ loopValues[i].option->arg= (char*)(*(void**)
+ g_queue_peek_head(loopValues[i].modules) +
+ loopValues[i].nameOffset);
+ *loopValues[i].names= g_string_new("");
+ g_queue_foreach(loopValues[i].modules, loopValues[i].gfAppendName,
+ *loopValues[i].names);
+ // remove the last ", "
+ g_string_truncate(*loopValues[i].names, (*loopValues[i].names)->len -
+ 2);
+ loopValues[i].option->argHelp= (*loopValues[i].names)->str;
+ }