diff --git a/src/ior-output.c b/src/ior-output.c index 4c05170..b1a547a 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -20,6 +20,8 @@ void PrintTableHeader(){ fprintf(out_resultfile, "\n"); fprintf(out_resultfile, "access bw(MiB/s) IOPS Latency(s) block(KiB) xfer(KiB) open(s) wr/rd(s) close(s) total(s) iter\n"); fprintf(out_resultfile, "------ --------- ---- ---------- ---------- --------- -------- -------- -------- -------- ----\n"); + }else if(outputFormat == OUTPUT_CSV){ + fprintf(out_resultfile, "access,bw(MiB/s),IOPS,Latency,block(KiB),xfer(KiB),open(s),wr/rd(s),close(s),total(s),iter\n"); } } @@ -45,8 +47,6 @@ static void PrintKeyValStart(char * key){ } if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\"%s\": \"", key); - }else if(outputFormat == OUTPUT_CSV){ - } } @@ -84,7 +84,7 @@ static void PrintKeyVal(char * key, char * value){ if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\"%s\": \"%s\"", key, value); }else if(outputFormat == OUTPUT_CSV){ - fprintf(out_resultfile, "%s", value); + fprintf(out_resultfile, "%s,", value); } } @@ -98,7 +98,7 @@ static void PrintKeyValDouble(char * key, double value){ if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\"%s\": %.4f", key, value); }else if(outputFormat == OUTPUT_CSV){ - fprintf(out_resultfile, "%.4f", value); + fprintf(out_resultfile, "%.4f,", value); } } @@ -113,7 +113,7 @@ static void PrintKeyValInt(char * key, int64_t value){ if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\"%s\": %lld", key, (long long) value); }else if(outputFormat == OUTPUT_CSV){ - fprintf(out_resultfile, "%lld", (long long) value); + fprintf(out_resultfile, "%lld,", (long long) value); } } @@ -203,13 +203,16 @@ void PrintRepeatEnd(){ void PrintRepeatStart(){ if (rank != 0) return; - if( outputFormat == OUTPUT_DEFAULT){ + if(outputFormat == OUTPUT_DEFAULT){ return; } PrintArrayStart(); } void PrintTestEnds(){ + if (outputFormat == OUTPUT_CSV){ + return; + } if (rank != 0 || verbose <= VERBOSE_0) { PrintEndSection(); return; @@ -246,7 +249,20 @@ void PrintReducedResult(IOR_test_t *test, int access, double bw, double iops, do PrintKeyValDouble("closeTime", diff_subset[2]); PrintKeyValDouble("totalTime", totalTime); PrintEndSection(); + }else if (outputFormat == OUTPUT_CSV){ + PrintKeyVal("access", access == WRITE ? "write" : "read"); + PrintKeyValDouble("bwMiB", bw / MEBIBYTE); + PrintKeyValDouble("iops", iops); + PrintKeyValDouble("latency", latency); + PrintKeyValDouble("blockKiB", (double)test->params.blockSize / KIBIBYTE); + PrintKeyValDouble("xferKiB", (double)test->params.transferSize / KIBIBYTE); + PrintKeyValDouble("openTime", diff_subset[0]); + PrintKeyValDouble("wrRdTime", diff_subset[1]); + PrintKeyValDouble("closeTime", diff_subset[2]); + PrintKeyValDouble("totalTime", totalTime); + fprintf(out_resultfile, "%d\n", rep); } + fflush(out_resultfile); } @@ -258,6 +274,10 @@ void PrintHeader(int argc, char **argv) if (rank != 0) return; + if (outputFormat == OUTPUT_CSV){ + return; + } + PrintStartSection(); if (outputFormat != OUTPUT_DEFAULT){ PrintKeyVal("Version", META_VERSION); @@ -319,6 +339,9 @@ void PrintHeader(int argc, char **argv) */ void ShowTestStart(IOR_param_t *test) { + if (outputFormat == OUTPUT_CSV){ + return; + } PrintStartSection(); PrintKeyValInt("TestID", test->id); PrintKeyVal("StartTime", CurrentTimeString()); @@ -401,6 +424,9 @@ void ShowTestEnd(IOR_test_t *tptr){ */ void ShowSetup(IOR_param_t *params) { + if (outputFormat == OUTPUT_CSV){ + return; + } if (params->debug) { fprintf(out_logfile, "\n*** DEBUG MODE ***\n"); fprintf(out_logfile, "*** %s ***\n\n", params->debug); @@ -612,8 +638,6 @@ static void PrintLongSummaryOneOperation(IOR_test_t *test, const int access) } PrintKeyValDouble("xsizeMiB", (double) point->aggFileSizeForBW / MEBIBYTE); PrintEndSection(); - }else if (outputFormat == OUTPUT_CSV){ - } fflush(out_resultfile); @@ -638,7 +662,7 @@ void PrintLongSummaryHeader() if (rank != 0 || verbose <= VERBOSE_0) return; if(outputFormat != OUTPUT_DEFAULT){ - return; + return; } fprintf(out_resultfile, "\n"); @@ -665,8 +689,6 @@ void PrintLongSummaryAllTests(IOR_test_t *tests_head) fprintf(out_resultfile, "Summary of all tests:"); }else if (outputFormat == OUTPUT_JSON){ PrintNamedArrayStart("summary"); - }else if (outputFormat == OUTPUT_CSV){ - } PrintLongSummaryHeader();