diff --git a/include/blt/profiling/profiler_v2.h b/include/blt/profiling/profiler_v2.h index 7f57fc5..3ad1486 100644 --- a/include/blt/profiling/profiler_v2.h +++ b/include/blt/profiling/profiler_v2.h @@ -137,4 +137,31 @@ namespace blt } +#ifdef BLT_DISABLE_PROFILING + #define BLT_START_INTERVAL(profileName, intervalName) + #define BLT_END_INTERVAL(profileName, intervalName) + #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. + */ + #define BLT_START_INTERVAL(profileName, intervalName) blt::_internal::startInterval(profileName, intervalName) +/** + * Ends an interval, adds the interval to the profile. + */ + #define BLT_END_INTERVAL(profileName, intervalName) blt::_internal::endInterval(profileName, intervalName) +/** + * Prints the profile order from least time to most time. + * @param profileName the profile to print + * @param loggingLevel blt::logging::LOG_LEVEL to log with (default: BLT_NONE) + * @param averageHistory use the historical collection of interval rows in an average or just the latest? (default: false) + */ + #define BLT_PRINT_PROFILE(profileName, ...) blt::_internal::printProfile(profileName, ##__VA_ARGS__) +/** + * writes the profile to an output stream, ordered from least time to most time, in CSV format. + */ + #define BLT_WRITE_PROFILE(stream, profileName) blt::_internal::writeProfile(stream, profileName) +#endif + #endif //BLT_PROFILER_V2_H diff --git a/src/blt/profiling/profiler_v2.cpp b/src/blt/profiling/profiler_v2.cpp index abc8d0c..d6d4eae 100644 --- a/src/blt/profiling/profiler_v2.cpp +++ b/src/blt/profiling/profiler_v2.cpp @@ -105,15 +105,12 @@ namespace blt switch (sort) { case sort_by::CYCLES: - BLT_DEBUG("Cycles"); sort_func = SORT_INTERVALS_FUNC_MACRO(use_history, cycles_start, cycles_end, cycles_total); break; case sort_by::WALL: - BLT_TRACE("WaLL"); sort_func = SORT_INTERVALS_FUNC_MACRO(use_history, wall_start, wall_end, wall_total); break; case sort_by::THREAD: - BLT_INFO("Thread!"); sort_func = SORT_INTERVALS_FUNC_MACRO(use_history, thread_start, thread_end, thread_total); break; }