zstdcli : moving cpu load calculation from FIO_compressFilename_dstFile to FIO_compressFilename_internal
This commit is contained in:
parent
2841c79e87
commit
5fe974261b
@ -1165,6 +1165,9 @@ FIO_compressFilename_internal(FIO_prefs_t* const prefs,
|
|||||||
const char* dstFileName, const char* srcFileName,
|
const char* dstFileName, const char* srcFileName,
|
||||||
int compressionLevel)
|
int compressionLevel)
|
||||||
{
|
{
|
||||||
|
UTIL_time_t const timeStart = UTIL_getTime();;
|
||||||
|
clock_t const cpuStart = clock();
|
||||||
|
|
||||||
U64 readsize = 0;
|
U64 readsize = 0;
|
||||||
U64 compressedfilesize = 0;
|
U64 compressedfilesize = 0;
|
||||||
U64 const fileSize = UTIL_getFileSize(srcFileName);
|
U64 const fileSize = UTIL_getFileSize(srcFileName);
|
||||||
@ -1217,6 +1220,15 @@ FIO_compressFilename_internal(FIO_prefs_t* const prefs,
|
|||||||
(unsigned long long)readsize, (unsigned long long) compressedfilesize,
|
(unsigned long long)readsize, (unsigned long long) compressedfilesize,
|
||||||
dstFileName);
|
dstFileName);
|
||||||
|
|
||||||
|
/* Elapsed Time and CPU Load */
|
||||||
|
{ clock_t const cpuEnd = clock();
|
||||||
|
double const cpuLoad_s = (double)(cpuEnd - cpuStart) / CLOCKS_PER_SEC;
|
||||||
|
U64 const timeLength_ns = UTIL_clockSpanNano(timeStart);
|
||||||
|
double const timeLength_s = (double)timeLength_ns / 1000000000;
|
||||||
|
double const cpuLoad_pct = (cpuLoad_s / timeLength_s) * 100;
|
||||||
|
DISPLAYLEVEL(4, "%s: Completed in %.2f sec (cpu load : %.0f%%)\n",
|
||||||
|
srcFileName, timeLength_s, cpuLoad_pct);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,9 +1248,6 @@ static int FIO_compressFilename_dstFile(FIO_prefs_t* const prefs,
|
|||||||
const char* srcFileName,
|
const char* srcFileName,
|
||||||
int compressionLevel)
|
int compressionLevel)
|
||||||
{
|
{
|
||||||
UTIL_time_t timeStart;
|
|
||||||
clock_t cpuStart;
|
|
||||||
|
|
||||||
int closeDstFile = 0;
|
int closeDstFile = 0;
|
||||||
int result;
|
int result;
|
||||||
stat_t statbuf;
|
stat_t statbuf;
|
||||||
@ -1262,9 +1271,6 @@ static int FIO_compressFilename_dstFile(FIO_prefs_t* const prefs,
|
|||||||
transfer_permissions = 1;
|
transfer_permissions = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeStart = UTIL_getTime();
|
|
||||||
cpuStart = clock();
|
|
||||||
|
|
||||||
result = FIO_compressFilename_internal(prefs, ress, dstFileName, srcFileName, compressionLevel);
|
result = FIO_compressFilename_internal(prefs, ress, dstFileName, srcFileName, compressionLevel);
|
||||||
|
|
||||||
if (closeDstFile) {
|
if (closeDstFile) {
|
||||||
@ -1288,14 +1294,7 @@ static int FIO_compressFilename_dstFile(FIO_prefs_t* const prefs,
|
|||||||
UTIL_setFileStat(dstFileName, &statbuf);
|
UTIL_setFileStat(dstFileName, &statbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ clock_t const cpuEnd = clock();
|
|
||||||
double const cpuLoad_s = (double)(cpuEnd - cpuStart) / CLOCKS_PER_SEC;
|
|
||||||
U64 const timeLength_ns = UTIL_clockSpanNano(timeStart);
|
|
||||||
double const timeLength_s = (double)timeLength_ns / 1000000000;
|
|
||||||
double const cpuLoad_pct = (cpuLoad_s / timeLength_s) * 100;
|
|
||||||
DISPLAYLEVEL(4, "%s: Completed in %.2f sec (cpu load : %.0f%%)\n",
|
|
||||||
srcFileName, timeLength_s, cpuLoad_pct);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user