Code snippet to make benchmarking code performance easier. #1534
DelinWorks
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
Thanks for sharing. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Im using inline const char* benchmark_bb7_name;
inline std::chrono::steady_clock::time_point benchmark_bb7_start;
inline std::chrono::steady_clock::time_point benchmark_bb7_end;
#define BENCHMARK_SECTION_BEGIN(name) benchmark_bb7_name = name; benchmark_bb7_start = std::chrono::high_resolution_clock::now();
#define BENCHMARK_SECTION_END() benchmark_bb7_end = std::chrono::high_resolution_clock::now(); \
AXLOG("benchmark {%s} took: {%i} millis, {%i} micros", benchmark_bb7_name, \
std::chrono::duration_cast<std::chrono::milliseconds>(benchmark_bb7_end - benchmark_bb7_start).count(), \
std::chrono::duration_cast<std::chrono::microseconds>(benchmark_bb7_end - benchmark_bb7_start).count()); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
this pollutes namespaces but can be improved @aismann
Usage:
Beta Was this translation helpful? Give feedback.
All reactions