You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
import sys
|
|
from testing.embedding.test_basic import EmbeddingTests
|
|
|
|
if sys.platform == 'win32':
|
|
import py
|
|
py.test.skip("written with POSIX functions")
|
|
|
|
|
|
class TestPerformance(EmbeddingTests):
|
|
def test_perf_single_threaded(self):
|
|
perf_cffi = self.prepare_module('perf')
|
|
self.compile('perf-test', [perf_cffi], opt=True)
|
|
output = self.execute('perf-test')
|
|
print('='*79)
|
|
print(output.rstrip())
|
|
print('='*79)
|
|
|
|
def test_perf_in_1_thread(self):
|
|
perf_cffi = self.prepare_module('perf')
|
|
self.compile('perf-test', [perf_cffi], opt=True, threads=True,
|
|
defines={'PTEST_USE_THREAD': '1'})
|
|
output = self.execute('perf-test')
|
|
print('='*79)
|
|
print(output.rstrip())
|
|
print('='*79)
|
|
|
|
def test_perf_in_2_threads(self):
|
|
perf_cffi = self.prepare_module('perf')
|
|
self.compile('perf-test', [perf_cffi], opt=True, threads=True,
|
|
defines={'PTEST_USE_THREAD': '2'})
|
|
output = self.execute('perf-test')
|
|
print('='*79)
|
|
print(output.rstrip())
|
|
print('='*79)
|
|
|
|
def test_perf_in_4_threads(self):
|
|
perf_cffi = self.prepare_module('perf')
|
|
self.compile('perf-test', [perf_cffi], opt=True, threads=True,
|
|
defines={'PTEST_USE_THREAD': '4'})
|
|
output = self.execute('perf-test')
|
|
print('='*79)
|
|
print(output.rstrip())
|
|
print('='*79)
|
|
|
|
def test_perf_in_8_threads(self):
|
|
perf_cffi = self.prepare_module('perf')
|
|
self.compile('perf-test', [perf_cffi], opt=True, threads=True,
|
|
defines={'PTEST_USE_THREAD': '8'})
|
|
output = self.execute('perf-test')
|
|
print('='*79)
|
|
print(output.rstrip())
|
|
print('='*79)
|