static unsigned g_compressionLevel = DEFAULT_COMPRESSION_LEVEL;
static unsigned g_displayStats = 0;
static clock_t g_time = 0;
+static clock_t g_startTime = 0;
static clock_t const refreshRate = CLOCKS_PER_SEC / 60; /* 60 Hz */
typedef struct {
return arg;
}
-static void displayProgress(unsigned jobDoneID)
+static void displayProgress(unsigned jobDoneID, unsigned cLevel, unsigned last)
{
clock_t currTime = clock();
unsigned const refresh = currTime - g_time > refreshRate ? 1 : 0;
+ double timeElapsed = (double)((currTime - g_startTime) * 1000 / CLOCKS_PER_SEC);
if (refresh) {
- fprintf(stdout, "\r%u jobs completed", jobDoneID+1);
- fflush(stdout);
+ fprintf(stdout, "\r| %4u jobs completed | Current Compresion Level: %2u | Time Elapsed: %5.0fms |", jobDoneID, cLevel, timeElapsed);
+ if (last) {
+ fprintf(stdout, "\n");
+ }
+ else {
+ fflush(stdout);
+ }
}
}
}
}
DEBUGLOG(2, "finished job write %u\n", currJob);
- displayProgress(currJob);
currJob++;
+ displayProgress(currJob, ctx->compressionLevel, currJob >= ctx->lastJobID);
DEBUGLOG(2, "locking job write mutex\n");
pthread_mutex_lock(&ctx->jobWrite_mutex);
ctx->jobWriteID++;
int ret = 0;
adaptCCtx* ctx = NULL;
g_time = clock();
+ g_startTime = clock();
/* checking for errors */