From 3266a7b102c9b1e6cd57ed0417a691ac1bbe33b1 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 5 Oct 2023 01:31:54 -0400 Subject: [PATCH] fix profiler disable macro --- include/blt/profiling/profiler.h | 4 ++-- include/blt/profiling/profiler_v2.h | 7 ++++++- src/blt/profiling/profiler_v2.cpp | 32 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/include/blt/profiling/profiler.h b/include/blt/profiling/profiler.h index b0f5075..2320080 100755 --- a/include/blt/profiling/profiler.h +++ b/include/blt/profiling/profiler.h @@ -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. diff --git a/include/blt/profiling/profiler_v2.h b/include/blt/profiling/profiler_v2.h index c9db06a..b4e9204 100644 --- a/include/blt/profiling/profiler_v2.h +++ b/include/blt/profiling/profiler_v2.h @@ -11,7 +11,6 @@ #include #include #include -#include #include 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, diff --git a/src/blt/profiling/profiler_v2.cpp b/src/blt/profiling/profiler_v2.cpp index d3a5e68..f3f51a1 100644 --- a/src/blt/profiling/profiler_v2.cpp +++ b/src/blt/profiling/profiler_v2.cpp @@ -8,10 +8,16 @@ #include #include #include +#include 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) + { + + } } \ No newline at end of file