tests FEATURE performance test
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f894e7d..46569a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,6 +205,7 @@
     option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" OFF)
     set(INTERNAL_DOCS NO)
 endif()
+option(ENABLE_PERF_TESTS "Build performance tests" OFF)
 option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
 option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL" OFF)
 
@@ -250,6 +251,24 @@
     endif()
 endif()
 
+if(ENABLE_PERF_TESTS)
+    find_path(CALLGRIND_INCLUDE_DIR
+        NAMES
+        valgrind/callgrind.h
+        PATHS
+        /usr/include
+        /usr/local/include
+        /opt/local/include
+        /sw/include
+        ${CMAKE_INCLUDE_PATH}
+        ${CMAKE_INSTALL_PREFIX}/include)
+    if(CALLGRIND_INCLUDE_DIR)
+        set(HAVE_CALLGRIND 1)
+    else()
+        message(STATUS "Disabling callgrind macros in performance tests because of missing headers")
+    endif()
+endif()
+
 if(ENABLE_COVERAGE)
     gen_coverage_enable(${ENABLE_TESTS})
 endif()
@@ -343,7 +362,7 @@
 endif()
 
 # tests
-if(ENABLE_TESTS)
+if(ENABLE_TESTS OR ENABLE_PERF_TESTS)
     enable_testing()
     add_subdirectory(tests)
 endif()