X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fevent_analysis_eval.c;h=0c0b7b51a80e86fc3cb48cbf104e9bb14aca369c;hb=05a840dfd988f09861bc96c829f68d3c00efd953;hp=63dd0e876fa025454c9781797fd67cead5d90016;hpb=c6356aa749f534f9bc0aa6315d41bff0e69a6ef9;p=lttv.git diff --git a/lttv/lttv/sync/event_analysis_eval.c b/lttv/lttv/sync/event_analysis_eval.c index 63dd0e87..0c0b7b51 100644 --- a/lttv/lttv/sync/event_analysis_eval.c +++ b/lttv/lttv/sync/event_analysis_eval.c @@ -68,8 +68,10 @@ static void analyzeBroadcastEval(SyncState* const syncState, Broadcast* const broadcast); static GArray* finalizeAnalysisEval(SyncState* const syncState); static void printAnalysisStatsEval(SyncState* const syncState); -static void writeAnalysisTraceTimePlotsEval(SyncState* const syncState, const - unsigned int i, const unsigned int j); +static void writeAnalysisTraceTimeBackPlotsEval(SyncState* const syncState, + const unsigned int i, const unsigned int j); +static void writeAnalysisTraceTimeForePlotsEval(SyncState* const syncState, + const unsigned int i, const unsigned int j); static void writeAnalysisTraceTraceBackPlotsEval(SyncState* const syncState, const unsigned int i, const unsigned int j); static void writeAnalysisTraceTraceForePlotsEval(SyncState* const syncState, @@ -109,6 +111,7 @@ static void writeHistogram(FILE* graphsStream, const struct RttKey* rttKey, static void updateBounds(Bounds** const bounds, Event* const e1, Event* const e2); +static void finalizeAnalysisEvalLP(SyncState* const syncState); // The next group of functions is only needed when computing synchronization // accuracy. #ifdef HAVE_LIBGLPK @@ -119,9 +122,6 @@ static Factors* calculateFactors(glp_prob* const lp, const int direction); static void calculateCompleteFactors(glp_prob* const lp, FactorsCHull* factors); static FactorsCHull** createAllFactors(const unsigned int traceNb); -static inline void finalizeAnalysisEvalLP(SyncState* const syncState); -#else -static void finalizeAnalysisEvalLP(SyncState* const syncState); #endif @@ -138,7 +138,8 @@ static AnalysisModule analysisModuleEval= { .finalizeAnalysis= &finalizeAnalysisEval, .printAnalysisStats= &printAnalysisStatsEval, .graphFunctions= { - .writeTraceTimeBackPlots= &writeAnalysisTraceTimePlotsEval, + .writeTraceTimeBackPlots= &writeAnalysisTraceTimeBackPlotsEval, + .writeTraceTimeForePlots= &writeAnalysisTraceTimeForePlotsEval, .writeTraceTraceBackPlots= &writeAnalysisTraceTraceBackPlotsEval, .writeTraceTraceForePlots= &writeAnalysisTraceTraceForePlotsEval, } @@ -147,7 +148,6 @@ static AnalysisModule analysisModuleEval= { static ModuleOption optionEvalRttFile= { .longName= "eval-rtt-file", .hasArg= REQUIRED_ARG, - {.arg= NULL}, .optionHelp= "specify the file containing RTT information", .argHelp= "FILE", }; @@ -306,7 +306,7 @@ static AnalysisHistogramEval* constructAnalysisHistogramEval(const char* const convertIP(saddr, rttKey->saddr); convertIP(daddr, rttKey->daddr); - cwd= changeToGraphDir(graphsDir); + cwd= changeToGraphsDir(graphsDir); for (i= 0; i < sizeof(loopValues) / sizeof(*loopValues); i++) { @@ -529,7 +529,7 @@ static void writeHistogram(FILE* graphsStream, const struct RttKey* rttKey, */ static void destroyAnalysisEval(SyncState* const syncState) { - unsigned int i, j; + unsigned int i; AnalysisDataEval* analysisData; analysisData= (AnalysisDataEval*) syncState->analysisData; @@ -579,10 +579,12 @@ static void destroyAnalysisEval(SyncState* const syncState) #ifdef HAVE_LIBGLPK for (i= 0; i < syncState->traceNb; i++) { + unsigned int j; + for (j= 0; j < i; j++) { // There seems to be a memory leak in glpk, valgrind reports a - // loss even if the problem is deleted + // loss (reachable) even if the problem is deleted glp_delete_prob(graphs->lps[i][j]); } free(graphs->lps[i]); @@ -622,8 +624,7 @@ static void analyzeMessageEval(SyncState* const syncState, Message* const message) { AnalysisDataEval* analysisData= syncState->analysisData; - MessageStats* messageStats= - &analysisData->stats->messageStats[message->outE->traceNum][message->inE->traceNum]; + MessageStats* messageStats; double* rtt; double tt; struct RttKey rttKey; @@ -632,6 +633,8 @@ static void analyzeMessageEval(SyncState* const syncState, Message* const if (syncState->stats) { + messageStats= + &analysisData->stats->messageStats[message->outE->traceNum][message->inE->traceNum]; messageStats->total++; } @@ -982,6 +985,7 @@ static void printAnalysisStatsEval(SyncState* const syncState) g_hash_table_foreach(analysisData->stats->exchangeRtt, &ghfPrintExchangeRtt, analysisData->rttInfo); +#ifdef HAVE_LIBGLPK printf("\tConvex hull factors comparisons:\n" "\t\tTrace pair Factors type Differences (lp - chull)\n" "\t\t a0 a1\n" @@ -1018,6 +1022,7 @@ static void printAnalysisStatsEval(SyncState* const syncState) } } } +#endif } @@ -1721,37 +1726,36 @@ static FactorsCHull** createAllFactors(const unsigned int traceNb) * Compute synchronization factors using a linear programming approach. * Compute the factors using analysis_chull. Compare the two. * - * There are two definitions of this function. The empty one is used when the - * solver library, glpk, is not available at build time. In that case, nothing - * is actually produced. + * When the solver library, glpk, is not available at build time, only compute + * the factors using analysis_chull. This is to make sure that module runs its + * finalize function so that its graph functions can be called later. * * Args: * syncState: container for synchronization data */ -#ifndef HAVE_LIBGLPK -static inline void finalizeAnalysisEvalLP(SyncState* const syncState) -{ -} -#else static void finalizeAnalysisEvalLP(SyncState* const syncState) { - unsigned int i, j; AnalysisDataEval* analysisData= syncState->analysisData; +#ifdef HAVE_LIBGLPK + unsigned int i, j; AnalysisDataCHull* chAnalysisData= analysisData->chullSS->analysisData; - FactorsCHull** lpFactorsArray= createAllFactors(syncState->traceNb); - FactorsCHull* lpFactors; + FactorsCHull** lpFactorsArray; if (!syncState->stats && !syncState->graphsStream) { return; } + /* Because of matching_distributor, this analysis may be called twice. + * Only run it once */ if ((syncState->graphsStream && analysisData->graphs->lps != NULL) || (syncState->stats && analysisData->stats->chFactorsArray != NULL)) { return; } + lpFactorsArray= createAllFactors(syncState->traceNb); + if (syncState->stats) { analysisData->stats->chFactorsArray= @@ -1791,15 +1795,14 @@ static void finalizeAnalysisEvalLP(SyncState* const syncState) else { glp_delete_prob(lp); - destroyFactorsCHull(lpFactors); } } } +#endif g_array_free(analysisData->chullSS->analysisModule->finalizeAnalysis(analysisData->chullSS), TRUE); } -#endif /* @@ -1807,24 +1810,18 @@ static void finalizeAnalysisEvalLP(SyncState* const syncState) * approach. Write the neccessary data files and plot lines in the gnuplot * script. * - * There are two definitions of this function. The empty one is used when the - * solver library, glpk, is not available at build time. In that case, nothing - * is actually produced. + * When the solver library, glpk, is not available at build time nothing is + * actually produced. * * Args: * syncState: container for synchronization data * i: first trace number * j: second trace number, garanteed to be larger than i */ -#ifndef HAVE_LIBGLPK -static inline void writeAccuracyGraphs(SyncState* const syncState, const - unsigned int i, const unsigned int j) -{ -} -#else -static void writeAccuracyGraphs(SyncState* const syncState, const unsigned int - i, const unsigned int j) +static void writeAnalysisTraceTimeBackPlotsEval(SyncState* const syncState, + const unsigned int i, const unsigned int j) { +#ifdef HAVE_LIBGLPK unsigned int it; AnalysisDataEval* analysisData= syncState->analysisData; AnalysisGraphsEval* graphs= analysisData->graphs; @@ -1848,7 +1845,7 @@ static void writeAccuracyGraphs(SyncState* const syncState, const unsigned int snprintf(fileName, 40, "analysis_eval_accuracy-%03u_and_%03u.data", i, j); fileName[sizeof(fileName) - 1]= '\0'; - cwd= changeToGraphDir(syncState->graphsDir); + cwd= changeToGraphsDir(syncState->graphsDir); if ((fp= fopen(fileName, "w")) == NULL) { @@ -1934,34 +1931,40 @@ static void writeAccuracyGraphs(SyncState* const syncState, const unsigned int "linecolor rgb \"black\" fill solid 0.25 noborder, \\\n", i, j); } -} #endif +} /* * Write the analysis-specific graph lines in the gnuplot script. * + * When the solver library, glpk, is not available at build time nothing is + * actually produced. + * * Args: * syncState: container for synchronization data * i: first trace number * j: second trace number, garanteed to be larger than i */ -static void writeAnalysisTraceTimePlotsEval(SyncState* const syncState, const - unsigned int i, const unsigned int j) +static void writeAnalysisTraceTimeForePlotsEval(SyncState* const syncState, + const unsigned int i, const unsigned int j) { - AnalysisDataEval* analysisData= syncState->analysisData; - AnalysisGraphsEval* graphs= analysisData->graphs; - GQueue*** hullArray= ((AnalysisDataCHull*) - analysisData->chullSS->analysisData)->hullArray; - - printf("Between %u and %u:\n", i, j); - printf("\tbounds min %llu max %llu\n", graphs->bounds[j][i].min, - graphs->bounds[j][i].max); - printf("\tnumber of points in lower half-hull %u upper half-hull %u\n", - g_queue_get_length(hullArray[j][i]), - g_queue_get_length(hullArray[i][j])); - - writeAccuracyGraphs(syncState, i, j); +#ifdef HAVE_LIBGLPK + if (((AnalysisDataEval*) + syncState->analysisData)->graphs->lpFactorsArray[j][i].type == + MIDDLE) + { + fprintf(syncState->graphsStream, + "\t\"analysis_eval_accuracy-%1$03u_and_%2$03u.data\" " + "using 1:(($3 - $2) / clock_freq_%2$u) notitle " + "with lines linewidth 2 linetype 1 " + "linecolor rgb \"gray60\", \\\n" + "\t\"analysis_eval_accuracy-%1$03u_and_%2$03u.data\" " + "using 1:(($4 - $2) / clock_freq_%2$u) notitle " + "with lines linewidth 2 linetype 1 " + "linecolor rgb \"gray60\", \\\n", i, j); + } +#endif }