/* * profile.hpp * * Created on: May 22, 2024 * Author: Dario */ #ifndef STA_CORE_PROFILE_HPP #define STA_CORE_PROFILE_HPP #include #ifdef STA_PROFILING_ENABLED #ifndef STA_DEBUGGING_ENABLED # error "Debugging has to be enabled in order to use profiling." #endif // STA_DEBUGGING_ENABLED #ifndef STA_STM32_DELAY_US_TIM # error "A microsecond timer has to be defined in order to use profiling." #endif // STA_STM32_DELAY_US_TIM namespace sta { class Profiler { public: Profiler(const char* name); ~Profiler(); private: const char* name_; uint32_t start_; }; } // namespace sta /** * */ #define STA_TIME_IT(name) sta::Profiler profiler(name); #else #define STA_TIME_IT(name) ((void)0) #endif // // STA_PROFILING_ENABLED #endif // STA_CORE_PROFILE_HPP