test_utils: allow printint multiple argument in the performance log

This commit is contained in:
Michael (XIAO Xufeng) 2021-05-28 20:08:51 +08:00
parent 71f63df9d5
commit 39f39ac53d

View File

@ -47,28 +47,28 @@ extern "C" {
#define _TEST_PERFORMANCE_ASSERT(ARG) printf("Ignoring performance test [%s]\n", PERFORMANCE_STR(ARG)) #define _TEST_PERFORMANCE_ASSERT(ARG) printf("Ignoring performance test [%s]\n", PERFORMANCE_STR(ARG))
#endif #endif
#define TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value) do { \ #define TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value, ...) do { \
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); \ IDF_LOG_PERFORMANCE(#name, value_fmt, value, ##__VA_ARGS__); \
_TEST_PERFORMANCE_ASSERT(value < PERFORMANCE_CON(IDF_PERFORMANCE_MAX_, name)); \ _TEST_PERFORMANCE_ASSERT(value < PERFORMANCE_CON(IDF_PERFORMANCE_MAX_, name)); \
} while(0) } while(0)
#define TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value) do { \ #define TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value, ...) do { \
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); \ IDF_LOG_PERFORMANCE(#name, value_fmt, value, ##__VA_ARGS__); \
_TEST_PERFORMANCE_ASSERT(value > PERFORMANCE_CON(IDF_PERFORMANCE_MIN_, name)); \ _TEST_PERFORMANCE_ASSERT(value > PERFORMANCE_CON(IDF_PERFORMANCE_MIN_, name)); \
} while(0) } while(0)
/* Macros to be used when performance is calculated using the cache compensated timer /* Macros to be used when performance is calculated using the cache compensated timer
will not assert if ccomp not supported */ will not assert if ccomp not supported */
#if SOC_CCOMP_TIMER_SUPPORTED #if SOC_CCOMP_TIMER_SUPPORTED
#define TEST_PERFORMANCE_CCOMP_GREATER_THAN(name, value_fmt, value) \ #define TEST_PERFORMANCE_CCOMP_GREATER_THAN(name, value_fmt, value, ...) \
TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value) TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value, ##__VA_ARGS__)
#define TEST_PERFORMANCE_CCOMP_LESS_THAN(name, value_fmt, value) \ #define TEST_PERFORMANCE_CCOMP_LESS_THAN(name, value_fmt, value, ...) \
TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value) TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value, ##__VA_ARGS__)
#else #else
#define TEST_PERFORMANCE_CCOMP_GREATER_THAN(name, value_fmt, value) \ #define TEST_PERFORMANCE_CCOMP_GREATER_THAN(name, value_fmt, value, ...) \
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); IDF_LOG_PERFORMANCE(#name, value_fmt, value, ##__VA_ARGS__)
#define TEST_PERFORMANCE_CCOMP_LESS_THAN(name, value_fmt, value) \ #define TEST_PERFORMANCE_CCOMP_LESS_THAN(name, value_fmt, value, ...) \
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); IDF_LOG_PERFORMANCE(#name, value_fmt, value, ##__VA_ARGS__)
#endif //SOC_CCOMP_TIMER_SUPPORTED #endif //SOC_CCOMP_TIMER_SUPPORTED
@ -77,8 +77,8 @@ extern "C" {
* @param value_fmt: print format and unit of the value, for example: "%02fms", "%dKB" * @param value_fmt: print format and unit of the value, for example: "%02fms", "%dKB"
* @param value : the performance value. * @param value : the performance value.
*/ */
#define IDF_LOG_PERFORMANCE(item, value_fmt, value) \ #define IDF_LOG_PERFORMANCE(item, value_fmt, value, ...) \
printf("[Performance][%s]: "value_fmt"\n", item, value) printf("[Performance][%s]: "value_fmt"\n", item, value, ##__VA_ARGS__)
/* Some definitions applicable to Unity running in FreeRTOS */ /* Some definitions applicable to Unity running in FreeRTOS */