sta-core/src/debug/profile.cpp
2024-09-23 12:22:18 +02:00

30 lines
423 B
C++

/*
* profiler.cpp
*
* Created on: May 22, 2024
* Author: Dario
*/
#include <sta/debug/profile.hpp>
#ifdef STA_PROFILING_ENABLED
#include <sta/time.hpp>
namespace sta
{
Profiler::Profiler(const char* name)
: name_{name},
start_{timeUs()}
{
}
Profiler::~Profiler()
{
STA_DEBUG_PRINTF(">[PROFILER] %s took %d us", name_, timeUs() - start_);
}
} // namespace sta
#endif // STA_PROFILING_ENABLED