Search
OpenHPC Build Service
>
Projects
>
OpenHPC
:
1.3
:
Update10
:
Factory
>
mvapich2-gnu8
> _service:extract_file:mvapich2-get_cycles.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File _service:extract_file:mvapich2-get_cycles.patch of Package mvapich2-gnu8
--- a/src/mpid/ch3/channels/common/include/mv2_clock.h 2018-07-24 07:30:00.000000000 -0700 +++ b/src/mpid/ch3/channels/common/include/mv2_clock.h 2018-07-31 15:49:19.000000000 -0700 @@ -94,8 +94,22 @@ } #else -#warning get_cycles not implemented for this architecture: attempt asm/timex.h -#include <asm/timex.h> +#warning get_cycles not implemented for this architecture: using gettimeofday() fallback +#include <stddef.h> +#include <sys/time.h> + +typedef unsigned long long cycles_t; +static inline cycles_t get_cycles() +{ + cycles_t ret; + struct timeval tv = { 0 }; + + if (gettimeofday(&tv, NULL) != 0) + return 0; + ret = ((((cycles_t)(tv.tv_sec)) * 1000000ULL) + ((cycles_t)(tv.tv_usec))); + return ret; +} + #endif extern double get_cpu_mhz(void);