Loading CMakeModules/PerformFeatureChecks.cmake +9 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ macro(perform_feature_checks) include(CheckIncludeFile) #include(CheckFunctionExists) include(CheckLibraryExists) include(CheckSymbolExists) check_include_file("malloc.h" HAVE_MALLOC_H) Loading @@ -55,7 +58,6 @@ macro(perform_feature_checks) # re-introduce this. # check_include_file("strings.h" HAVE_STRINGS_H) include(CheckSymbolExists) check_symbol_exists(strcasecmp "string.h" HAVE_STRCASECMP) check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP) check_symbol_exists(strncasecmp "string.h" HAVE_STRNCASECMP) Loading @@ -70,6 +72,12 @@ macro(perform_feature_checks) check_symbol_exists(_snprintf "stdio.h" HAVE_ISO_SNPRINTF) check_symbol_exists(_hypot "math.h" HAVE_ISO_HYPOT) #check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) # HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC check_symbol_exists(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY_FUNC) # Generate config.h. configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) Loading CMakeModules/config.h.cmake +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ #define hypot _hypot #endif #cmakedefine HAVE_CLOCK_GETTIME #cmakedefine HAVE_GETTIMEOFDAY_FUNC #cmakedefine MALLOC_IN_STDLIB_H #if !defined( MALLOC_IN_STDLIB_H ) Loading common/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ set(COMMON_SRCS eda_doc.cpp filter_reader.cpp gestfich.cpp getrunningmicrosecs.cpp gr_basic.cpp hotkeys_basic.cpp hotkey_grid_table.cpp Loading common/getrunningmicrosecs.cpp 0 → 100644 +62 −0 Original line number Diff line number Diff line #include <config.h> #if defined(HAVE_CLOCK_GETTIME) #include <time.h> unsigned GetRunningMicroSecs() { struct timespec now; clock_gettime( CLOCK_MONOTONIC, &now ); unsigned usecs = ((unsigned)now.tv_nsec)/1000 + ((unsigned)now.tv_sec) * 1000000; // unsigned msecs = (now.tv_nsec / (1000*1000)) + now.tv_sec * 1000; return usecs; } #elif defined(HAVE_GETTIMEOFDAY_FUNC) #include <sys/time.h> unsigned GetRunningMicroSecs() { timeval tv; gettimeofday( &tv, 0 ); return (tv.tv_sec * 1000000) + tv.tv_usec; } #elif defined(_WIN32) #define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #include <assert.h> unsigned GetRunningMicroSecs() { LARGE_INTEGER curtime; static unsigned timerFreq; // timer frequency if( !timerFreq ) { QueryPerformanceFrequency( &curtime ); timerFreq = curtime.QuadPart / 1000000; // i.e., ticks per usec assert( timerFreq ); } QueryPerformanceCounter( &curtime ); return ( curtime.LowPart / timerFreq ); } #endif container_test.cpp +1 −17 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ #include <deque> #include <dlist.h> #include <time.h> #include <common.h> #define TEST_NODES 100000000 Loading @@ -16,22 +16,6 @@ typedef boost::ptr_vector<EDA_ITEM> EDA_ITEMV; void heap_warm_up(); /** * Function GetRunningMicroSecs * returns current relative time in microsecs. */ unsigned GetRunningMicroSecs() { struct timespec now; clock_gettime( CLOCK_MONOTONIC, &now ); unsigned usecs = now.tv_nsec/1000 + now.tv_sec * 1000 * 1000; return usecs; } int main( int argc, char** argv ) { EDA_ITEMV v; Loading Loading
CMakeModules/PerformFeatureChecks.cmake +9 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ macro(perform_feature_checks) include(CheckIncludeFile) #include(CheckFunctionExists) include(CheckLibraryExists) include(CheckSymbolExists) check_include_file("malloc.h" HAVE_MALLOC_H) Loading @@ -55,7 +58,6 @@ macro(perform_feature_checks) # re-introduce this. # check_include_file("strings.h" HAVE_STRINGS_H) include(CheckSymbolExists) check_symbol_exists(strcasecmp "string.h" HAVE_STRCASECMP) check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP) check_symbol_exists(strncasecmp "string.h" HAVE_STRNCASECMP) Loading @@ -70,6 +72,12 @@ macro(perform_feature_checks) check_symbol_exists(_snprintf "stdio.h" HAVE_ISO_SNPRINTF) check_symbol_exists(_hypot "math.h" HAVE_ISO_HYPOT) #check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) # HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC check_symbol_exists(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY_FUNC) # Generate config.h. configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) Loading
CMakeModules/config.h.cmake +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ #define hypot _hypot #endif #cmakedefine HAVE_CLOCK_GETTIME #cmakedefine HAVE_GETTIMEOFDAY_FUNC #cmakedefine MALLOC_IN_STDLIB_H #if !defined( MALLOC_IN_STDLIB_H ) Loading
common/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ set(COMMON_SRCS eda_doc.cpp filter_reader.cpp gestfich.cpp getrunningmicrosecs.cpp gr_basic.cpp hotkeys_basic.cpp hotkey_grid_table.cpp Loading
common/getrunningmicrosecs.cpp 0 → 100644 +62 −0 Original line number Diff line number Diff line #include <config.h> #if defined(HAVE_CLOCK_GETTIME) #include <time.h> unsigned GetRunningMicroSecs() { struct timespec now; clock_gettime( CLOCK_MONOTONIC, &now ); unsigned usecs = ((unsigned)now.tv_nsec)/1000 + ((unsigned)now.tv_sec) * 1000000; // unsigned msecs = (now.tv_nsec / (1000*1000)) + now.tv_sec * 1000; return usecs; } #elif defined(HAVE_GETTIMEOFDAY_FUNC) #include <sys/time.h> unsigned GetRunningMicroSecs() { timeval tv; gettimeofday( &tv, 0 ); return (tv.tv_sec * 1000000) + tv.tv_usec; } #elif defined(_WIN32) #define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #include <assert.h> unsigned GetRunningMicroSecs() { LARGE_INTEGER curtime; static unsigned timerFreq; // timer frequency if( !timerFreq ) { QueryPerformanceFrequency( &curtime ); timerFreq = curtime.QuadPart / 1000000; // i.e., ticks per usec assert( timerFreq ); } QueryPerformanceCounter( &curtime ); return ( curtime.LowPart / timerFreq ); } #endif
container_test.cpp +1 −17 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ #include <deque> #include <dlist.h> #include <time.h> #include <common.h> #define TEST_NODES 100000000 Loading @@ -16,22 +16,6 @@ typedef boost::ptr_vector<EDA_ITEM> EDA_ITEMV; void heap_warm_up(); /** * Function GetRunningMicroSecs * returns current relative time in microsecs. */ unsigned GetRunningMicroSecs() { struct timespec now; clock_gettime( CLOCK_MONOTONIC, &now ); unsigned usecs = now.tv_nsec/1000 + now.tv_sec * 1000 * 1000; return usecs; } int main( int argc, char** argv ) { EDA_ITEMV v; Loading