blob: 46d176e68b725186178f7c0eef99e13c7373b107 [file] [log] [blame]
Eric Li861b2d52011-02-04 14:50:35 -08001import os, re
2from autotest_lib.client.bin import test, utils
3from autotest_lib.client.common_lib import error
4
5
6class unixbench5(test.test):
7 """
8 This test measure system wide performance by running the following tests:
9 - Dhrystone - focuses on string handling.
10 - Whetstone - measure floating point operations.
11 - Execl Throughput - measure the number of execl calls per second.
12 - File Copy
13 - Pipe throughput
14 - Pipe-based context switching
15 - Process creation - number of times a process can fork and reap
16 - Shell Scripts - number of times a process can start and reap a script
17 - System Call Overhead - estimates the cost of entering and leaving the
18 kernel.
19
20 @see: http://code.google.com/p/byte-unixbench/
21 @author: Dale Curtis <dalecurtis@google.com>
22 """
23 version = 1
24
25
26 def initialize(self):
27 self.job.require_gcc()
28 self.err = []
29
30
31 def setup(self, tarball='unixbench-5.1.3.tgz'):
32 """
33 Compiles unixbench.
34
35 @tarball: Path or URL to a unixbench tarball
36 @see: http://byte-unixbench.googlecode.com/files/unixbench-5.1.3.tgz
37 """
38 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
39 utils.extract_tarball_to_dir(tarball, self.srcdir)
40 os.chdir(self.srcdir)
41
42 utils.system('patch -p0 < ../Makefile.patch')
43 utils.make()
44
45
46 def run_once(self, args=''):
47 vars = 'UB_TMPDIR="%s" UB_RESULTDIR="%s"' % (self.tmpdir,
48 self.resultsdir)
49 os.chdir(self.srcdir)
50 self.report_data = utils.system_output(vars + ' ./Run ' + args)
51 self.results_path = os.path.join(self.resultsdir,
52 'raw_output_%s' % self.iteration)
53 utils.open_write_close(self.results_path, self.report_data)
54
55
56 def cleanup(self):
57 """
58 Check error index list and throw TestError if necessary.
59 """
60 if self.err:
61 e_msg = ("No measured results for output lines: %s\nOutput:%s" %
62 (" ".join(self.err), self.report_data))
63 raise error.TestError(e_msg)
64
65
66 def process_section(self, section, suffix):
67 keyval = {}
68 subsections = section.split('\n\n')
69
70 if len(subsections) < 3:
71 raise error.TestError('Invalid output format. Unable to parse')
72
73 # Process the subsection containing performance results first.
74 for index, line in enumerate(subsections[1].strip().split('\n')):
75 # Look for problems first.
76 if re.search('no measured results', line, flags=re.IGNORECASE):
77 self.err.append(str(index + 1))
78
79 # Every performance result line ends with 6 values, with the sixth
80 # being the actual result. Make sure there are at least that words
81 # in the line before processing.
82 words = line.lower().split()
83 if len(words) >= 6:
84 key = re.sub('\W', '', '_'.join(words[:-6]))
85 keyval[key + suffix] = words[-6]
86
87 # The final score should be the last item in the third subsection.
88 keyval['score' + suffix] = subsections[2].strip().split()[-1]
89
90 self.write_perf_keyval(keyval)
91
92
93 def postprocess_iteration(self):
94 # Break up sections around dividing lines.
95 sections = self.report_data.split('-'*72)
96
97 # First section is junk to us, second has results for single CPU run.
98 if len(sections) > 1:
99 self.process_section(section=sections[1], suffix='')
100
101 # Only machines with > 1 CPU will have a 3rd section.
102 if len(sections) > 2:
103 self.process_section(section=sections[2], suffix='_multi')
104 else:
105 raise error.TestError('Invalid output format. Unable to parse')
106
107
108""" Here is a sample output:
109
110 # # # # # # # ##### ###### # # #### # #
111 # # ## # # # # # # # ## # # # # #
112 # # # # # # ## ##### ##### # # # # ######
113 # # # # # # ## # # # # # # # # #
114 # # # ## # # # # # # # ## # # # #
115 #### # # # # # ##### ###### # # #### # #
116
117 Version 5.1.2 Based on the Byte Magazine Unix Benchmark
118
119 Multi-CPU version Version 5 revisions by Ian Smith,
120 Sunnyvale, CA, USA
121 December 22, 2007 johantheghost at yahoo period com
122
123
1241 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10
125
1261 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10
127
1281 x Execl Throughput 1 2 3
129
1301 x File Copy 1024 bufsize 2000 maxblocks 1 2 3
131
1321 x File Copy 256 bufsize 500 maxblocks 1 2 3
133
1341 x File Copy 4096 bufsize 8000 maxblocks 1 2 3
135
1361 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10
137
1381 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10
139
1401 x Process Creation 1 2 3
141
1421 x System Call Overhead 1 2 3 4 5 6 7 8 9 10
143
1441 x Shell Scripts (1 concurrent) 1 2 3
145
1461 x Shell Scripts (8 concurrent) 1 2 3
147
1482 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10
149
1502 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10
151
1522 x Execl Throughput 1 2 3
153
1542 x File Copy 1024 bufsize 2000 maxblocks 1 2 3
155
1562 x File Copy 256 bufsize 500 maxblocks 1 2 3
157
1582 x File Copy 4096 bufsize 8000 maxblocks 1 2 3
159
1602 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10
161
1622 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10
163
1642 x Process Creation 1 2 3
165
1662 x System Call Overhead 1 2 3 4 5 6 7 8 9 10
167
1682 x Shell Scripts (1 concurrent) 1 2 3
169
1702 x Shell Scripts (8 concurrent) 1 2 3
171
172========================================================================
173 BYTE UNIX Benchmarks (Version 5.1.2)
174
175 System: localhost: GNU/Linux
176 OS: GNU/Linux -- 2.6.32.26+drm33.12 -- #1 SMP Wed Jan 12 16:16:05 PST 2011
177 Machine: i686 (GenuineIntel)
178 Language: en_US.utf8 (charmap=, collate=)
179 CPU 0: Intel(R) Atom(TM) CPU N455 @ 1.66GHz (3325.2 bogomips)
180 Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT
181 CPU 1: Intel(R) Atom(TM) CPU N455 @ 1.66GHz (3325.0 bogomips)
182 Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT
183 14:11:59 up 1 day, 1:10, 0 users, load average: 0.47, 0.48, 0.51; runlevel
184
185------------------------------------------------------------------------
186Benchmark Run: Fri Jan 14 2011 14:11:59 - 14:41:26
1872 CPUs in system; running 1 parallel copy of tests
188
189Dhrystone 2 using register variables 2264000.6 lps (10.0 s, 7 samples)
190Double-Precision Whetstone 507.0 MWIPS (10.1 s, 7 samples)
191Execl Throughput 796.7 lps (30.0 s, 2 samples)
192File Copy 1024 bufsize 2000 maxblocks 110924.1 KBps (30.1 s, 2 samples)
193File Copy 256 bufsize 500 maxblocks 32600.5 KBps (30.1 s, 2 samples)
194File Copy 4096 bufsize 8000 maxblocks 284236.5 KBps (30.0 s, 2 samples)
195Pipe Throughput 301672.5 lps (10.0 s, 7 samples)
196Pipe-based Context Switching 29475.3 lps (10.0 s, 7 samples)
197Process Creation 3124.6 lps (30.0 s, 2 samples)
198Shell Scripts (1 concurrent) 1753.0 lpm (60.0 s, 2 samples)
199Shell Scripts (8 concurrent) 305.9 lpm (60.1 s, 2 samples)
200System Call Overhead 592781.7 lps (10.0 s, 7 samples)
201
202System Benchmarks Index Values BASELINE RESULT INDEX
203Dhrystone 2 using register variables 116700.0 2264000.6 194.0
204Double-Precision Whetstone 55.0 507.0 92.2
205Execl Throughput 43.0 796.7 185.3
206File Copy 1024 bufsize 2000 maxblocks 3960.0 110924.1 280.1
207File Copy 256 bufsize 500 maxblocks 1655.0 32600.5 197.0
208File Copy 4096 bufsize 8000 maxblocks 5800.0 284236.5 490.1
209Pipe Throughput 12440.0 301672.5 242.5
210Pipe-based Context Switching 4000.0 29475.3 73.7
211Process Creation 126.0 3124.6 248.0
212Shell Scripts (1 concurrent) 42.4 1753.0 413.4
213Shell Scripts (8 concurrent) 6.0 305.9 509.8
214System Call Overhead 15000.0 592781.7 395.2
215 ========
216System Benchmarks Index Score 238.0
217
218------------------------------------------------------------------------
219Benchmark Run: Fri Jan 14 2011 14:41:26 - 15:09:23
2202 CPUs in system; running 2 parallel copies of tests
221
222Dhrystone 2 using register variables 3411919.6 lps (10.0 s, 7 samples)
223Double-Precision Whetstone 964.3 MWIPS (10.1 s, 7 samples)
224Execl Throughput 2053.5 lps (30.0 s, 2 samples)
225File Copy 1024 bufsize 2000 maxblocks 158308.0 KBps (30.0 s, 2 samples)
226File Copy 256 bufsize 500 maxblocks 46249.5 KBps (30.0 s, 2 samples)
227File Copy 4096 bufsize 8000 maxblocks 389881.9 KBps (30.0 s, 2 samples)
228Pipe Throughput 410193.1 lps (10.0 s, 7 samples)
229Pipe-based Context Switching 113780.0 lps (10.0 s, 7 samples)
230Process Creation 7609.0 lps (30.0 s, 2 samples)
231Shell Scripts (1 concurrent) 2355.0 lpm (60.0 s, 2 samples)
232Shell Scripts (8 concurrent) 308.1 lpm (60.2 s, 2 samples)
233System Call Overhead 1057063.2 lps (10.0 s, 7 samples)
234
235System Benchmarks Index Values BASELINE RESULT INDEX
236Dhrystone 2 using register variables 116700.0 3411919.6 292.4
237Double-Precision Whetstone 55.0 964.3 175.3
238Execl Throughput 43.0 2053.5 477.6
239File Copy 1024 bufsize 2000 maxblocks 3960.0 158308.0 399.8
240File Copy 256 bufsize 500 maxblocks 1655.0 46249.5 279.5
241File Copy 4096 bufsize 8000 maxblocks 5800.0 389881.9 672.2
242Pipe Throughput 12440.0 410193.1 329.7
243Pipe-based Context Switching 4000.0 113780.0 284.5
244Process Creation 126.0 7609.0 603.9
245Shell Scripts (1 concurrent) 42.4 2355.0 555.4
246Shell Scripts (8 concurrent) 6.0 308.1 513.5
247System Call Overhead 15000.0 1057063.2 704.7
248 ========
249System Benchmarks Index Score 407.4
250
251"""