diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index d2e56eade..2fcec230f 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -1,5 +1,5 @@ -if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86") AND (CMAKE_SIZEOF_VOID_P EQUAL 4)) +if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4)) set(TARGET_ARCH "x86") elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) set(TARGET_ARCH "x64") diff --git a/libfreerdp/primitives/CMakeLists.txt b/libfreerdp/primitives/CMakeLists.txt index 2c4ef7414..cf95a4116 100644 --- a/libfreerdp/primitives/CMakeLists.txt +++ b/libfreerdp/primitives/CMakeLists.txt @@ -100,7 +100,7 @@ endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") -if(BUILD_TESTING AND ((NOT WIN32) AND (NOT APPLE))) +if(BUILD_TESTING AND NOT WIN32 AND NOT APPLE) add_subdirectory(test) endif() diff --git a/libfreerdp/primitives/test/TestPrimitivesSet.c b/libfreerdp/primitives/test/TestPrimitivesSet.c index 3d689eeff..2111d65c3 100644 --- a/libfreerdp/primitives/test/TestPrimitivesSet.c +++ b/libfreerdp/primitives/test/TestPrimitivesSet.c @@ -243,7 +243,7 @@ int test_set32u_func(void) } /* ------------------------------------------------------------------------- */ -static inline void memset32u_naive( +static INLINE void memset32u_naive( UINT32 val, UINT32 *dst, size_t count) @@ -275,7 +275,7 @@ int test_set32u_speed(void) } /* ------------------------------------------------------------------------- */ -static inline void memset32s_naive( +static INLINE void memset32s_naive( INT32 val, INT32 *dst, size_t count) diff --git a/libfreerdp/primitives/test/measure.h b/libfreerdp/primitives/test/measure.h index ba2909c00..2eb8ae80e 100644 --- a/libfreerdp/primitives/test/measure.h +++ b/libfreerdp/primitives/test/measure.h @@ -22,10 +22,6 @@ * Define GOOGLE_PROFILER if you want gperftools included. */ -#ifdef _GNUC_ -# pragma once -#endif - #ifndef __MEASURE_H_INCLUDED__ #define __MEASURE_H_INCLUDED__ @@ -35,9 +31,21 @@ #include #endif -#include -#include -#include +#include + +#ifdef _WIN32 + +#define PROFILER_START(_prefix_) +#define PROFILER_STOP + +#define MEASURE_LOOP_START(_prefix_, _count_) +#define MEASURE_LOOP_STOP +#define MEASURE_GET_RESULTS(_result_) +#define MEASURE_SHOW_RESULTS(_result_) +#define MEASURE_SHOW_RESULTS_SCALED(_scale_, _label_) +#define MEASURE_TIMED(_label_, _init_iter_, _test_time_, _result_, _call_) + +#else #ifdef GOOGLE_PROFILER #include @@ -122,4 +130,6 @@ extern void _floatprint(float t, char *output); MEASURE_SHOW_RESULTS(_result_); \ } +#endif + #endif // __MEASURE_H_INCLUDED__ diff --git a/libfreerdp/primitives/test/prim_test.c b/libfreerdp/primitives/test/prim_test.c index a19b5f64b..b9757ac05 100644 --- a/libfreerdp/primitives/test/prim_test.c +++ b/libfreerdp/primitives/test/prim_test.c @@ -18,9 +18,11 @@ #include "prim_test.h" +#ifndef _WIN32 #include #include #include +#endif #include #include @@ -83,6 +85,10 @@ void get_random_data(void *buffer, size_t size) } /* ------------------------------------------------------------------------- */ + +#ifdef _WIN32 +float _delta_time(const struct timespec *t0, const struct timespec *t1) { return 0.0f; } +#else float _delta_time(const struct timespec *t0, const struct timespec *t1) { INT64 secs = (INT64) (t1->tv_sec) - (INT64) (t0->tv_sec); @@ -98,6 +104,7 @@ float _delta_time(const struct timespec *t0, const struct timespec *t1) retval = (double) secs + (double) nsecs / (double) 1000000000.0; return (retval < 0.0) ? 0.0 : (float) retval; } +#endif /* ------------------------------------------------------------------------- */ void _floatprint(float t, char *output) diff --git a/libfreerdp/primitives/test/prim_test.h b/libfreerdp/primitives/test/prim_test.h index 42f8777c9..37db6a9b6 100644 --- a/libfreerdp/primitives/test/prim_test.h +++ b/libfreerdp/primitives/test/prim_test.h @@ -13,10 +13,6 @@ * this code may be covered by patents by HP, Microsoft, or other parties. */ -#ifdef __GNUC__ -# pragma once -#endif - #ifndef __PRIMTEST_H_INCLUDED__ #define __PRIMTEST_H_INCLUDED__ @@ -34,7 +30,11 @@ #include #endif +#ifdef _WIN32 +#define ALIGN(x) x +#else #define ALIGN(x) x DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) +#endif #define ABS(_x_) ((_x_) < 0 ? (-(_x_)) : (_x_)) #define MAX_TEST_SIZE 4096 @@ -112,7 +112,7 @@ extern int test_or_32u_speed(void); int size = size_array[s]; \ _prework_; \ iter = iterations/size; \ - sprintf(label, "%s-%-4d", oplabel, size); \ + sprintf_s(label, "%s-%-4d", oplabel, size); \ MEASURE_TIMED(label, iter, test_time, resultNormal[s], \ _funcNormal_); \ } \ @@ -128,7 +128,7 @@ extern int test_or_32u_speed(void); int size = size_array[s]; \ _prework_; \ iter = iterations/size; \ - sprintf(label, "%s-%s-%-4d", SIMD_TYPE, oplabel, size); \ + sprintf_s(label, "%s-%s-%-4d", SIMD_TYPE, oplabel, size); \ MEASURE_TIMED(label, iter, test_time, resultOpt[s], \ _funcOpt_); \ } \ @@ -147,7 +147,7 @@ extern int test_or_32u_speed(void); int size = size_array[s]; \ _prework_; \ iter = iterations/size; \ - sprintf(label, "IPP-%s-%-4d", oplabel, size); \ + sprintf_s(label, "IPP-%s-%-4d", oplabel, size); \ MEASURE_TIMED(label, iter, test_time, resultIPP[s], \ _funcIPP_); \ } \ @@ -158,6 +158,14 @@ extern int test_or_32u_speed(void); #define PRIM_NOP do {} while (0) /* ------------------------------------------------------------------------- */ + +#ifdef _WIN32 +#define STD_SPEED_TEST( \ + _name_, _srctype_, _dsttype_, _prework_, \ + _doNormal_, _funcNormal_, \ + _doOpt_, _funcOpt_, _flagOpt_, _flagExt_, \ + _doIPP_, _funcIPP_) +#else #define STD_SPEED_TEST( \ _name_, _srctype_, _dsttype_, _prework_, \ _doNormal_, _funcNormal_, \ @@ -210,7 +218,7 @@ static void _name_( \ _floatprint(resultOpt[s], sSN); \ if (resultNormal[s] > 0.0) \ { \ - sprintf(sSNp, "%d%%", \ + sprintf_s(sSNp, "%d%%", \ (int) (resultOpt[s] / resultNormal[s] * 100.0 + 0.5)); \ } \ } \ @@ -219,7 +227,7 @@ static void _name_( \ _floatprint(resultIPP[s], sIPP); \ if (resultNormal[s] > 0.0) \ { \ - sprintf(sIPPp, "%d%%", \ + sprintf_s(sIPPp, "%d%%", \ (int) (resultIPP[s] / resultNormal[s] * 100.0 + 0.5)); \ } \ } \ @@ -228,5 +236,6 @@ static void _name_( \ } \ free(resultNormal); free(resultOpt); free(resultIPP); \ } +#endif #endif // !__PRIMTEST_H_INCLUDED__