Clean up repetitive display
Add documentation
This commit is contained in:
@@ -127,6 +127,8 @@ Full list of arguments
|
|||||||
-v : Prints Benchmarking output
|
-v : Prints Benchmarking output
|
||||||
-D : Next argument dictionary file
|
-D : Next argument dictionary file
|
||||||
-s : Benchmark all files separately
|
-s : Benchmark all files separately
|
||||||
|
-q : Quiet, repeat for more quiet
|
||||||
|
-v : Verbose, cancels quiet, repeat for more volume
|
||||||
|
|
||||||
```
|
```
|
||||||
Any inputs afterwards are treated as files to benchmark.
|
Any inputs afterwards are treated as files to benchmark.
|
||||||
|
|||||||
+13
-15
@@ -235,7 +235,7 @@ static U32 g_noSeed = 0;
|
|||||||
static paramValues_t g_params; /* Initialized at the beginning of main w/ emptyParams() function */
|
static paramValues_t g_params; /* Initialized at the beginning of main w/ emptyParams() function */
|
||||||
static UTIL_time_t g_time; /* to be used to compare solution finding speeds to compare to original */
|
static UTIL_time_t g_time; /* to be used to compare solution finding speeds to compare to original */
|
||||||
static U32 g_memoTableLog = PARAM_UNSET;
|
static U32 g_memoTableLog = PARAM_UNSET;
|
||||||
static U32 g_displayLevel = 3;
|
static int g_displayLevel = 3;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
directMap,
|
directMap,
|
||||||
@@ -889,7 +889,7 @@ static int createBuffers(buffers_t* buff, const char* const * const fileNamesTab
|
|||||||
goto _cleanUp;
|
goto _cleanUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
DISPLAY("Loading %s... \r", fileNamesTable[n]);
|
DISPLAYLEVEL(2, "Loading %s... \r", fileNamesTable[n]);
|
||||||
|
|
||||||
if (fileSize + pos > benchedSize) fileSize = benchedSize - pos, nbFiles=n; /* buffer too small - stop after this file */
|
if (fileSize + pos > benchedSize) fileSize = benchedSize - pos, nbFiles=n; /* buffer too small - stop after this file */
|
||||||
{
|
{
|
||||||
@@ -2020,7 +2020,6 @@ static winnerInfo_t climbOnce(const constraint_t target,
|
|||||||
better = 0;
|
better = 0;
|
||||||
DEBUGOUTPUT("Start\n");
|
DEBUGOUTPUT("Start\n");
|
||||||
cparam = winnerInfo.params;
|
cparam = winnerInfo.params;
|
||||||
BMK_printWinnerOpt(stdout, CUSTOM_LEVEL, winnerInfo.result, winnerInfo.params, target, buf.srcSize);
|
|
||||||
candidateInfo.params = cparam;
|
candidateInfo.params = cparam;
|
||||||
/* all dist-1 candidates */
|
/* all dist-1 candidates */
|
||||||
for(i = 0; i < varLen; i++) {
|
for(i = 0; i < varLen; i++) {
|
||||||
@@ -2036,7 +2035,6 @@ static winnerInfo_t climbOnce(const constraint_t target,
|
|||||||
DEBUGOUTPUT("Res: %d\n", res);
|
DEBUGOUTPUT("Res: %d\n", res);
|
||||||
if(res == BETTER_RESULT) { /* synonymous with better when called w/ infeasibleBM */
|
if(res == BETTER_RESULT) { /* synonymous with better when called w/ infeasibleBM */
|
||||||
winnerInfo = candidateInfo;
|
winnerInfo = candidateInfo;
|
||||||
BMK_printWinnerOpt(stdout, CUSTOM_LEVEL, winnerInfo.result, sanitizeParams(winnerInfo.params), target, buf.srcSize);
|
|
||||||
better = 1;
|
better = 1;
|
||||||
if(compareResultLT(bestFeasible1.result, winnerInfo.result, target, buf.srcSize)) {
|
if(compareResultLT(bestFeasible1.result, winnerInfo.result, target, buf.srcSize)) {
|
||||||
bestFeasible1 = winnerInfo;
|
bestFeasible1 = winnerInfo;
|
||||||
@@ -2063,7 +2061,6 @@ static winnerInfo_t climbOnce(const constraint_t target,
|
|||||||
DEBUGOUTPUT("Res: %d\n", res);
|
DEBUGOUTPUT("Res: %d\n", res);
|
||||||
if(res == BETTER_RESULT) { /* synonymous with better in this case*/
|
if(res == BETTER_RESULT) { /* synonymous with better in this case*/
|
||||||
winnerInfo = candidateInfo;
|
winnerInfo = candidateInfo;
|
||||||
BMK_printWinnerOpt(stdout, CUSTOM_LEVEL, winnerInfo.result, sanitizeParams(winnerInfo.params), target, buf.srcSize);
|
|
||||||
better = 1;
|
better = 1;
|
||||||
if(compareResultLT(bestFeasible1.result, winnerInfo.result, target, buf.srcSize)) {
|
if(compareResultLT(bestFeasible1.result, winnerInfo.result, target, buf.srcSize)) {
|
||||||
bestFeasible1 = winnerInfo;
|
bestFeasible1 = winnerInfo;
|
||||||
@@ -2284,7 +2281,7 @@ static int optimizeForSize(const char* const * const fileNamesTable, const size_
|
|||||||
if(target.dSpeed != 0) { DISPLAYLEVEL(2, " - limit decompression speed %u MB/s", target.dSpeed >> 20); }
|
if(target.dSpeed != 0) { DISPLAYLEVEL(2, " - limit decompression speed %u MB/s", target.dSpeed >> 20); }
|
||||||
if(target.cMem != (U32)-1) { DISPLAYLEVEL(2, " - limit memory %u MB", target.cMem >> 20); }
|
if(target.cMem != (U32)-1) { DISPLAYLEVEL(2, " - limit memory %u MB", target.cMem >> 20); }
|
||||||
|
|
||||||
DISPLAY("\n");
|
DISPLAYLEVEL(2, "\n");
|
||||||
findClockGranularity();
|
findClockGranularity();
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -2309,7 +2306,7 @@ static int optimizeForSize(const char* const * const fileNamesTable, const size_
|
|||||||
winner.params = CParams;
|
winner.params = CParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKTIMEGT(ret, 0, _cleanUp); /* if pass time limit, stop */
|
CHECKTIMEGT(ret, 0, _displayCleanUp); /* if pass time limit, stop */
|
||||||
/* if the current params are too slow, just stop. */
|
/* if the current params are too slow, just stop. */
|
||||||
if(target.cSpeed > candidate.cSpeed * 3 / 2) { break; }
|
if(target.cSpeed > candidate.cSpeed * 3 / 2) { break; }
|
||||||
}
|
}
|
||||||
@@ -2332,7 +2329,7 @@ static int optimizeForSize(const char* const * const fileNamesTable, const size_
|
|||||||
if(compareResultLT(winner.result, w1.result, target, buf.srcSize)) {
|
if(compareResultLT(winner.result, w1.result, target, buf.srcSize)) {
|
||||||
winner = w1;
|
winner = w1;
|
||||||
}
|
}
|
||||||
CHECKTIMEGT(ret, 0, _cleanUp);
|
CHECKTIMEGT(ret, 0, _displayCleanUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(st && tries > 0) {
|
while(st && tries > 0) {
|
||||||
@@ -2349,7 +2346,7 @@ static int optimizeForSize(const char* const * const fileNamesTable, const size_
|
|||||||
st = nextStrategy(st, bestStrategy);
|
st = nextStrategy(st, bestStrategy);
|
||||||
tries -= TRY_DECAY;
|
tries -= TRY_DECAY;
|
||||||
}
|
}
|
||||||
CHECKTIMEGT(ret, 0, _cleanUp);
|
CHECKTIMEGT(ret, 0, _displayCleanUp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
winner = optimizeFixedStrategy(buf, ctx, target, paramBase, paramTarget.vals[strt_ind], allMT, g_maxTries);
|
winner = optimizeFixedStrategy(buf, ctx, target, paramBase, paramTarget.vals[strt_ind], allMT, g_maxTries);
|
||||||
@@ -2364,12 +2361,13 @@ static int optimizeForSize(const char* const * const fileNamesTable, const size_
|
|||||||
goto _cleanUp;
|
goto _cleanUp;
|
||||||
}
|
}
|
||||||
/* end summary */
|
/* end summary */
|
||||||
BMK_displayOneResult(stdout, winner, buf.srcSize);
|
_displayCleanUp:
|
||||||
|
if(g_displayLevel >= 0) { BMK_displayOneResult(stdout, winner, buf.srcSize); }
|
||||||
BMK_translateAdvancedParams(stdout, winner.params);
|
BMK_translateAdvancedParams(stdout, winner.params);
|
||||||
DISPLAY("grillParams size - optimizer completed \n");
|
DISPLAYLEVEL(1, "grillParams size - optimizer completed \n");
|
||||||
|
|
||||||
}
|
}
|
||||||
_cleanUp:
|
_cleanUp:
|
||||||
freeContexts(ctx);
|
freeContexts(ctx);
|
||||||
freeBuffers(buf);
|
freeBuffers(buf);
|
||||||
freeMemoTableArray(allMT);
|
freeMemoTableArray(allMT);
|
||||||
@@ -2501,9 +2499,6 @@ int main(int argc, const char** argv)
|
|||||||
|
|
||||||
assert(argc>=1); /* for exename */
|
assert(argc>=1); /* for exename */
|
||||||
|
|
||||||
/* Welcome message */
|
|
||||||
DISPLAYLEVEL(2, WELCOME_MESSAGE);
|
|
||||||
|
|
||||||
for(i=1; i<argc; i++) {
|
for(i=1; i<argc; i++) {
|
||||||
const char* argument = argv[i];
|
const char* argument = argv[i];
|
||||||
DEBUGOUTPUT("%d: %s\n", i, argument);
|
DEBUGOUTPUT("%d: %s\n", i, argument);
|
||||||
@@ -2687,6 +2682,9 @@ int main(int argc, const char** argv)
|
|||||||
if (!input_filename) { input_filename=argument; filenamesStart=i; continue; }
|
if (!input_filename) { input_filename=argument; filenamesStart=i; continue; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Welcome message */
|
||||||
|
DISPLAYLEVEL(2, WELCOME_MESSAGE);
|
||||||
|
|
||||||
if (filenamesStart==0) {
|
if (filenamesStart==0) {
|
||||||
if (g_optimizer) {
|
if (g_optimizer) {
|
||||||
DISPLAY("Optimizer Expects File\n");
|
DISPLAY("Optimizer Expects File\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user