| OLD | NEW |
| 1 import os | 1 import os |
| 2 from autotest_lib.client.bin import test, utils | 2 from autotest_lib.client.bin import test, utils |
| 3 | 3 |
| 4 | 4 |
| 5 class hackbench(test.test): | 5 class hackbench(test.test): |
| 6 """ | 6 """ |
| 7 This module will run the hackbench benchmark. Hackbench is a benchmark for | 7 This module will run the hackbench benchmark. Hackbench is a benchmark for |
| 8 measuring the performance, overhead and scalability of the Linux scheduler. | 8 measuring the performance, overhead and scalability of the Linux scheduler. |
| 9 The C program was pick from Ingo Molnar's page. | 9 The C program was pick from Ingo Molnar's page. |
| 10 | 10 |
| 11 @author: Nikhil Rao (ncrao@google.com) | 11 @author: Nikhil Rao (ncrao@google.com) |
| 12 @see: http://people.redhat.com/~mingo/cfs-scheduler/tools/hackbench.c | 12 @see: http://people.redhat.com/~mingo/cfs-scheduler/tools/hackbench.c |
| 13 """ | 13 """ |
| 14 version = 1 | 14 version = 1 |
| 15 preserve_srcdir = True | 15 preserve_srcdir = True |
| 16 | 16 |
| 17 | 17 |
| 18 def setup(self): | 18 def setup(self): |
| 19 os.chdir(self.srcdir) | 19 os.chdir(self.srcdir) |
| 20 if 'CC' in os.environ: | 20 if 'CC' in os.environ: |
| 21 cc = '$CC' | 21 cc = '$CC' |
| 22 else: | 22 else: |
| 23 cc = 'cc' | 23 cc = 'cc' |
| 24 utils.system('%s -lpthread hackbench.c -o hackbench' % cc) | 24 utils.system('%s -lpthread hackbench.c -o hackbench' % cc) |
| 25 | 25 |
| 26 | 26 |
| 27 def initialize(self): | 27 def initialize(self): |
| 28 self.job.require_gcc() | 28 self.job.require_gcc() |
| 29 self.results = None | 29 self.results = None |
| 30 | 30 |
| 31 | 31 |
| 32 def run_once(self, num_groups=90): | 32 def run_once(self, num_groups=90): |
| 33 """ | 33 """ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 | 47 |
| 48 def postprocess_iteration(self): | 48 def postprocess_iteration(self): |
| 49 """ | 49 """ |
| 50 Pick up the results attribute and write it in the performance keyval. | 50 Pick up the results attribute and write it in the performance keyval. |
| 51 """ | 51 """ |
| 52 lines = self.results.split('\n') | 52 lines = self.results.split('\n') |
| 53 for line in lines: | 53 for line in lines: |
| 54 if line.startswith('Time:'): | 54 if line.startswith('Time:'): |
| 55 time_val = line.split()[1] | 55 time_val = line.split()[1] |
| 56 self.write_perf_keyval({'time': time_val}) | 56 self.write_perf_keyval({'time': time_val}) |
| OLD | NEW |