diff --git a/include/villas/task.h b/include/villas/task.h index aaf2caa6c..24328b45a 100644 --- a/include/villas/task.h +++ b/include/villas/task.h @@ -27,7 +27,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { @@ -48,6 +47,10 @@ extern "C" { #error "Platform not supported" #endif +#if PERIODIC_TASK_IMPL == RDTSC + #include +#endif + struct task { int clock; /**< CLOCK_{MONOTONIC,REALTIME} */ @@ -62,7 +65,7 @@ struct task { #if PERIODIC_TASK_IMPL == TIMERFD int fd; /**< The timerfd_create(2) file descriptior. */ #elif PERIODIC_TASK_IMPL == RDTSC - struct tsc tsc; /**< Initialized by tsc_init(). */ + struct tsc tsc; /**< Initialized by tsc_init(). */ #endif }; diff --git a/lib/task.c b/lib/task.c index e3effbeab..583de3076 100644 --- a/lib/task.c +++ b/lib/task.c @@ -30,8 +30,6 @@ #if PERIODIC_TASK_IMPL == TIMERFD #include -#elif PERIODIC_TASK_IMPL == RDTSC - #include #endif int task_init(struct task *t, double rate, int clock) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 4ca244170..49b90abe8 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -41,10 +41,13 @@ if(CRITERION_FOUND) task.c timing.c utils.c - tsc.c hash_table.c ) + if(ARCH STREQUAL "x86_64") + list(APPEND TEST_SRC tsc.c) + endif() + add_executable(unit-tests ${TEST_SRC}) target_link_libraries(unit-tests PUBLIC PkgConfig::CRITERION