X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fevent_analysis_eval.c;h=29b1b4493009eabdb2552174a81d289689e1462b;hb=1d597550379cb00832f73bd5402918fd6ed2e9df;hp=ab4cffbef0469e807588e9fecd3d48299e705d19;hpb=66eaf2eba602c331d08677dbb59ec3f9e40f0ccc;p=lttv.git diff --git a/lttv/lttv/sync/event_analysis_eval.c b/lttv/lttv/sync/event_analysis_eval.c index ab4cffbe..29b1b449 100644 --- a/lttv/lttv/sync/event_analysis_eval.c +++ b/lttv/lttv/sync/event_analysis_eval.c @@ -68,10 +68,14 @@ 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 writeAnalysisTraceTracePlotsEval(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, + const unsigned int i, const unsigned int j); // Functions specific to this module static void registerAnalysisEval() __attribute__((constructor (102))); @@ -104,15 +108,18 @@ static void dumpBinToFile(const struct Bins* const bins, FILE* const file); static void writeHistogram(FILE* graphsStream, const struct RttKey* rttKey, double* minRtt, AnalysisHistogramEval* const histogram); -static void updateBounds(Bounds** const bounds, Event* const e1, Event* const e2); +static void updateBounds(Bounds** const bounds, Event* const e1, Event* const + e2); // The next group of functions is only needed when computing synchronization // accuracy. #ifdef HAVE_LIBGLPK -static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const upperHull); +static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const + upperHull); static void gfLPAddRow(gpointer data, gpointer user_data); static Factors* calculateFactors(glp_prob* const lp, const int direction); -static void calculateCompleteFactors(glp_prob* const lp, FactorsCHull* factors); +static void calculateCompleteFactors(glp_prob* const lp, FactorsCHull* + factors); static FactorsCHull** createAllFactors(const unsigned int traceNb); static inline void finalizeAnalysisEvalLP(SyncState* const syncState); #else @@ -133,8 +140,10 @@ static AnalysisModule analysisModuleEval= { .finalizeAnalysis= &finalizeAnalysisEval, .printAnalysisStats= &printAnalysisStatsEval, .graphFunctions= { - .writeTraceTimePlots= &writeAnalysisTraceTimePlotsEval, - .writeTraceTracePlots= &writeAnalysisTraceTracePlotsEval, + .writeTraceTimeBackPlots= &writeAnalysisTraceTimeBackPlotsEval, + .writeTraceTimeForePlots= &writeAnalysisTraceTimeForePlotsEval, + .writeTraceTraceBackPlots= &writeAnalysisTraceTraceBackPlotsEval, + .writeTraceTraceForePlots= &writeAnalysisTraceTraceForePlotsEval, } }; @@ -300,7 +309,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++) { @@ -616,8 +625,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; @@ -626,6 +634,8 @@ static void analyzeMessageEval(SyncState* const syncState, Message* const if (syncState->stats) { + messageStats= + &analysisData->stats->messageStats[message->outE->traceNum][message->inE->traceNum]; messageStats->total++; } @@ -1456,7 +1466,8 @@ static uint32_t normalTotal(struct Bins* const bins) * bounds: the array containing all the trace-pair bounds * e1, e2: the two related events */ -static void updateBounds(Bounds** const bounds, Event* const e1, Event* const e2) +static void updateBounds(Bounds** const bounds, Event* const e1, Event* const + e2) { unsigned int traceI, traceJ; uint64_t messageTime; @@ -1501,7 +1512,8 @@ static void updateBounds(Bounds** const bounds, Event* const e1, Event* const e2 * A new glp_prob*, this problem must be freed by the caller with * glp_delete_prob() */ -static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const upperHull) +static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const + upperHull) { unsigned int it; const int zero= 0; @@ -1799,24 +1811,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; @@ -1840,7 +1846,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) { @@ -1926,42 +1932,54 @@ 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 } -static void writeAnalysisTraceTracePlotsEval(SyncState* const syncState, const - unsigned int i, const unsigned int j) +/* + * Write the analysis-specific graph lines in the gnuplot script. + * + * Args: + * syncState: container for synchronization data + * i: first trace number + * j: second trace number, garanteed to be larger than i + */ +static void writeAnalysisTraceTraceBackPlotsEval(SyncState* const syncState, + const unsigned int i, const unsigned int j) { - AnalysisDataEval* analysisData= syncState->analysisData; - #ifdef HAVE_LIBGLPK fprintf(syncState->graphsStream, "\t\"analysis_eval_accuracy-%1$03u_and_%2$03u.data\" " @@ -1970,7 +1988,22 @@ static void writeAnalysisTraceTracePlotsEval(SyncState* const syncState, const "with filledcurves linewidth 2 linetype 1 " "linecolor rgb \"black\" fill solid 0.25 noborder, \\\n", i, j); #endif +} + + +/* + * Write the analysis-specific graph lines in the gnuplot script. + * + * Args: + * syncState: container for synchronization data + * i: first trace number + * j: second trace number, garanteed to be larger than i + */ +static void writeAnalysisTraceTraceForePlotsEval(SyncState* const syncState, + const unsigned int i, const unsigned int j) +{ + AnalysisDataEval* analysisData= syncState->analysisData; - analysisData->chullSS->analysisModule->graphFunctions.writeTraceTracePlots(analysisData->chullSS, + analysisData->chullSS->analysisModule->graphFunctions.writeTraceTraceForePlots(analysisData->chullSS, i, j); }