2016-06-14 23:32:35 -04:00
|
|
|
#ifdef DEBUG
|
|
|
|
#pragma once
|
|
|
|
|
2016-11-20 17:04:31 -05:00
|
|
|
#include <chrono>
|
2016-11-25 02:42:31 -05:00
|
|
|
#include <iostream>
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void benchmark_execution_speed(const T& expr) noexcept {
|
|
|
|
auto start = std::chrono::high_resolution_clock::now();
|
|
|
|
expr();
|
|
|
|
auto finish = std::chrono::high_resolution_clock::now();
|
2016-11-25 02:42:31 -05:00
|
|
|
std::cout << "execution speed: " << std::chrono::duration_cast<std::chrono::milliseconds>(finish - start).count()
|
|
|
|
<< "ms" << std::endl;
|
2016-06-14 23:32:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void benchmark_memory_usage(const T& object) noexcept {
|
|
|
|
std::cout << "memory usage: " << sizeof(object) << "b" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|