Skip to content

Instantly share code, notes, and snippets.

@xqms xqms/CMakeLists.txt
Created Jun 14, 2019

Embed
What would you like to do?
Corrade::Utility::Debug benchmark
cmake_minimum_required(VERSION 3.0)
project(corrade_benchmark)
find_package(Corrade REQUIRED Utility)
set(CMAKE_CXX_STANDARD 17)
add_executable(corrade_benchmark main.cpp)
target_link_libraries(corrade_benchmark Corrade::Utility)
install(TARGETS corrade_benchmark RUNTIME DESTINATION bin)
#include <iostream>
#include <sstream>
#include <Corrade/Utility/Debug.h>
#include <geiger/geiger.h>
int main(int argc, char** argv)
{
// This is mandatory before running any benchmarks
geiger::init();
// A benchmark suite that does only time measurement
{
geiger::suite<> s;
s.add("Debug", []()
{
Corrade::Utility::Debug{};
});
// Redirection of each test result to the "console" printer
s.set_printer<geiger::printer::console<>>();
// Run each test during one second
s.run();
}
std::cout << "\n\n";
// A benchmark suite that does only time measurement
{
geiger::suite<> s;
std::stringstream ss;
Corrade::Utility::Debug redirect{&ss};
s.add("scoped debug", []()
{
Corrade::Utility::Debug{} << "c";
});
// Redirection of each test result to the "console" printer
s.set_printer<geiger::printer::console<>>();
// Run each test during one second
s.run();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.