1 # This requires aio headers to build. 2 # Should work automagically out of deps now. 3 import os 4 from autotest_lib.client.bin import test, utils 5 6 7 class aiostress(test.test): 8 version = 3 9 10 def initialize(self): 11 self.job.require_gcc() 12 self.job.setup_dep(['libaio']) 13 ldflags = '-L ' + self.autodir + '/deps/libaio/lib' 14 cflags = '-I ' + self.autodir + '/deps/libaio/include' 15 self.gcc_flags = ldflags + ' ' + cflags 16 17 18 # ftp://ftp.suse.com/pub/people/mason/utils/aio-stress.c 19 def setup(self, tarball = None): 20 os.mkdir(self.srcdir) 21 os.chdir(self.srcdir) 22 utils.system('cp ' + self.bindir+'/aio-stress.c .') 23 os.chdir(self.srcdir) 24 self.gcc_flags += ' -Wall -lpthread -laio' 25 cmd = 'gcc ' + self.gcc_flags + ' aio-stress.c -o aio-stress' 26 utils.system(cmd) 27 28 29 def run_once(self, args = ''): 30 os.chdir(self.tmpdir) 31 libs = self.autodir+'/deps/libaio/lib/' 32 ld_path = utils.prepend_path(libs, 33 utils.environ('LD_LIBRARY_PATH')) 34 var_ld_path = 'LD_LIBRARY_PATH=' + ld_path 35 cmd = self.srcdir + '/aio-stress ' + args + ' poo' 36 37 stderr = os.path.join(self.debugdir, 'stderr') 38 utils.system('%s %s 2> %s' % (var_ld_path, cmd, stderr)) 39 report = open(stderr) 40 self.format_results(report) 41 42 43 def format_results(self, report): 44 for line in report: 45 if 'threads' in line: 46 if 'files' in line: 47 if 'contexts' in line: 48 break 49 50 keyval = {} 51 for line in report: 52 line = line.split(')')[0] 53 key, value = line.split('(') 54 key = key.strip().replace(' ', '_') 55 value = value.split()[0] 56 keyval[key] = value 57 58 self.write_perf_keyval(keyval) 59 60 """ 61 file size 1024MB, record size 64KB, depth 64, ios per iteration 8 62 max io_submit 8, buffer alignment set to 4KB 63 threads 1 files 1 contexts 1 context offset 2MB verification off 64 write on poo (245.77 MB/s) 1024.00 MB in 4.17s 65 thread 0 write totals (55.86 MB/s) 1024.00 MB in 18.33s 66 read on poo (1311.54 MB/s) 1024.00 MB in 0.78s 67 thread 0 read totals (1307.66 MB/s) 1024.00 MB in 0.78s 68 random write on poo (895.47 MB/s) 1024.00 MB in 1.14s 69 thread 0 random write totals (18.42 MB/s) 1024.00 MB in 55.59s 70 random read on poo (1502.89 MB/s) 1024.00 MB in 0.68s 71 thread 0 random read totals (1474.36 MB/s) 1024.00 MB in 0.69s 72 """ 73