#2721: Cactus does not detect `gettimeofday` timer
Reporter: Erik Schnetter Status: new Milestone: Version: Type: bug Priority: major Component:
Comment (by Roland Haas):
The current code works for me (e.g. on the Delta Cluster at UIUC, and also on Summit). I get:
``` /* Timing stuff */ #define HAVE_TIME_GETTIMEOFDAY 1 #define GETTIMEOFDAY_NEEDS_TIMEZONE 1 #define HAVE_TIME_GETRUSAGE 1 ```
in `cctk_Config.h` for both. On my M1 based macOS testing system with Homebrew it does indeed fail:
``` /* Timing stuff */ /* #undef HAVE_TIME_GETTIMEOFDAY */ /* #undef GETTIMEOFDAY_NEEDS_TIMEZONE */ #define HAVE_TIME_GETRUSAGE 1 ```
So, since we have just entered code freeze for the release in May, I would not want to touch anything in configure if possible. While the change looks harmless, and indeed:
```c #include <sys/time.h> int main(void) { gettimeofday(0,0); return 0; } ```
is much nicer code (and closer to how the actual arguments to `TRY_LINK` are defined) than
``` int main(void) { #include <sys/time.h> gettimeofday(0,0); return 0; } ```
I would rather not risk changing anything if only macOS system are affected. Since there are no macOS production clusters, any timing obtained on them is not really useful to guide decisions for code optimization anyway I would think.
I would be happy to include the change in master just after the release and backport if no issues are found with it after a while. Though note that also the change to PAPI that is reported in#2174 was applied to master just after the last release, always broke on Linux and was never reported. So master seems to not be used very much anymore it seems.
Out of curiosity:
``` int main(void) { #include <sys/time.h> gettimeofday(0,0); return 0; } ```
actually forbidden? Ie does the C standard require that the includes happen at file level? There is in principle nothing wrong with declare function prototypes in local scope, and an `#include` is just a textual replacement, so valid inside of a function.
-- Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2721/cactus-does-not-de...
trac@lists.einsteintoolkit.org