X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fsync_chain_lttv.c;h=7fd0c6e435666300fa646cdddf90b692af97629e;hb=2f961b65e3422f23019286e9531b0a40070278ea;hp=bbd2b3aacb9b9d70b65f363722b15bfc40687406;hpb=49c335f194a889e54de18abf4c11d135ed6b6a0e;p=lttv.git diff --git a/lttv/lttv/sync/sync_chain_lttv.c b/lttv/lttv/sync/sync_chain_lttv.c index bbd2b3aa..7fd0c6e4 100644 --- a/lttv/lttv/sync/sync_chain_lttv.c +++ b/lttv/lttv/sync/sync_chain_lttv.c @@ -33,6 +33,15 @@ #include #include + +#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) @@ -171,7 +195,6 @@ void syncTraceset(LttvTracesetContext* const traceSetContext) // Initialize data structures syncState= malloc(sizeof(SyncState)); - syncState->traceNb= lttv_traceset_number(traceSetContext->ts); if (optionSyncStats.present) { @@ -182,7 +205,7 @@ void syncTraceset(LttvTracesetContext* const traceSetContext) syncState->stats= false; } - if (optionSyncGraphs.present) + if (!optionSyncNull.present && optionSyncGraphs.present) { // Create the graph directory right away in case the module initialization // functions have something to write in it. @@ -227,12 +250,12 @@ void syncTraceset(LttvTracesetContext* const traceSetContext) g_error("Analysis module '%s' not found", optionSyncAnalysis.arg); } + syncState->processingModule->initProcessing(syncState, traceSetContext); if (!optionSyncNull.present) { - syncState->analysisModule->initAnalysis(syncState); syncState->matchingModule->initMatching(syncState); + syncState->analysisModule->initAnalysis(syncState); } - syncState->processingModule->initProcessing(syncState, traceSetContext); // Process traceset lttv_process_traceset_seek_time(traceSetContext, ltt_time_zero); @@ -243,7 +266,7 @@ void syncTraceset(LttvTracesetContext* const traceSetContext) syncState->processingModule->finalizeProcessing(syncState); // Write graphs file - if (optionSyncGraphs.present) + if (!optionSyncNull.present && optionSyncGraphs.present) { writeGraphsScript(syncState); @@ -253,21 +276,10 @@ void syncTraceset(LttvTracesetContext* const traceSetContext) } } - if (syncState->processingModule->printProcessingStats != NULL) + if (!optionSyncNull.present && optionSyncStats.present) { - syncState->processingModule->printProcessingStats(syncState); - } - if (syncState->matchingModule->printMatchingStats != NULL) - { - syncState->matchingModule->printMatchingStats(syncState); - } - if (syncState->analysisModule->printAnalysisStats != NULL) - { - syncState->analysisModule->printAnalysisStats(syncState); - } + printStats(syncState); - if (optionSyncStats.present) - { printf("Resulting synchronization factors:\n"); for (i= 0; i < syncState->traceNb; i++) { @@ -311,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; }