blob: 87fbb2ef8279ad3a916ba0b50c90dc86b8a758e7 [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')
mbligh8de9a4d2008-03-04 16:12:02 +000015
16
mblighb71116b2006-05-17 21:32:55 +000017 def execute(self, iterations = 1, args = ''):
mbligh8de9a4d2008-03-04 16:12:02 +000018 vars = ('TMPDIR=\"%s\" RESULTDIR=\"%s\"' %
19 (self.tmpdir, self.resultsdir))
mbligh9f5113d2007-06-25 23:41:10 +000020 profilers = self.job.profilers
mbligh5e3ad612007-10-12 23:34:37 +000021 keyval = open(self.resultsdir + '/keyval', 'w')
mbligh8de9a4d2008-03-04 16:12:02 +000022 self.err = None
mbligh5e3ad612007-10-12 23:34:37 +000023
mbligh9f5113d2007-06-25 23:41:10 +000024 if not profilers.only():
25 for i in range(iterations):
26 os.chdir(self.srcdir)
27 system(vars + ' ./Run ' + args)
mbligh5e3ad612007-10-12 23:34:37 +000028 report = open(self.resultsdir + '/report')
mbligh8de9a4d2008-03-04 16:12:02 +000029 self.format_results(report, keyval)
mbligh5e3ad612007-10-12 23:34:37 +000030
mbligha9991982006-05-25 18:32:43 +000031 # Do a profiling run if necessary
mbligha9991982006-05-25 18:32:43 +000032 if profilers.present():
33 profilers.start(self)
34 system(vars + ' ./Run ' + args)
35 profilers.stop(self)
36 profilers.report(self)
mbligh8de9a4d2008-03-04 16:12:02 +000037
38 # check err string and possible throw
39 if self.err != None:
40 raise TestError(self.err)
41
42
43 def check_for_error(self, words):
44 l = len(words)
45 if l >= 3 and words[-3:l] == ['no', 'measured', 'results']:
46 # found a problem so record it in err string
47 key = '_'.join(words[:-3])
48 if self.err == None:
49 self.err = key
50 else:
51 self.err = self.err + " " + key
52 return True
53 else:
54 return False
mbligh5e3ad612007-10-12 23:34:37 +000055
56
mbligh8de9a4d2008-03-04 16:12:02 +000057 def format_results(self, report, keyval):
58 for i in range(9):
59 report.next()
60 for line in report:
61 if not line.strip():
62 break
mbligh5e3ad612007-10-12 23:34:37 +000063
mbligh8de9a4d2008-03-04 16:12:02 +000064 words = line.split()
65 # look for problems first
66 if self.check_for_error(words):
67 continue
68
69 # we should make sure that there are at least
70 # 6 guys before we start accessing the array
71 if len(words) >= 6:
72 key = '_'.join(words[:-6])
73 value = words[-6]
74 print >> keyval, '%s=%s' % (key, value)
75 for line in report:
76 if 'FINAL SCORE' in line:
77 print >> keyval, 'score=%s\n' % line.split()[-1]
78 break
mbligh5e3ad612007-10-12 23:34:37 +000079
80
81if __name__ == '__main__':
82 import sys
mbligh8de9a4d2008-03-04 16:12:02 +000083 unixbench.format_results(sys.stdin, sys.stdout)
mbligh5e3ad612007-10-12 23:34:37 +000084
85
86""" Here is a sample report file:
87
88 BYTE UNIX Benchmarks (Version 4.1.0)
89 System -- Linux adrianbg 2.6.18.5 #1 SMP Thu J Start Benchmark Run: Tue Sep 1
90 9 interactive users.
91 21:03:50 up 5 days, 7:38, 9 users, load average: 0.71, 0.40, 0.25
92 lrwxrwxrwx 1 root root 4 Aug 15 09:53 /bin/sh -> bash
93 /bin/sh: symbolic link to `bash'
94 /dev/sda6 192149596 91964372 90424536 51% /home
95Dhrystone 2 using register variables 7918001.7 lps (10.0 secs, 10 samples)
96System Call Overhead 1427272.7 lps (10.0 secs, 10 samples)
97Process Creation 11508.6 lps (30.0 secs, 3 samples)
98Execl Throughput 4159.7 lps (29.7 secs, 3 samples)
99File Read 1024 bufsize 2000 maxblocks 1708109.0 KBps (30.0 secs, 3 samples)
100File Write 1024 bufsize 2000 maxblocks 788024.0 KBps (30.0 secs, 3 samples)
101File Copy 1024 bufsize 2000 maxblocks 452986.0 KBps (30.0 secs, 3 samples)
102File Read 256 bufsize 500 maxblocks 508752.0 KBps (30.0 secs, 3 samples)
103File Write 256 bufsize 500 maxblocks 214772.0 KBps (30.0 secs, 3 samples)
104File Copy 256 bufsize 500 maxblocks 143989.0 KBps (30.0 secs, 3 samples)
105File Read 4096 bufsize 8000 maxblocks 2626923.0 KBps (30.0 secs, 3 samples)
106File Write 4096 bufsize 8000 maxblocks 1175070.0 KBps (30.0 secs, 3 samples)
107File Copy 4096 bufsize 8000 maxblocks 793041.0 KBps (30.0 secs, 3 samples)
108Shell Scripts (1 concurrent) 4417.4 lpm (60.0 secs, 3 samples)
109Shell Scripts (8 concurrent) 1109.0 lpm (60.0 secs, 3 samples)
110Shell Scripts (16 concurrent) 578.3 lpm (60.0 secs, 3 samples)
111Arithmetic Test (type = short) 1843690.0 lps (10.0 secs, 3 samples)
112Arithmetic Test (type = int) 1873615.8 lps (10.0 secs, 3 samples)
113Arithmetic Test (type = long) 1888345.9 lps (10.0 secs, 3 samples)
114Arithmetic Test (type = float) 616260.3 lps (10.0 secs, 3 samples)
115Arithmetic Test (type = double) 615942.1 lps (10.0 secs, 3 samples)
116Arithoh 18864899.5 lps (10.0 secs, 3 samples)
117Dc: sqrt(2) to 99 decimal places 161726.0 lpm (30.0 secs, 3 samples)
118Recursion Test--Tower of Hanoi 89229.3 lps (20.0 secs, 3 samples)
119
120
121 INDEX VALUES
122TEST BASELINE RESULT INDEX
123
124Dhrystone 2 using register variables 116700.0 7918001.7 678.5
125Double-Precision Whetstone 55.0 1948.2 354.2
126Execl Throughput 43.0 4159.7 967.4
127File Copy 1024 bufsize 2000 maxblocks 3960.0 452986.0 1143.9
128File Copy 256 bufsize 500 maxblocks 1655.0 143989.0 870.0
129File Copy 4096 bufsize 8000 maxblocks 5800.0 793041.0 1367.3
130Pipe Throughput 12440.0 1048491.9 842.8
131Pipe-based Context Switching 4000.0 300778.3 751.9
132Process Creation 126.0 11508.6 913.4
133Shell Scripts (8 concurrent) 6.0 1109.0 1848.3
134System Call Overhead 15000.0 1427272.7 951.5
135 =========
136 FINAL SCORE 902.1
137"""