forked from GoogleCloudPlatform/PerfKitBenchmarker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunixbench_benchmark_test.py
145 lines (135 loc) · 7.71 KB
/
unixbench_benchmark_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for unixbench_benchmark."""
import os
import unittest
from perfkitbenchmarker import sample
from perfkitbenchmarker import test_util
from perfkitbenchmarker.linux_benchmarks import unixbench_benchmark
class UnixBenchBenchmarkTestCase(unittest.TestCase, test_util.SamplesTestMixin):
maxDiff = None
def setUp(self):
path = os.path.join(os.path.dirname(__file__), '..', 'data',
'unix-bench-sample-result.txt')
with open(path) as fp:
self.contents = fp.read()
def tearDown(self):
pass
def testParseUnixBench(self):
result = unixbench_benchmark.ParseResults(self.contents)
expected_result = [
['Dhrystone 2 using register variables', 34872897.7, 'lps',
{'num_parallel_copies': 1, 'samples': 7, 'time': '10.0s'}],
['Double-Precision Whetstone', 4022.0, 'MWIPS',
{'num_parallel_copies': 1, 'samples': 7, 'time': '9.9s'}],
['Execl Throughput', 4735.8, 'lps',
{'num_parallel_copies': 1, 'samples': 2, 'time': '29.8s'}],
['File Copy 1024 bufsize 2000 maxblocks', 1294367.0, 'KBps',
{'num_parallel_copies': 1, 'samples': 2, 'time': '30.0s'}],
['File Copy 256 bufsize 500 maxblocks', 396912.9, 'KBps',
{'num_parallel_copies': 1, 'samples': 2, 'time': '30.0s'}],
['File Copy 4096 bufsize 8000 maxblocks', 2513158.7, 'KBps',
{'num_parallel_copies': 1, 'samples': 2, 'time': '30.0s'}],
['Pipe Throughput', 2221775.6, 'lps',
{'num_parallel_copies': 1, 'samples': 7, 'time': '10.0s'}],
['Pipe-based Context Switching', 369000.7, 'lps',
{'num_parallel_copies': 1, 'samples': 7, 'time': '10.0s'}],
['Process Creation', 12587.7, 'lps',
{'num_parallel_copies': 1, 'samples': 2, 'time': '30.0s'}],
['Shell Scripts (1 concurrent)', 8234.3, 'lpm',
{'num_parallel_copies': 1, 'samples': 2, 'time': '60.0s'}],
['Shell Scripts (8 concurrent)', 1064.5, 'lpm',
{'num_parallel_copies': 1, 'samples': 2, 'time': '60.0s'}],
['System Call Overhead', 4439274.5, 'lps',
{'num_parallel_copies': 1, 'samples': 7, 'time': '10.0s'}],
['Dhrystone 2 using register variables:score', 34872897.7, '',
{'index': 2988.3, 'baseline': 116700.0, 'num_parallel_copies': 1}],
['Double-Precision Whetstone:score', 4022.0, '',
{'index': 731.3, 'baseline': 55.0, 'num_parallel_copies': 1}],
['Execl Throughput:score', 4735.8, '',
{'index': 1101.4, 'baseline': 43.0, 'num_parallel_copies': 1}],
['File Copy 1024 bufsize 2000 maxblocks:score', 1294367.0, '',
{'index': 3268.6, 'baseline': 3960.0, 'num_parallel_copies': 1}],
['File Copy 256 bufsize 500 maxblocks:score', 396912.9, '',
{'index': 2398.3, 'baseline': 1655.0, 'num_parallel_copies': 1}],
['File Copy 4096 bufsize 8000 maxblocks:score', 2513158.7, '',
{'index': 4333.0, 'baseline': 5800.0, 'num_parallel_copies': 1}],
['Pipe Throughput:score', 2221775.6, '',
{'index': 1786.0, 'baseline': 12440.0, 'num_parallel_copies': 1}],
['Pipe-based Context Switching:score', 369000.7, '',
{'index': 922.5, 'baseline': 4000.0, 'num_parallel_copies': 1}],
['Process Creation:score', 12587.7, '',
{'index': 999.0, 'baseline': 126.0, 'num_parallel_copies': 1}],
['Shell Scripts (1 concurrent):score', 8234.3, '',
{'index': 1942.1, 'baseline': 42.4, 'num_parallel_copies': 1}],
['Shell Scripts (8 concurrent):score', 1064.5, '',
{'index': 1774.2, 'baseline': 6.0, 'num_parallel_copies': 1}],
['System Call Overhead:score', 4439274.5, '',
{'index': 2959.5, 'baseline': 15000.0, 'num_parallel_copies': 1}],
['System Benchmarks Index Score', 1825.8, '',
{'num_parallel_copies': 1}],
['Dhrystone 2 using register variables', 155391896.7, 'lps',
{'num_parallel_copies': 8, 'samples': 7, 'time': '10.0s'}],
['Double-Precision Whetstone', 28632.5, 'MWIPS',
{'num_parallel_copies': 8, 'samples': 7, 'time': '9.8s'}],
['Execl Throughput', 15184.0, 'lps',
{'num_parallel_copies': 8, 'samples': 2, 'time': '30.0s'}],
['File Copy 1024 bufsize 2000 maxblocks', 985484.8, 'KBps',
{'num_parallel_copies': 8, 'samples': 2, 'time': '30.0s'}],
['File Copy 256 bufsize 500 maxblocks', 269732.2, 'KBps',
{'num_parallel_copies': 8, 'samples': 2, 'time': '30.0s'}],
['File Copy 4096 bufsize 8000 maxblocks', 2706156.4, 'KBps',
{'num_parallel_copies': 8, 'samples': 2, 'time': '30.0s'}],
['Pipe Throughput', 8525928.8, 'lps',
{'num_parallel_copies': 8, 'samples': 7, 'time': '10.0s'}],
['Pipe-based Context Switching', 1017270.4, 'lps',
{'num_parallel_copies': 8, 'samples': 7, 'time': '10.0s'}],
['Process Creation', 31563.7, 'lps',
{'num_parallel_copies': 8, 'samples': 2, 'time': '30.0s'}],
['Shell Scripts (1 concurrent)', 32516.3, 'lpm',
{'num_parallel_copies': 8, 'samples': 2, 'time': '60.0s'}],
['Shell Scripts (8 concurrent)', 5012.2, 'lpm',
{'num_parallel_copies': 8, 'samples': 2, 'time': '60.0s'}],
['System Call Overhead', 10288762.3, 'lps',
{'num_parallel_copies': 8, 'samples': 7, 'time': '10.0s'}],
['Dhrystone 2 using register variables:score', 155391896.7, '',
{'index': 13315.5, 'baseline': 116700.0, 'num_parallel_copies': 8}],
['Double-Precision Whetstone:score', 28632.5, '',
{'index': 5205.9, 'baseline': 55.0, 'num_parallel_copies': 8}],
['Execl Throughput:score', 15184.0, '',
{'index': 3531.2, 'baseline': 43.0, 'num_parallel_copies': 8}],
['File Copy 1024 bufsize 2000 maxblocks:score', 985484.8, '',
{'index': 2488.6, 'baseline': 3960.0, 'num_parallel_copies': 8}],
['File Copy 256 bufsize 500 maxblocks:score', 269732.2, '',
{'index': 1629.8, 'baseline': 1655.0, 'num_parallel_copies': 8}],
['File Copy 4096 bufsize 8000 maxblocks:score', 2706156.4, '',
{'index': 4665.8, 'baseline': 5800.0, 'num_parallel_copies': 8}],
['Pipe Throughput:score', 8525928.8, '',
{'index': 6853.6, 'baseline': 12440.0, 'num_parallel_copies': 8}],
['Pipe-based Context Switching:score', 1017270.4, '',
{'index': 2543.2, 'baseline': 4000.0, 'num_parallel_copies': 8}],
['Process Creation:score', 31563.7, '',
{'index': 2505.1, 'baseline': 126.0, 'num_parallel_copies': 8}],
['Shell Scripts (1 concurrent):score', 32516.3, '',
{'index': 7668.9, 'baseline': 42.4, 'num_parallel_copies': 8}],
['Shell Scripts (8 concurrent):score', 5012.2, '',
{'index': 8353.6, 'baseline': 6.0, 'num_parallel_copies': 8}],
['System Call Overhead:score', 10288762.3, '',
{'index': 6859.2, 'baseline': 15000.0, 'num_parallel_copies': 8}],
['System Benchmarks Index Score', 4596.2, '',
{'num_parallel_copies': 8}]]
expected_result = [sample.Sample(*exp) for exp in expected_result]
self.assertSampleListsEqualUpToTimestamp(result, expected_result)
if __name__ == '__main__':
unittest.main()