diff --git a/src/omv/common/omv_common.h b/src/omv/common/omv_common.h index 0ca87da2e..2c07b5065 100644 --- a/src/omv/common/omv_common.h +++ b/src/omv/common/omv_common.h @@ -50,8 +50,11 @@ #if OMV_PROFILE_ENABLE #include #include "py/mphal.h" -#define OMV_PROFILE_START(F) mp_uint_t F##_ticks_start_ = mp_hal_ticks_us() -#define OMV_PROFILE_END(F) printf("%s %u us\n", #F, mp_hal_ticks_us() - F##_ticks_start_) +#define OMV_CONCATENATE_DETAIL(x, y) x##y +#define OMV_CONCATENATE(x, y) OMV_CONCATENATE_DETAIL(x, y) + +#define OMV_PROFILE_START(F) mp_uint_t OMV_CONCATENATE(F, _ticks_start_) = mp_hal_ticks_us() +#define OMV_PROFILE_END(F) printf("%s %u us\n", F, mp_hal_ticks_us() - OMV_CONCATENATE(F, _ticks_start_)) #else #define OMV_PROFILE_START(F) #define OMV_PROFILE_END(F)