Skip to content

Commit

Permalink
Merge 1b080f6 into 0398422
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr committed Apr 7, 2023
2 parents 0398422 + 1b080f6 commit f4f7fa8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -5,4 +5,4 @@ ReBench.egg-info
cover-results
.coverage
.idea

.p3-env
8 changes: 0 additions & 8 deletions .pydevproject

This file was deleted.

9 changes: 8 additions & 1 deletion docs/extensions.md
Expand Up @@ -86,7 +86,7 @@ Implementation Notes:
## `Time`

The `Time` adapter uses Unix's `/usr/bin/time` command.
On Linux, or more generally the platforms that support it, it will also use the
If it the `time` program supports it, we will also use the
`-f` switch of the `time` command to record the maximum resident set size,
i.e., the maximum amount of memory the program used.

Expand All @@ -99,6 +99,13 @@ Example configuration for a suite:
- Bench1
```

Note:

Compatible `time` binaries are looked for in:
- `/usr/bin/time`
- `/opt/local/bin/gtime`

On MacOS, a GNU time command can be installed for instance with Homebrew and MacPorts.

## Supporting other Benchmark Harnesses

Expand Down
7 changes: 5 additions & 2 deletions rebench/environment.py
Expand Up @@ -121,8 +121,11 @@ def init_environment(denoise_result, ui):
cpu_info = _get_cpu_info_internal()
if cpu_info:
result['cpu'] = cpu_info['brand_raw']
result['clockSpeed'] = (cpu_info['hz_advertised'][0]
* (10 ** cpu_info['hz_advertised'][1]))
if 'hz_advertised' in cpu_info:
result['clockSpeed'] = (cpu_info['hz_advertised'][0]
* (10 ** cpu_info['hz_advertised'][1]))
else:
result['clockSpeed'] = 0
except ValueError:
pass

Expand Down
15 changes: 14 additions & 1 deletion rebench/interop/time_adapter.py
Expand Up @@ -44,15 +44,28 @@ def __init__(self, include_faulty, executor):

def acquire_command(self, run_id):
command = run_id.cmdline()
time_bin = '/usr/bin/time'

try:
formatted_output = subprocess.call(
['/usr/bin/time', '-f', TimeAdapter.time_format, '/bin/sleep', '1'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except OSError:
formatted_output = 1

if formatted_output == 1:
try:
formatted_output = subprocess.call(
['/opt/local/bin/gtime', '-f', TimeAdapter.time_format, '/bin/sleep', '1'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if formatted_output == 0:
time_bin = '/opt/local/bin/gtime'
except OSError:
formatted_output = 1

if formatted_output == 0:
self._use_formatted_time = True
return "/usr/bin/time -f %s %s" % (TimeAdapter.time_format, command)
return "%s -f %s %s" % (time_bin, TimeAdapter.time_format, command)
else:
# use standard, but without info on memory
# TODO: add support for reading out memory info on OS X
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -29,8 +29,10 @@

if sys.version_info[0] < 3:
pykwalify_version = 'pykwalify==1.7.0'
py_cpuinfo_version = 'py-cpuinfo==7.0.0'
else:
pykwalify_version = 'pykwalify>=1.8.0'
py_cpuinfo_version = 'py-cpuinfo==9.0.0'

setup(name='ReBench',
version=rebench_version,
Expand All @@ -46,7 +48,7 @@
'PyYAML>=3.12',
pykwalify_version,
'humanfriendly>=8.0',
'py-cpuinfo==7.0.0',
py_cpuinfo_version,
'psutil>=5.6.7'
],
entry_points = {
Expand Down

0 comments on commit f4f7fa8

Please sign in to comment.