From: Benjamin Poirier Date: Fri, 6 Nov 2009 21:56:40 +0000 (-0500) Subject: Print a sum row in the evaluation statistics X-Git-Tag: v0.12.26~37 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f109919bd6649a6e21a0719a174b5efabd989225;p=lttv.git Print a sum row in the evaluation statistics Signed-off-by: Benjamin Poirier --- diff --git a/lttv/lttv/sync/event_analysis_eval.c b/lttv/lttv/sync/event_analysis_eval.c index 5dd1f6df..b8f3b858 100644 --- a/lttv/lttv/sync/event_analysis_eval.c +++ b/lttv/lttv/sync/event_analysis_eval.c @@ -690,7 +690,9 @@ static GArray* finalizeAnalysisEval(SyncState* const syncState) static void printAnalysisStatsEval(SyncState* const syncState) { AnalysisDataEval* analysisData; - unsigned int i, j; + unsigned int i, j, k; + unsigned int totInversion= 0, totTooFast= 0, totNoInfo= 0, totTotal= 0; + int charNb; if (!syncState->stats) { @@ -707,27 +709,53 @@ static void printAnalysisStatsEval(SyncState* const syncState) analysisData->stats->broadcastNb); printf("\tIndividual evaluation:\n" - "\t\tTrace pair Inversions Too fast (No RTT info) Total\n"); + "\t\tTrace pair Inversions Too fast No RTT info Total\n"); for (i= 0; i < syncState->traceNb; i++) { for (j= i + 1; j < syncState->traceNb; j++) { MessageStats* messageStats; - const char* format= "\t\t%3d - %-3d %-10u %-10u %-10u %u\n"; - - messageStats= &analysisData->stats->messageStats[i][j]; - - printf(format, i, j, messageStats->inversionNb, messageStats->tooFastNb, - messageStats->noRTTInfoNb, messageStats->total); - - messageStats= &analysisData->stats->messageStats[j][i]; - - printf(format, j, i, messageStats->inversionNb, messageStats->tooFastNb, - messageStats->noRTTInfoNb, messageStats->total); + struct { + unsigned int t1, t2; + } loopValues[]= { + {i, j}, + {j, i} + }; + + for (k= 0; k < sizeof(loopValues) / sizeof(*loopValues); k++) + { + messageStats= + &analysisData->stats->messageStats[loopValues[k].t1][loopValues[k].t2]; + + printf("\t\t%3d - %-3d ", loopValues[k].t1, loopValues[k].t2); + printf("%u (%u%%)%n", messageStats->inversionNb, (unsigned + int) ceil((double) messageStats->inversionNb / + messageStats->total * 100), &charNb); + printf("%*s", 17 - charNb > 0 ? 17 - charNb + 1: 1, " "); + printf("%u (%u%%)%n", messageStats->tooFastNb, (unsigned int) + ceil((double) messageStats->tooFastNb / + messageStats->total * 100), &charNb); + printf("%*s%-10u %u\n", 17 - charNb > 0 ? 17 - charNb + 1: + 1, " ", messageStats->noRTTInfoNb, messageStats->total); + + totInversion+= messageStats->inversionNb; + totTooFast+= messageStats->tooFastNb; + totNoInfo+= messageStats->noRTTInfoNb; + totTotal+= messageStats->total; + } } } + printf("\t\t total "); + printf("%u (%u%%)%n", totInversion, (unsigned int) ceil((double) + totInversion / totTotal * 100), &charNb); + printf("%*s", 17 - charNb > 0 ? 17 - charNb + 1: 1, " "); + printf("%u (%u%%)%n", totTooFast, (unsigned int) ceil((double) totTooFast + / totTotal * 100), &charNb); + printf("%*s%-10u %u\n", 17 - charNb > 0 ? 17 - charNb + 1: 1, " ", + totNoInfo, totTotal); + printf("\tRound-trip times:\n" "\t\tHost pair RTT from exchanges RTTs from file (ms)\n"); g_hash_table_foreach(analysisData->stats->exchangeRtt,