diff --git a/lib/common/util.h b/lib/common/util.h index b85c4f9e..3eef4b1d 100644 --- a/lib/common/util.h +++ b/lib/common/util.h @@ -42,7 +42,11 @@ extern "C" { /*-**************************************** * Dependencies ******************************************/ -#include /* clock_t, nanosleep, clock, CLOCKS_PER_SEC */ +#define _POSIX_C_SOURCE 199309L /* before - needed for nanosleep() */ +#include /* clock_t, nanosleep, clock, CLOCKS_PER_SEC */ +#include /* stat */ +#include /* stat */ +#include "mem.h" /* U32, U64 */ /*-**************************************** @@ -99,8 +103,8 @@ extern "C" { UTIL_STATIC U64 UTIL_clockSpanMicro( UTIL_time_t clockStart, UTIL_time_t ticksPerSecond ) { UTIL_time_t clockEnd; - (void)ticksPerSecond; + UTIL_getTime(clockEnd); return UTIL_getSpanTimeMicro(ticksPerSecond, clockStart, clockEnd); } @@ -109,9 +113,12 @@ UTIL_STATIC U64 UTIL_clockSpanMicro( UTIL_time_t clockStart, UTIL_time_t ticksPe UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) { UTIL_time_t clockStart, clockEnd; + (void)ticksPerSecond; + UTIL_getTime(clockStart); - do { UTIL_getTime(clockEnd); } - while (UTIL_getSpanTimeNano(ticksPerSecond, clockStart, clockEnd) == 0); + do { + UTIL_getTime(clockEnd); + } while (UTIL_getSpanTimeNano(ticksPerSecond, clockStart, clockEnd) == 0); } diff --git a/lib/dictBuilder/zdict.c b/lib/dictBuilder/zdict.c index 74d5f36a..95d291f4 100644 --- a/lib/dictBuilder/zdict.c +++ b/lib/dictBuilder/zdict.c @@ -54,8 +54,6 @@ #include /* malloc, free */ #include /* memset */ #include /* fprintf, fopen, ftello64 */ -#include /* stat64 */ -#include /* stat64 */ #include /* clock */ #include "mem.h" /* read */ diff --git a/programs/bench.c b/programs/bench.c index a7a4c579..831cc27e 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -44,18 +44,15 @@ /* ************************************* * Includes ***************************************/ -#define _POSIX_C_SOURCE 199309L /* before - needed for nanosleep() */ #include /* malloc, free */ #include /* memset */ #include /* fprintf, fopen, ftello64 */ -#include /* stat64 */ -#include /* stat64 */ +#include "util.h" /* UTIL_GetFileSize */ #include "mem.h" #include "zstd_static.h" #include "datagen.h" /* RDG_genBuffer */ #include "xxhash.h" -#include "util.h" /* UTIL_GetFileSize */ /* ************************************* diff --git a/programs/dibio.c b/programs/dibio.c index 0e832410..c06d186b 100644 --- a/programs/dibio.c +++ b/programs/dibio.c @@ -46,14 +46,11 @@ #include /* malloc, free */ #include /* memset */ #include /* fprintf, fopen, ftello64 */ -#include /* stat64 */ -#include /* stat64 */ -#include /* clock */ +#include "util.h" /* UTIL_GetFileSize */ #include "mem.h" /* read */ #include "error_private.h" #include "dibio.h" -#include "util.h" /* UTIL_GetFileSize */ /*-************************************* diff --git a/programs/fileio.c b/programs/fileio.c index b69a0cb7..964fc31f 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -60,10 +60,9 @@ #include /* strcmp, strlen */ #include /* clock */ #include /* errno */ -#include /* stat64 */ -#include /* stat64 */ -#include "mem.h" + #include "util.h" /* UTIL_GetFileSize */ +#include "mem.h" #include "fileio.h" #include "zstd_static.h" /* ZSTD_magicNumber, ZSTD_frameHeaderSize_max */ #include "zbuff_static.h" diff --git a/programs/fullbench.c b/programs/fullbench.c index 08ff8973..3188c0f2 100644 --- a/programs/fullbench.c +++ b/programs/fullbench.c @@ -43,17 +43,15 @@ **************************************/ #include /* malloc */ #include /* fprintf, fopen, ftello64 */ -#include /* stat64 */ -#include /* stat64 */ #include /* strcmp */ #include /* clock_t, clock, CLOCKS_PER_SEC */ +#include "util.h" /* UTIL_GetFileSize */ #include "mem.h" #include "zstd_static.h" #include "fse_static.h" #include "zbuff.h" #include "datagen.h" -#include "util.h" /* UTIL_GetFileSize */ /*_************************************ diff --git a/programs/paramgrill.c b/programs/paramgrill.c index 21f69524..a904726a 100644 --- a/programs/paramgrill.c +++ b/programs/paramgrill.c @@ -52,8 +52,6 @@ **************************************/ #include /* malloc */ #include /* fprintf, fopen, ftello64 */ -#include /* stat64 */ -#include /* stat64 */ #include /* strcmp */ #include /* log */ @@ -64,17 +62,17 @@ # include /* gettimeofday */ #endif +#include "util.h" /* UTIL_GetFileSize */ #include "mem.h" #include "zstd_static.h" #include "datagen.h" #include "xxhash.h" -#include "util.h" /* UTIL_GetFileSize */ /*-************************************ * Constants **************************************/ -#define PROGRAM_DESCRIPTION "ZSTD_HC parameters tester" +#define PROGRAM_DESCRIPTION "ZSTD parameters tester" #ifndef ZSTD_VERSION # define ZSTD_VERSION "" #endif