From 0f17d4860f76f7ae5b64b2eb1f0c3155e9d18697 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 8 Jul 2018 16:56:04 +0100 Subject: [PATCH] Pretty printing for normal output. --- src/ior-output.c | 26 ++++++++++++++++---------- src/utilities.c | 6 +++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/ior-output.c b/src/ior-output.c index e6c20d3..d697c51 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -28,7 +28,7 @@ static int indent = 0; static int needNextToken = 0; static void PrintIndent(){ - if(outputFormat == OUTPUT_CSV){ + if(outputFormat != OUTPUT_JSON){ return; } for(int i=0; i < indent; i++){ @@ -40,10 +40,8 @@ static void PrintIndent(){ static void PrintKeyValStart(char * key){ PrintNextToken(); if (outputFormat == OUTPUT_DEFAULT){ - for(int i=0; i < indent; i++){ - fprintf(out_resultfile, " "); - } - fprintf(out_resultfile, "%s: ", key); + PrintIndent(); + fprintf(out_resultfile, "%-20s: ", key); return; } if(outputFormat == OUTPUT_JSON){ @@ -53,6 +51,12 @@ static void PrintKeyValStart(char * key){ } } +static void PrintNewLine(){ + if (outputFormat == OUTPUT_DEFAULT){ + fprintf(out_resultfile, "\n"); + } +} + static void PrintNextToken(){ if(needNextToken){ needNextToken = 0; @@ -81,7 +85,7 @@ static void PrintKeyVal(char * key, char * value){ PrintNextToken(); needNextToken = 1; if (outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%s: %s\n", key, value); + fprintf(out_resultfile, "%-20s: %s\n", key, value); return; } if(outputFormat == OUTPUT_JSON){ @@ -95,7 +99,7 @@ static void PrintKeyValDouble(char * key, double value){ PrintNextToken(); needNextToken = 1; if (outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%s: %.4f\n", key, value); + fprintf(out_resultfile, "%-20s: %.4f\n", key, value); return; } if(outputFormat == OUTPUT_JSON){ @@ -110,7 +114,7 @@ static void PrintKeyValInt(char * key, int64_t value){ PrintNextToken(); needNextToken = 1; if (outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%s: %lld\n", key, (long long) value); + fprintf(out_resultfile, "%-20s: %lld\n", key, (long long) value); return; } if(outputFormat == OUTPUT_JSON){ @@ -134,10 +138,11 @@ static void PrintNamedSectionStart(char * key){ PrintNextToken(); needNextToken = 0; indent++; + if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\"%s\": {\n", key); }else if(outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%s: \n", key); + fprintf(out_resultfile, "\n%s: \n", key); } } @@ -148,7 +153,7 @@ static void PrintNamedArrayStart(char * key){ if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\"%s\": [\n", key); }else if(outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%s: \n", key); + fprintf(out_resultfile, "\n%s: \n", key); } } @@ -323,6 +328,7 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("stoneWallingWearOut", test->stoneWallingWearOut); PrintKeyValInt("maxTimeDuration", test->maxTimeDuration); PrintKeyValInt("outlierThreshold", test->outlierThreshold); + PrintKeyVal("options", test->options); PrintKeyValInt("nodes", test->nodes); PrintKeyValInt("memoryPerTask", (unsigned long) test->memoryPerTask); diff --git a/src/utilities.c b/src/utilities.c index 40c9c33..acc6a85 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -408,9 +408,9 @@ void ShowFileSystemSize(char *fileSystem) } if(outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "Path: %s\n", realPath); - fprintf(out_resultfile, "FS: %.1f %s Used FS: %2.1f%% ", - totalFileSystemSizeHR, fileSystemUnitStr, + fprintf(out_resultfile, "%-20s: %s\n", "Path", realPath); + fprintf(out_resultfile, "%-20s: %.1f %s Used FS: %2.1f%% ", + "FS", totalFileSystemSizeHR, fileSystemUnitStr, usedFileSystemPercentage); fprintf(out_resultfile, "Inodes: %.1f Mi Used Inodes: %2.1f%%\n", (double)totalInodes / (double)(1<<20),