From: Benjamin Poirier Date: Thu, 26 Nov 2009 20:39:42 +0000 (-0500) Subject: Initialize traceNb in the processing modules X-Git-Tag: v0.12.26~20 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=098570932dc44e0fa54fad0b04c3a775418b1111;p=lttv.git Initialize traceNb in the processing modules Removes manipulation of structure fields by sync_chain. Signed-off-by: Benjamin Poirier --- diff --git a/lttv/lttv/sync/event_processing_lttng_null.c b/lttv/lttv/sync/event_processing_lttng_null.c index 28b97cca..8970e036 100644 --- a/lttv/lttv/sync/event_processing_lttng_null.c +++ b/lttv/lttv/sync/event_processing_lttng_null.c @@ -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); } diff --git a/lttv/lttv/sync/event_processing_lttng_standard.c b/lttv/lttv/sync/event_processing_lttng_standard.c index 4b5f69ec..e6457fa4 100644 --- a/lttv/lttv/sync/event_processing_lttng_standard.c +++ b/lttv/lttv/sync/event_processing_lttng_standard.c @@ -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); diff --git a/lttv/lttv/sync/sync_chain_lttv.c b/lttv/lttv/sync/sync_chain_lttv.c index bbd2b3aa..f2389bd8 100644 --- a/lttv/lttv/sync/sync_chain_lttv.c +++ b/lttv/lttv/sync/sync_chain_lttv.c @@ -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);