Merge pull request #3166 from facebook/warning_clockt

display a warning message when using C90 clock_t
This commit is contained in:
Yann Collet 2022-06-19 14:45:49 -07:00 committed by GitHub
commit f15dd6420c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -13,7 +13,7 @@
* Tuning parameters
****************************************/
#ifndef BMK_TIMETEST_DEFAULT_S /* default minimum time per test */
#define BMK_TIMETEST_DEFAULT_S 3
# define BMK_TIMETEST_DEFAULT_S 3
#endif
@ -387,6 +387,13 @@ BMK_benchMemAdvancedNoAlloc(
RDG_genBuffer(compressedBuffer, maxCompressedSize, 0.10, 0.50, 1);
}
#if defined(UTIL_TIME_USES_C90_CLOCK)
if (adv->nbWorkers > 1) {
OUTPUTLEVEL(2, "Warning : time measurements restricted to C90 clock_t. \n")
OUTPUTLEVEL(2, "Warning : using C90 clock_t leads to incorrect measurements in multithreading mode. \n")
}
#endif
/* Bench */
{ U64 const crcOrig = (adv->mode == BMK_decodeOnly) ? 0 : XXH64(srcBuffer, srcSize, 0);
# define NB_MARKS 4

View File

@ -65,6 +65,7 @@ extern "C" {
#else /* relies on standard C90 (note : clock_t measurements can be wrong when using multi-threading) */
#define UTIL_TIME_USES_C90_CLOCK
typedef clock_t UTIL_time_t;
#define UTIL_TIME_INITIALIZER 0