Initialize traceNb in the processing modules
authorBenjamin Poirier <benjamin.poirier@polymtl.ca>
Thu, 26 Nov 2009 20:39:42 +0000 (15:39 -0500)
committerBenjamin Poirier <benjamin.poirier@polymtl.ca>
Fri, 18 Dec 2009 19:04:17 +0000 (14:04 -0500)
Removes manipulation of structure fields by sync_chain.

Signed-off-by: Benjamin Poirier <benjamin.poirier@polymtl.ca>
lttv/lttv/sync/event_processing_lttng_null.c
lttv/lttv/sync/event_processing_lttng_standard.c
lttv/lttv/sync/sync_chain_lttv.c

index 28b97cca40420fcef04c4e4555d91b743dc24762..8970e0363ef1cebcc7fc984857042a4ab90964a9 100644 (file)
@@ -73,21 +73,20 @@ static void registerProcessingLTTVNull()
 static void initProcessingLTTVNull(SyncState* const syncState, ...)
 {
        ProcessingDataLTTVNull* processingData;
-       LttvTracesetContext* traceSetContext;
        va_list ap;
 
        processingData= malloc(sizeof(ProcessingDataLTTVNull));
        syncState->processingData= processingData;
-       processingData->traceSetContext= traceSetContext;
-
+       va_start(ap, syncState);
+       processingData->traceSetContext= va_arg(ap, LttvTracesetContext*);
+       va_end(ap);
+       syncState->traceNb=
+               lttv_traceset_number(processingData->traceSetContext->ts);
        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,
+       registerHooks(processingData->hookListList,
+               processingData->traceSetContext, &processEventLTTVNull, syncState,
                syncState->matchingModule->canMatch);
 }
 
index 4b5f69ecd839c82ee37980034767d81411cdb4b0..e6457fa4e96a0278b6457834e5639b7b87928e36 100644 (file)
@@ -104,26 +104,33 @@ static void initProcessingLTTVStandard(SyncState* const syncState, ...)
        va_start(ap, syncState);
        processingData->traceSetContext= va_arg(ap, LttvTracesetContext*);
        va_end(ap);
+       syncState->traceNb=
+               lttv_traceset_number(processingData->traceSetContext->ts);
+       processingData->hookListList= g_array_sized_new(FALSE, FALSE,
+               sizeof(GArray*), syncState->traceNb);
 
-       if (syncState->stats)
-       {
-               processingData->stats= calloc(1, sizeof(ProcessingStatsLTTVStandard));
-       }
-       else
+       processingData->traceNumTable= g_hash_table_new(&g_direct_hash, NULL);
+       for(i= 0; i < syncState->traceNb; i++)
        {
-               processingData->stats= NULL;
+               g_hash_table_insert(processingData->traceNumTable,
+                       processingData->traceSetContext->traces[i]->t, (gpointer) i);
        }
 
-       processingData->traceNumTable= g_hash_table_new(&g_direct_hash, NULL);
-       processingData->hookListList= g_array_sized_new(FALSE, FALSE,
-               sizeof(GArray*), syncState->traceNb);
        processingData->pendingRecv= malloc(sizeof(GHashTable*) *
                syncState->traceNb);
-
        for(i= 0; i < syncState->traceNb; i++)
        {
-               g_hash_table_insert(processingData->traceNumTable,
-                       processingData->traceSetContext->traces[i]->t, (gpointer) i);
+               processingData->pendingRecv[i]= g_hash_table_new_full(&g_direct_hash,
+                       NULL, NULL, &gdnDestroyEvent);
+       }
+
+       if (syncState->stats)
+       {
+               processingData->stats= calloc(1, sizeof(ProcessingStatsLTTVStandard));
+       }
+       else
+       {
+               processingData->stats= NULL;
        }
 
        if (syncState->graphsStream)
@@ -144,12 +151,6 @@ static void initProcessingLTTVStandard(SyncState* const syncState, ...)
                processingData->graphs= NULL;
        }
 
-       for(i= 0; i < syncState->traceNb; i++)
-       {
-               processingData->pendingRecv[i]= g_hash_table_new_full(&g_direct_hash,
-                       NULL, NULL, &gdnDestroyEvent);
-       }
-
        registerHooks(processingData->hookListList,
                processingData->traceSetContext, &processEventLTTVStandard, syncState,
                syncState->matchingModule->canMatch);
index bbd2b3aacb9b9d70b65f363722b15bfc40687406..f2389bd8f54405a001d36c3aeb057a92f10f2861 100644 (file)
@@ -171,7 +171,6 @@ void syncTraceset(LttvTracesetContext* const traceSetContext)
 
        // Initialize data structures
        syncState= malloc(sizeof(SyncState));
-       syncState->traceNb= lttv_traceset_number(traceSetContext->ts);
 
        if (optionSyncStats.present)
        {
@@ -227,12 +226,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);
This page took 0.025677 seconds and 4 git commands to generate.