mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-22 12:58:36 +00:00
Merge pull request #122 from Sticklyman1936/lmbench_update
lmbench: Tidied up the code and improved stability
This commit is contained in:
commit
50353d0b8f
@ -1,4 +1,4 @@
|
|||||||
# Copyright 2015 ARM Limited
|
# Copyright 2015-2016 ARM Limited
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -107,19 +107,15 @@ class lmbench(Workload):
|
|||||||
def run(self, context):
|
def run(self, context):
|
||||||
self.output = []
|
self.output = []
|
||||||
|
|
||||||
for time in xrange(self.times):
|
for _ in xrange(self.times):
|
||||||
for command in self.commands:
|
for command in self.commands:
|
||||||
self.output.append("Output for time #{}, {}: ".format(time + 1, command))
|
self.device.execute(command, timeout=self.run_timeout)
|
||||||
self.output.append(self.device.execute(command, timeout=self.run_timeout, check_exit_code=False))
|
|
||||||
|
|
||||||
def update_result(self, context):
|
def update_result(self, context):
|
||||||
for output in self.output:
|
host_file = os.path.join(context.output_directory, 'lmbench.output')
|
||||||
self.logger.debug(output)
|
device_file = self.device.path.join(self.device.working_directory, 'lmbench.output')
|
||||||
outfile = os.path.join(context.output_directory, 'lmbench.output')
|
self.device.pull_file(device_file, host_file)
|
||||||
with open(outfile, 'w') as wfh:
|
context.add_artifact('lmbench', host_file, 'data')
|
||||||
for output in self.output:
|
|
||||||
wfh.write(output)
|
|
||||||
context.add_artifact('lmbench', 'lmbench.output', 'data')
|
|
||||||
|
|
||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
self.device.uninstall_executable(self.test)
|
self.device.uninstall_executable(self.test)
|
||||||
@ -128,22 +124,28 @@ class lmbench(Workload):
|
|||||||
# Test setup routines
|
# Test setup routines
|
||||||
#
|
#
|
||||||
def _setup_lat_mem_rd(self):
|
def _setup_lat_mem_rd(self):
|
||||||
|
device_file = self.device.path.join(self.device.working_directory, 'lmbench.output')
|
||||||
|
self.device.execute('rm -f {}'.format(device_file))
|
||||||
|
|
||||||
command_stub = self._setup_common()
|
command_stub = self._setup_common()
|
||||||
if self.thrash:
|
if self.thrash:
|
||||||
command_stub = command_stub + '-t '
|
command_stub = '{} -t'.format(command_stub)
|
||||||
|
|
||||||
for size in self.size:
|
for size in self.size:
|
||||||
command = command_stub + size + ' '
|
command = '{} {}'.format(command_stub, size)
|
||||||
for stride in self.stride:
|
for stride in self.stride:
|
||||||
self.commands.append(command + str(stride))
|
self.commands.append('{} {} >> {} 2>&1'.format(command, stride, device_file))
|
||||||
|
|
||||||
def _setup_bw_mem(self):
|
def _setup_bw_mem(self):
|
||||||
|
device_file = self.device.path.join(self.device.working_directory, 'lmbench.output')
|
||||||
|
self.device.execute('rm -f {}'.format(device_file))
|
||||||
|
|
||||||
command_stub = self._setup_common()
|
command_stub = self._setup_common()
|
||||||
|
|
||||||
for size in self.size:
|
for size in self.size:
|
||||||
command = command_stub + size + ' '
|
command = '{} {}'.format(command_stub, size)
|
||||||
for what in self.mem_category:
|
for category in self.mem_category:
|
||||||
self.commands.append(command + what)
|
self.commands.append('{} {} >> {} 2>&1'.format(command, category, device_file))
|
||||||
|
|
||||||
def _setup_common(self):
|
def _setup_common(self):
|
||||||
parts = []
|
parts = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user