dbench.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:avocado-misc-tests 作者: avocado-framework 项目源码 文件源码
def test(self):
        '''
        Test Execution with necessary args
        '''
        dir = self.params.get('dir', default='.')
        nprocs = self.params.get('nprocs', default=None)
        seconds = self.params.get('seconds', default=60)
        args = self.params.get('args', default='')
        if not nprocs:
            nprocs = multiprocessing.cpu_count()
        loadfile = os.path.join(self.srcdir, 'client.txt')
        cmd = '%s/dbench %s %s -D %s -c %s -t %d' % (self.srcdir, nprocs, args,
                                                     dir, loadfile, seconds)
        process.run(cmd)

        self.results = process.system_output(cmd)
        pattern = re.compile(r"Throughput (.*?) MB/sec (.*?) procs")
        (throughput, procs) = pattern.findall(self.results)[0]
        perf_json = {'throughput': throughput, 'procs': procs}
        output_path = os.path.join(self.outputdir, "perf.json")
        json.dump(perf_json, open(output_path, "w"))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号