mbligh | b71116b | 2006-05-17 21:32:55 +0000 | [diff] [blame] | 1 | import test |
| 2 | from autotest_utils import * |
| 3 | |
| 4 | class unixbench(test.test): |
| 5 | version = 1 |
| 6 | |
| 7 | # http://www.tux.org/pub/tux/niemi/unixbench/unixbench-4.1.0.tgz |
| 8 | def setup(self, tarball = 'unixbench-4.1.0.tar.bz2'): |
| 9 | tarball = unmap_url(self.bindir, tarball, self.tmpdir) |
| 10 | extract_tarball_to_dir(tarball, self.srcdir) |
| 11 | os.chdir(self.srcdir) |
| 12 | |
mbligh | 908d31e | 2008-02-28 00:30:41 +0000 | [diff] [blame] | 13 | system('patch -p1 < ../unixbench.patch') |
mbligh | b71116b | 2006-05-17 21:32:55 +0000 | [diff] [blame] | 14 | system('make') |
| 15 | |
| 16 | def execute(self, iterations = 1, args = ''): |
mbligh | 9f5113d | 2007-06-25 23:41:10 +0000 | [diff] [blame] | 17 | vars = 'TMPDIR=\"%s\" RESULTDIR=\"%s\"' % (self.tmpdir, self.resultsdir) |
| 18 | profilers = self.job.profilers |
mbligh | 5e3ad61 | 2007-10-12 23:34:37 +0000 | [diff] [blame] | 19 | keyval = open(self.resultsdir + '/keyval', 'w') |
| 20 | |
mbligh | 9f5113d | 2007-06-25 23:41:10 +0000 | [diff] [blame] | 21 | if not profilers.only(): |
| 22 | for i in range(iterations): |
| 23 | os.chdir(self.srcdir) |
| 24 | system(vars + ' ./Run ' + args) |
mbligh | 5e3ad61 | 2007-10-12 23:34:37 +0000 | [diff] [blame] | 25 | report = open(self.resultsdir + '/report') |
| 26 | _format_results(report, keyval) |
| 27 | |
mbligh | a999198 | 2006-05-25 18:32:43 +0000 | [diff] [blame] | 28 | |
| 29 | # Do a profiling run if necessary |
mbligh | a999198 | 2006-05-25 18:32:43 +0000 | [diff] [blame] | 30 | if profilers.present(): |
| 31 | profilers.start(self) |
| 32 | system(vars + ' ./Run ' + args) |
| 33 | profilers.stop(self) |
| 34 | profilers.report(self) |
mbligh | 5e3ad61 | 2007-10-12 23:34:37 +0000 | [diff] [blame] | 35 | |
| 36 | |
| 37 | def _format_results(report, keyval): |
| 38 | for i in range(9): |
| 39 | report.next() |
| 40 | for line in report: |
| 41 | if not line.strip(): |
| 42 | break |
| 43 | |
| 44 | words = line.split() |
| 45 | key = '_'.join(words[:-6]) |
| 46 | value = words[-6] |
| 47 | print >> keyval, '%s=%s' % (key, value) |
mbligh | 9d4c32e | 2007-11-05 17:23:40 +0000 | [diff] [blame] | 48 | for line in report: |
| 49 | if 'FINAL SCORE' in line: |
mbligh | bbbb13e | 2008-01-23 16:58:38 +0000 | [diff] [blame] | 50 | print >> keyval, 'score=%s\n' % line.split()[-1] |
mbligh | 9d4c32e | 2007-11-05 17:23:40 +0000 | [diff] [blame] | 51 | break |
mbligh | 5e3ad61 | 2007-10-12 23:34:37 +0000 | [diff] [blame] | 52 | |
| 53 | |
| 54 | if __name__ == '__main__': |
| 55 | import sys |
| 56 | _format_results(sys.stdin, sys.stdout) |
| 57 | |
| 58 | |
| 59 | """ Here is a sample report file: |
| 60 | |
| 61 | BYTE UNIX Benchmarks (Version 4.1.0) |
| 62 | System -- Linux adrianbg 2.6.18.5 #1 SMP Thu J Start Benchmark Run: Tue Sep 1 |
| 63 | 9 interactive users. |
| 64 | 21:03:50 up 5 days, 7:38, 9 users, load average: 0.71, 0.40, 0.25 |
| 65 | lrwxrwxrwx 1 root root 4 Aug 15 09:53 /bin/sh -> bash |
| 66 | /bin/sh: symbolic link to `bash' |
| 67 | /dev/sda6 192149596 91964372 90424536 51% /home |
| 68 | Dhrystone 2 using register variables 7918001.7 lps (10.0 secs, 10 samples) |
| 69 | System Call Overhead 1427272.7 lps (10.0 secs, 10 samples) |
| 70 | Process Creation 11508.6 lps (30.0 secs, 3 samples) |
| 71 | Execl Throughput 4159.7 lps (29.7 secs, 3 samples) |
| 72 | File Read 1024 bufsize 2000 maxblocks 1708109.0 KBps (30.0 secs, 3 samples) |
| 73 | File Write 1024 bufsize 2000 maxblocks 788024.0 KBps (30.0 secs, 3 samples) |
| 74 | File Copy 1024 bufsize 2000 maxblocks 452986.0 KBps (30.0 secs, 3 samples) |
| 75 | File Read 256 bufsize 500 maxblocks 508752.0 KBps (30.0 secs, 3 samples) |
| 76 | File Write 256 bufsize 500 maxblocks 214772.0 KBps (30.0 secs, 3 samples) |
| 77 | File Copy 256 bufsize 500 maxblocks 143989.0 KBps (30.0 secs, 3 samples) |
| 78 | File Read 4096 bufsize 8000 maxblocks 2626923.0 KBps (30.0 secs, 3 samples) |
| 79 | File Write 4096 bufsize 8000 maxblocks 1175070.0 KBps (30.0 secs, 3 samples) |
| 80 | File Copy 4096 bufsize 8000 maxblocks 793041.0 KBps (30.0 secs, 3 samples) |
| 81 | Shell Scripts (1 concurrent) 4417.4 lpm (60.0 secs, 3 samples) |
| 82 | Shell Scripts (8 concurrent) 1109.0 lpm (60.0 secs, 3 samples) |
| 83 | Shell Scripts (16 concurrent) 578.3 lpm (60.0 secs, 3 samples) |
| 84 | Arithmetic Test (type = short) 1843690.0 lps (10.0 secs, 3 samples) |
| 85 | Arithmetic Test (type = int) 1873615.8 lps (10.0 secs, 3 samples) |
| 86 | Arithmetic Test (type = long) 1888345.9 lps (10.0 secs, 3 samples) |
| 87 | Arithmetic Test (type = float) 616260.3 lps (10.0 secs, 3 samples) |
| 88 | Arithmetic Test (type = double) 615942.1 lps (10.0 secs, 3 samples) |
| 89 | Arithoh 18864899.5 lps (10.0 secs, 3 samples) |
| 90 | Dc: sqrt(2) to 99 decimal places 161726.0 lpm (30.0 secs, 3 samples) |
| 91 | Recursion Test--Tower of Hanoi 89229.3 lps (20.0 secs, 3 samples) |
| 92 | |
| 93 | |
| 94 | INDEX VALUES |
| 95 | TEST BASELINE RESULT INDEX |
| 96 | |
| 97 | Dhrystone 2 using register variables 116700.0 7918001.7 678.5 |
| 98 | Double-Precision Whetstone 55.0 1948.2 354.2 |
| 99 | Execl Throughput 43.0 4159.7 967.4 |
| 100 | File Copy 1024 bufsize 2000 maxblocks 3960.0 452986.0 1143.9 |
| 101 | File Copy 256 bufsize 500 maxblocks 1655.0 143989.0 870.0 |
| 102 | File Copy 4096 bufsize 8000 maxblocks 5800.0 793041.0 1367.3 |
| 103 | Pipe Throughput 12440.0 1048491.9 842.8 |
| 104 | Pipe-based Context Switching 4000.0 300778.3 751.9 |
| 105 | Process Creation 126.0 11508.6 913.4 |
| 106 | Shell Scripts (8 concurrent) 6.0 1109.0 1848.3 |
| 107 | System Call Overhead 15000.0 1427272.7 951.5 |
| 108 | ========= |
| 109 | FINAL SCORE 902.1 |
| 110 | """ |