X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fevent_matching_distributor.c;h=6ea6c0fd95f3c1add42284e69161448e0c1b742d;hb=2f961b65e3422f23019286e9531b0a40070278ea;hp=b9d740515c494e62b65ffcd05e995efc9a59027d;hpb=d4721e1a5216f34570d7e10257f85601cb3991bc;p=lttv.git diff --git a/lttv/lttv/sync/event_matching_distributor.c b/lttv/lttv/sync/event_matching_distributor.c index b9d74051..6ea6c0fd 100644 --- a/lttv/lttv/sync/event_matching_distributor.c +++ b/lttv/lttv/sync/event_matching_distributor.c @@ -42,7 +42,6 @@ struct GraphAggregate /* Offset whithin Matching module of the field* containing the function * pointer */ size_t offset; - FILE* stream; unsigned int i, j; }; @@ -55,14 +54,20 @@ static void matchEventDistributor(SyncState* const syncState, Event* const event); static GArray* finalizeMatchingDistributor(SyncState* const syncState); static void printMatchingStatsDistributor(SyncState* const syncState); -static void writeMatchingGraphsPlotsDistributor(FILE* stream, SyncState* const +static void writeMatchingTraceTraceForePlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j); +static void writeMatchingTraceTraceBackPlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j); +static void writeMatchingTraceTraceOptionsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j); +static void writeMatchingTraceTimeForePlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j); +static void writeMatchingTraceTimeBackPlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j); +static void writeMatchingTraceTimeOptionsDistributor(SyncState* const syncState, const unsigned int i, const unsigned int j); -static void writeMatchingGraphsOptionsDistributor(FILE* stream, SyncState* - const syncState, const unsigned int i, const unsigned int j); // Functions specific to this module -static void registerMatchingDistributor() __attribute__((constructor (101))); - void gfInitModule(gpointer data, gpointer user_data); void gfDestroyModule(gpointer data, gpointer user_data); void gfMatchEvent(gpointer data, gpointer user_data); @@ -80,15 +85,23 @@ static MatchingModule matchingModuleDistributor = { .matchEvent= &matchEventDistributor, .finalizeMatching= &finalizeMatchingDistributor, .printMatchingStats= &printMatchingStatsDistributor, - .writeMatchingGraphsPlots= &writeMatchingGraphsPlotsDistributor, - .writeMatchingGraphsOptions= &writeMatchingGraphsOptionsDistributor, + .graphFunctions= { + .writeTraceTraceForePlots= + &writeMatchingTraceTraceForePlotsDistributor, + .writeTraceTraceBackPlots= + &writeMatchingTraceTraceBackPlotsDistributor, + .writeTraceTraceOptions= &writeMatchingTraceTraceOptionsDistributor, + .writeTraceTimeForePlots= &writeMatchingTraceTimeForePlotsDistributor, + .writeTraceTimeBackPlots= &writeMatchingTraceTimeBackPlotsDistributor, + .writeTraceTimeOptions= &writeMatchingTraceTimeOptionsDistributor, + }, }; /* * Matching module registering function */ -static void registerMatchingDistributor() +void registerMatchingDistributor() { g_queue_push_tail(&matchingModules, &matchingModuleDistributor); } @@ -207,19 +220,94 @@ static void printMatchingStatsDistributor(SyncState* const syncState) * Call the distributed graph lines functions (when they exist). * * Args: - * stream: stream where to write the data * syncState: container for synchronization data * i: first trace number * j: second trace number, garanteed to be larger than i */ -static void writeMatchingGraphsPlotsDistributor(FILE* stream, SyncState* const +static void writeMatchingTraceTraceForePlotsDistributor(SyncState* const syncState, const unsigned int i, const unsigned int j) { MatchingDataDistributor* matchingData= syncState->matchingData; g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall, &(struct GraphAggregate) {offsetof(MatchingModule, - writeMatchingGraphsPlots), stream, i, j}); + graphFunctions.writeTraceTraceForePlots), i, j}); +} + + +/* + * Call the distributed graph lines functions (when they exist). + * + * Args: + * syncState: container for synchronization data + * i: first trace number + * j: second trace number, garanteed to be larger than i + */ +static void writeMatchingTraceTraceBackPlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j) +{ + MatchingDataDistributor* matchingData= syncState->matchingData; + + g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall, + &(struct GraphAggregate) {offsetof(MatchingModule, + graphFunctions.writeTraceTraceBackPlots), i, j}); +} + + +/* + * Call the distributed graph lines functions (when they exist). + * + * Args: + * syncState: container for synchronization data + * i: first trace number + * j: second trace number, garanteed to be larger than i + */ +static void writeMatchingTraceTimeForePlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j) +{ + MatchingDataDistributor* matchingData= syncState->matchingData; + + g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall, + &(struct GraphAggregate) {offsetof(MatchingModule, + graphFunctions.writeTraceTimeForePlots), i, j}); +} + + +/* + * Call the distributed graph lines functions (when they exist). + * + * Args: + * syncState: container for synchronization data + * i: first trace number + * j: second trace number, garanteed to be larger than i + */ +static void writeMatchingTraceTimeBackPlotsDistributor(SyncState* const + syncState, const unsigned int i, const unsigned int j) +{ + MatchingDataDistributor* matchingData= syncState->matchingData; + + g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall, + &(struct GraphAggregate) {offsetof(MatchingModule, + graphFunctions.writeTraceTimeBackPlots), i, j}); +} + + +/* + * Call the distributed graph options functions (when they exist). + * + * Args: + * syncState: container for synchronization data + * i: first trace number + * j: second trace number, garanteed to be larger than i + */ +static void writeMatchingTraceTraceOptionsDistributor(SyncState* const syncState, + const unsigned int i, const unsigned int j) +{ + MatchingDataDistributor* matchingData= syncState->matchingData; + + g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall, + &(struct GraphAggregate) {offsetof(MatchingModule, + graphFunctions.writeTraceTraceOptions), i, j}); } @@ -227,19 +315,18 @@ static void writeMatchingGraphsPlotsDistributor(FILE* stream, SyncState* const * Call the distributed graph options functions (when they exist). * * Args: - * stream: stream where to write the data * syncState: container for synchronization data * i: first trace number * j: second trace number, garanteed to be larger than i */ -static void writeMatchingGraphsOptionsDistributor(FILE* stream, SyncState* - const syncState, const unsigned int i, const unsigned int j) +static void writeMatchingTraceTimeOptionsDistributor(SyncState* const syncState, + const unsigned int i, const unsigned int j) { MatchingDataDistributor* matchingData= syncState->matchingData; g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall, &(struct GraphAggregate) {offsetof(MatchingModule, - writeMatchingGraphsOptions), stream, i, j}); + graphFunctions.writeTraceTimeOptions), i, j}); } @@ -359,11 +446,13 @@ void gfGraphFunctionCall(gpointer data, gpointer user_data) { SyncState* parallelSS= data; struct GraphAggregate* aggregate= user_data; - void (*graphFunction)(FILE* , struct _SyncState*, const unsigned int, - const unsigned int)= (void*) data + (size_t) aggregate->offset; + typedef void (*GraphFunction)(struct _SyncState*, const unsigned int, + const unsigned int); + GraphFunction graphFunction= *(GraphFunction*)((void*) + parallelSS->matchingModule + (size_t) aggregate->offset); if (graphFunction != NULL) { - graphFunction(aggregate->stream, parallelSS, aggregate->i, aggregate->j); + graphFunction(parallelSS, aggregate->i, aggregate->j); } }