From 529fc489b446584594c6c52625ca007e8981bd3c Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 4 Aug 2024 15:14:39 +0300 Subject: [PATCH] misc/common: Fix profile macro. --- src/omv/common/omv_common.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)