X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;ds=inline;f=lttv%2Flttv%2Fsync%2Fevent_processing_lttng_standard.c;h=55806dfa8922826c814a4c6ed5c6eee2e265e606;hb=2f961b65e3422f23019286e9531b0a40070278ea;hp=4b5f69ecd839c82ee37980034767d81411cdb4b0;hpb=2f07659468ff3427bb3923cdc5a7ec61b6e8bbce;p=lttv.git diff --git a/lttv/lttv/sync/event_processing_lttng_standard.c b/lttv/lttv/sync/event_processing_lttng_standard.c index 4b5f69ec..55806dfa 100644 --- a/lttv/lttv/sync/event_processing_lttng_standard.c +++ b/lttv/lttv/sync/event_processing_lttng_standard.c @@ -22,7 +22,6 @@ #include #endif -#include #include #include #include @@ -35,6 +34,11 @@ #include "event_processing_lttng_standard.h" +/* IPv4 Ethertype, taken from , unlikely to change as it's + * defined by IANA: http://www.iana.org/assignments/ethernet-numbers + */ +#define ETH_P_IP 0x0800 + // Functions common to all processing modules static void initProcessingLTTVStandard(SyncState* const syncState, ...); @@ -50,7 +54,6 @@ static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState* const syncState, const unsigned int i, const unsigned int j); // Functions specific to this module -static void registerProcessingLTTVStandard() __attribute__((constructor (102))); static gboolean processEventLTTVStandard(void* hookData, void* callData); static void partialDestroyProcessingLTTVStandard(SyncState* const syncState); @@ -72,7 +75,7 @@ static ProcessingModule processingModuleLTTVStandard = { /* * Processing Module registering function */ -static void registerProcessingLTTVStandard() +void registerProcessingLTTVStandard() { g_queue_push_tail(&processingModules, &processingModuleLTTVStandard); @@ -104,26 +107,34 @@ 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, + GUINT_TO_POINTER(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 +155,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); @@ -383,6 +388,7 @@ static gboolean processEventLTTVStandard(void* hookData, void* callData) struct marker_info* info; SyncState* syncState; ProcessingDataLTTVStandard* processingData; + gpointer traceNumP; traceHook= (LttvTraceHook*) hookData; tfc= (LttvTracefileContext*) callData; @@ -397,7 +403,8 @@ static gboolean processEventLTTVStandard(void* hookData, void* callData) wTime.nanosec= time.tv_nsec; g_assert(g_hash_table_lookup_extended(processingData->traceNumTable, - trace, NULL, (gpointer*) &traceNum)); + trace, NULL, &traceNumP)); + traceNum= GPOINTER_TO_INT(traceNumP); g_debug("Process event: time: %ld.%09ld trace: %ld (%p) name: %s ", time.tv_sec, time.tv_nsec, traceNum, trace, @@ -699,14 +706,6 @@ static void writeProcessingGraphVariablesLTTVStandard(SyncState* const static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState* const syncState, const unsigned int i, const unsigned int j) { - ProcessingDataLTTVStandard* processingData; - ProcessingGraphsLTTVStandard* traceI, * traceJ; - - processingData= (ProcessingDataLTTVStandard*) syncState->processingData; - - traceI= &processingData->graphs[i]; - traceJ= &processingData->graphs[j]; - fprintf(syncState->graphsStream, "set key inside right bottom\n" "set xlabel \"Clock %1$u\"\n" @@ -733,14 +732,6 @@ static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState* const static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState* const syncState, const unsigned int i, const unsigned int j) { - ProcessingDataLTTVStandard* processingData; - ProcessingGraphsLTTVStandard* traceI, * traceJ; - - processingData= (ProcessingDataLTTVStandard*) syncState->processingData; - - traceI= &processingData->graphs[i]; - traceJ= &processingData->graphs[j]; - fprintf(syncState->graphsStream, "set key inside right bottom\n" "set xlabel \"Clock %1$u\"\n"