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 | |
---|
3 | import bisect, random, os, re |
---|
4 | |
---|
5 | from pyutil import fileutil |
---|
6 | |
---|
7 | assert not os.path.exists("benchresults") |
---|
8 | |
---|
9 | os.mkdir("benchresults") |
---|
10 | |
---|
11 | MIN=512 |
---|
12 | MAX=1024 |
---|
13 | |
---|
14 | results = {} |
---|
15 | |
---|
16 | R=re.compile("ave rate: ([1-9][0-9]*)") |
---|
17 | |
---|
18 | def 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 | |
---|
38 | measure(MIN) |
---|
39 | measure(MAX) |
---|
40 | |
---|
41 | while True: |
---|
42 | stride = random.randrange(MIN, MAX+1) |
---|
43 | measure(stride) |
---|
Note: See
TracBrowser
for help on using the repository browser.