From b2116fd9e9e484aec16dc3903c331d9fae3434ff Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 17:26:29 +0100 Subject: [PATCH] added benchmarks; needed mutex header --- CMakeLists.txt | 5 +++ benchmark/CMakeLists.txt | 44 +++++++++++++++++++++++++++ benchmark/include/bench_framework.hpp | 1 + 3 files changed, 50 insertions(+) create mode 100644 benchmark/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 72e308dba..b2a86d971 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,8 @@ option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON) option(BUILD_DEMO_VIEWER "builds the demo viewer" ON) option(BUILD_DEMO_CPP "builds the demo c++ application" ON) +option(BUILD_BENCHMARK "builds benchmark project" ON) + option(BUILD_UTILITY_GEOMETRY_TO_WKB "builds the utility program geometry_to_wkb" ON) option(BUILD_UTILITY_MAPNIK_INDEX "builds the utility program mapnik_index" ON) option(BUILD_UTILITY_MAPNIK_RENDER "builds the utility program mapnik_render" ON) @@ -264,6 +266,9 @@ add_subdirectory(src) add_subdirectory(plugins) add_subdirectory(utils) add_subdirectory(demo) +if(BUILD_BENCHMARK) + add_subdirectory(benchmark) +endif() if(BUILD_TEST) enable_testing() add_subdirectory(test) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt new file mode 100644 index 000000000..825fc95ea --- /dev/null +++ b/benchmark/CMakeLists.txt @@ -0,0 +1,44 @@ +project(mapnik-benchmark) + +set(BENCHMARK_SRCS + src/normalize_angle.cpp + src/test_array_allocation.cpp + src/test_expression_parse.cpp + src/test_face_ptr_creation.cpp + src/test_font_registration.cpp + src/test_getline.cpp + src/test_marker_cache.cpp + src/test_noop_rendering.cpp + src/test_numeric_cast_vs_static_cast.cpp + src/test_offset_converter.cpp + src/test_png_encoding1.cpp + src/test_png_encoding2.cpp + src/test_polygon_clipping_rendering.cpp + src/test_polygon_clipping.cpp + src/test_proj_transform1.cpp + src/test_quad_tree.cpp + src/test_rendering_shared_map.cpp + src/test_rendering.cpp + src/test_to_bool.cpp + src/test_to_double.cpp + src/test_to_int.cpp + src/test_to_string1.cpp + src/test_to_string2.cpp + src/test_utf_encoding.cpp +) +macro(mapnik_create_benchmark) + get_filename_component(BENCHNAME ${ARGV0} NAME_WE) + add_executable(mapnik-benchmark-${BENCHNAME} ${ARGV0}) + target_include_directories(mapnik-benchmark-${BENCHNAME} PRIVATE include) + target_link_libraries(mapnik-benchmark-${BENCHNAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik) + + if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) + include(CopyDllsForDebug) + add_custom_command(TARGET mapnik-benchmark-${BENCHNAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) + copy_dlls_for_debug(mapnik-benchmark-${BENCHNAME} \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") + endif() +endmacro() + +foreach(benchmark ${BENCHMARK_SRCS}) + mapnik_create_benchmark(${benchmark}) +endforeach() diff --git a/benchmark/include/bench_framework.hpp b/benchmark/include/bench_framework.hpp index df2a9e57b..c7729dd16 100644 --- a/benchmark/include/bench_framework.hpp +++ b/benchmark/include/bench_framework.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include namespace benchmark {