fix profiler disable macro

v1
Brett 2023-10-05 01:31:54 -04:00
parent 620c8b9e33
commit 3266a7b102
3 changed files with 40 additions and 3 deletions

View File

@ -88,8 +88,8 @@ namespace blt::profiling {
#define BLT_START_INTERVAL(profileName, intervalName)
#define BLT_END_INTERVAL(profileName, intervalName)
#define BLT_POINT(profileName, pointName)
#define BLT_PRINT_ORDERED(profileName, ...)
#define BLT_WRITE_ORDERED(profileName, ...)
#define BLT_PRINT_PROFILE(profileName, ...)
#define BLT_WRITE_PROFILE(stream, profileName)
#else
/**
* Starts an interval to be measured, when ended the row will be added to the specified profile.

View File

@ -11,7 +11,6 @@
#include <cstdint>
#include <string>
#include <vector>
#include <blt/std/hashmap.h>
#include <blt/std/logging.h>
namespace blt
@ -83,6 +82,12 @@ namespace blt
void startInterval(interval_t* interval);
inline interval_t* startInterval(profile_t& profiler, std::string interval_name){
auto* p = createInterval(profiler, std::move(interval_name));
startInterval(p);
return p;
}
void endInterval(interval_t* interval);
void printProfile(profile_t& profiler, std::uint32_t flags = PRINT_HISTORY | PRINT_CYCLES | PRINT_THREAD | PRINT_WALL,

View File

@ -8,10 +8,16 @@
#include <blt/std/system.h>
#include <blt/std/format.h>
#include <functional>
#include <blt/std/hashmap.h>
namespace blt
{
/**
* General profiler functions
* --------------------------
*/
#define SORT_INTERVALS_FUNC_MACRO(use_history, TYPE_END, TYPE_START, TYPE_TOTAL) \
[&use_history](const interval_t* a, const interval_t* b) -> bool { \
if (use_history){ \
@ -204,4 +210,30 @@ namespace blt
for (auto* p : cycle_intervals)
delete p;
}
/**
* profiler V1 backwards compat
*/
void _internal::startInterval(const std::string& profile_name, const std::string& interval_name)
{
}
void _internal::endInterval(const std::string& profile_name, const std::string& interval_name)
{
}
void _internal::printProfile(const std::string& profile_name)
{
}
void _internal::writeProfile(const std::string& profile_name)
{
}
}