source: trunk/stridetune-bench.py

Last change on this file was 307b550, checked in by Ramakrishnan Muthukrishnan <ram@…>, 9 years ago

zfec: rearrange files

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/usr/bin/env python
2
3import bisect, random, os, re
4
5from pyutil import fileutil
6
7assert not os.path.exists("benchresults")
8
9os.mkdir("benchresults")
10
11MIN=512
12MAX=1024
13
14results = {}
15
16R=re.compile("ave rate: ([1-9][0-9]*)")
17
18def measure(stride):
19    fileutil.rm_dir("build")
20    fileutil.rm_dir("instdir")
21    fileutil.remove_if_possible(os.path.join("zfec", "_fec.so"))
22    fileutil.make_dirs("instdir")
23    fname = os.path.join("benchresults", "comp_0-stride_%d"%stride)
24    os.system("PYTHONPATH=instdir ./setup.py develop --install-dir=instdir --stride=%d >/dev/null" % stride)
25    os.system("PYTHONPATH=instdir python -OO ./bench/bench_zfec.py >> %s" % fname)
26    inf = open(fname, "rU")
27    for l in inf:
28        m = R.search(l)
29        if m:
30            result = int(m.group(1))
31            if results.has_key(stride):
32                print "stride: %d, results: %d (dup %d)" % (stride, result, results[stride])
33            else:
34                print "stride: %d, results: %d" % (stride, result)
35            results[stride] = result
36            break
37
38measure(MIN)
39measure(MAX)
40
41while True:
42    stride = random.randrange(MIN, MAX+1)
43    measure(stride)
Note: See TracBrowser for help on using the repository browser.