From 7c74bdd6551edf2f6cbe00b6a9a5a96aa31d9e82 Mon Sep 17 00:00:00 2001 From: Schroedi Date: Fri, 25 Aug 2017 15:03:36 +0200 Subject: [PATCH] Revert "Changes to build on windows and use cpp.react with DynCam" --- CMakeLists.txt | 14 ++++++-------- include/react/common/Timing.h | 26 +++++++++++++++++++++++++- src/logging/EventLog.cpp | 6 +++--- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f970330..9ee6d3a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,18 +3,15 @@ cmake_minimum_required (VERSION 2.6) enable_testing() project (CppReact) -find_package(TBB REQUIRED tbb) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set (CMAKE_CXX_STANDARD 14) -if (NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wpedantic") -endif () + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wpedantic") include_directories (SYSTEM "${PROJECT_SOURCE_DIR}/include") -#TODO send diff -include_directories("${TBB_DIR}/../include") + ### CppReact file(GLOB_RECURSE CPPREACT_HEADERS include/*.h) @@ -26,7 +23,8 @@ add_library(CppReact src/logging/EventRecords.cpp ${CPPREACT_HEADERS}) -target_link_libraries(CppReact "${TBB_DIR}/../lib/intel64/vc14/tbb_debug.lib") +target_link_libraries(CppReact tbb) + ### examples/ option(build_examples "Build examples?" ON) if(build_examples) diff --git a/include/react/common/Timing.h b/include/react/common/Timing.h index 2c7e92fc..9440ceaa 100644 --- a/include/react/common/Timing.h +++ b/include/react/common/Timing.h @@ -13,8 +13,17 @@ #include -#include +#if _WIN32 || _WIN64 + #define REACT_FIXME_CUSTOM_TIMER 1 +#else + #define REACT_FIXME_CUSTOM_TIMER 0 +#endif +#if REACT_FIXME_CUSTOM_TIMER + #include +#else + #include +#endif /***************************************/ REACT_IMPL_BEGIN /**************************************/ @@ -22,6 +31,21 @@ /// GetPerformanceFrequency /////////////////////////////////////////////////////////////////////////////////////////////////// // Todo: Initialization not thread-safe +#if REACT_FIXME_CUSTOM_TIMER +inline const LARGE_INTEGER& GetPerformanceFrequency() +{ + static bool init = false; + static LARGE_INTEGER frequency; + + if (init == false) + { + QueryPerformanceFrequency(&frequency); + init = true; + } + + return frequency; +} +#endif /////////////////////////////////////////////////////////////////////////////////////////////////// /// ConditionalTimer diff --git a/src/logging/EventLog.cpp b/src/logging/EventLog.cpp index dba36513..a22601e5 100644 --- a/src/logging/EventLog.cpp +++ b/src/logging/EventLog.cpp @@ -15,7 +15,7 @@ using std::chrono::microseconds; /// EventLog /////////////////////////////////////////////////////////////////////////////////////////////////// EventLog::Entry::Entry() : - time_{ std::chrono::steady_clock::now() }, + time_{ std::chrono::system_clock::now() }, data_{ nullptr } { } @@ -27,7 +27,7 @@ EventLog::Entry::Entry(const Entry& other) : } EventLog::Entry::Entry(IEventRecord* ptr) : - time_{ std::chrono::steady_clock::now() }, + time_{ std::chrono::system_clock::now() }, data_{ ptr } { } @@ -54,7 +54,7 @@ bool EventLog::Entry::Equals(const Entry& other) const } EventLog::EventLog() : - startTime_(std::chrono::steady_clock::now()) + startTime_(std::chrono::system_clock::now()) { }