blob: 4e0b6744d59b5179aa8ba1f69e8bddd8537b7e00 [file] [log] [blame]
mblighb71116b2006-05-17 21:32:55 +00001import test
2from autotest_utils import *
3
4class 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
mbligh908d31e2008-02-28 00:30:41 +000013 system('patch -p1 < ../unixbench.patch')
mblighb71116b2006-05-17 21:32:55 +000014 system('make')
15
16 def execute(self, iterations = 1, args = ''):
mbligh9f5113d2007-06-25 23:41:10 +000017 vars = 'TMPDIR=\"%s\" RESULTDIR=\"%s\"' % (self.tmpdir, self.resultsdir)
18 profilers = self.job.profilers
mbligh5e3ad612007-10-12 23:34:37 +000019 keyval = open(self.resultsdir + '/keyval', 'w')
20
mbligh9f5113d2007-06-25 23:41:10 +000021 if not profilers.only():
22 for i in range(iterations):
23 os.chdir(self.srcdir)
24 system(vars + ' ./Run ' + args)
mbligh5e3ad612007-10-12 23:34:37 +000025 report = open(self.resultsdir + '/report')
26 _format_results(report, keyval)
27
mbligha9991982006-05-25 18:32:43 +000028
29 # Do a profiling run if necessary
mbligha9991982006-05-25 18:32:43 +000030 if profilers.present():
31 profilers.start(self)
32 system(vars + ' ./Run ' + args)
33 profilers.stop(self)
34 profilers.report(self)
mbligh5e3ad612007-10-12 23:34:37 +000035
36
37def _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)
mbligh9d4c32e2007-11-05 17:23:40 +000048 for line in report:
49 if 'FINAL SCORE' in line:
mblighbbbb13e2008-01-23 16:58:38 +000050 print >> keyval, 'score=%s\n' % line.split()[-1]
mbligh9d4c32e2007-11-05 17:23:40 +000051 break
mbligh5e3ad612007-10-12 23:34:37 +000052
53
54if __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
68Dhrystone 2 using register variables 7918001.7 lps (10.0 secs, 10 samples)
69System Call Overhead 1427272.7 lps (10.0 secs, 10 samples)
70Process Creation 11508.6 lps (30.0 secs, 3 samples)
71Execl Throughput 4159.7 lps (29.7 secs, 3 samples)
72File Read 1024 bufsize 2000 maxblocks 1708109.0 KBps (30.0 secs, 3 samples)
73File Write 1024 bufsize 2000 maxblocks 788024.0 KBps (30.0 secs, 3 samples)
74File Copy 1024 bufsize 2000 maxblocks 452986.0 KBps (30.0 secs, 3 samples)
75File Read 256 bufsize 500 maxblocks 508752.0 KBps (30.0 secs, 3 samples)
76File Write 256 bufsize 500 maxblocks 214772.0 KBps (30.0 secs, 3 samples)
77File Copy 256 bufsize 500 maxblocks 143989.0 KBps (30.0 secs, 3 samples)
78File Read 4096 bufsize 8000 maxblocks 2626923.0 KBps (30.0 secs, 3 samples)
79File Write 4096 bufsize 8000 maxblocks 1175070.0 KBps (30.0 secs, 3 samples)
80File Copy 4096 bufsize 8000 maxblocks 793041.0 KBps (30.0 secs, 3 samples)
81Shell Scripts (1 concurrent) 4417.4 lpm (60.0 secs, 3 samples)
82Shell Scripts (8 concurrent) 1109.0 lpm (60.0 secs, 3 samples)
83Shell Scripts (16 concurrent) 578.3 lpm (60.0 secs, 3 samples)
84Arithmetic Test (type = short) 1843690.0 lps (10.0 secs, 3 samples)
85Arithmetic Test (type = int) 1873615.8 lps (10.0 secs, 3 samples)
86Arithmetic Test (type = long) 1888345.9 lps (10.0 secs, 3 samples)
87Arithmetic Test (type = float) 616260.3 lps (10.0 secs, 3 samples)
88Arithmetic Test (type = double) 615942.1 lps (10.0 secs, 3 samples)
89Arithoh 18864899.5 lps (10.0 secs, 3 samples)
90Dc: sqrt(2) to 99 decimal places 161726.0 lpm (30.0 secs, 3 samples)
91Recursion Test--Tower of Hanoi 89229.3 lps (20.0 secs, 3 samples)
92
93
94 INDEX VALUES
95TEST BASELINE RESULT INDEX
96
97Dhrystone 2 using register variables 116700.0 7918001.7 678.5
98Double-Precision Whetstone 55.0 1948.2 354.2
99Execl Throughput 43.0 4159.7 967.4
100File Copy 1024 bufsize 2000 maxblocks 3960.0 452986.0 1143.9
101File Copy 256 bufsize 500 maxblocks 1655.0 143989.0 870.0
102File Copy 4096 bufsize 8000 maxblocks 5800.0 793041.0 1367.3
103Pipe Throughput 12440.0 1048491.9 842.8
104Pipe-based Context Switching 4000.0 300778.3 751.9
105Process Creation 126.0 11508.6 913.4
106Shell Scripts (8 concurrent) 6.0 1109.0 1848.3
107System Call Overhead 15000.0 1427272.7 951.5
108 =========
109 FINAL SCORE 902.1
110"""