smarr / ReBench

Execute and document benchmarks reproducibly.
MIT License
83 stars 24 forks source link

TimeAdapter incompatible with macOS/BSD time #91

Open krono opened 6 years ago

krono commented 6 years ago

The BSD and macOS time does not support the -f switch (as in https://github.com/smarr/ReBench/blob/master/rebench/interop/time_adapter.py#L46).

However I checket macOS, OpenBSD and FreeBSD and they support an -l switch such that that

-l the contents of the rusage structure are printed.

This looks as follows:

$ /usr/bin/time -l someCommand
[…output…]
        1.04 real         0.44 user         0.32 sys
  23814144  maximum resident set size
         0  average shared memory size
         0  average unshared data size
         0  average unshared stack size
     29843  page reclaims
      1216  page faults
         0  swaps
       294  block input operations
         3  block output operations
         0  messages sent
         0  messages received
        46  signals received
      1015  voluntary context switches
       645  involuntary context switches
krono commented 6 years ago

For #89

smarr commented 6 years ago

Did you see the code below? Specifically https://github.com/smarr/ReBench/blob/master/rebench/interop/time_adapter.py#L58?

krono commented 6 years ago

yes.

I just wanted to have it tracked, and (a) that it's the same with other BSDen as well as (b) there's more info available even without -f.

smarr commented 6 years ago

Ok, thanks. Don't think, I'll have time for it, so, will mark it for later. The current solution is working on macOS as far as the tests tell me.

krono commented 6 years ago

Ack.

lou1306 commented 2 weeks ago

Sorry for posting on a 6yo issue, but I wanted to point out a minor, related issue on arm64 machines.

There, installing the GNU time implementation (e.g., with brew install gnu-time) is not enough because ReBench only looks in /usr/bin/time and /opt/local/bin/gtime. Would it be possible to add /opt/homebrew/bin to the list of searched paths?

In the meantime, I think the easiest workaround is to just create a symlink:

mkdir -p /opt/local/bin
ln -s `which gtime` /opt/local/bin/gtime
smarr commented 2 weeks ago

@lou1306 I am very open to a PR that change this code here to iterate over a list of known binaries, to find the one that's available: https://github.com/smarr/ReBench/blob/master/rebench/interop/time_adapter.py#L65-L82