summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xdelta3/plot.sh4
-rwxr-xr-xxdelta3/xdelta3-regtest.py49
2 files changed, 43 insertions, 10 deletions
diff --git a/xdelta3/plot.sh b/xdelta3/plot.sh
index 982fcbe..d5f8dab 100644
--- a/xdelta3/plot.sh
+++ b/xdelta3/plot.sh
@@ -8,12 +8,12 @@ O=$2
8$G > $O <<EOF 8$G > $O <<EOF
9set terminal jpeg 9set terminal jpeg
10 10
11#f(x) = 8750000 + 6500 * x * (1 / (x - 12)) 11f(x) = 1331000 + 30000 * (1 / (x - 2.45))
12 12
13# plot [x=1:10] [1:10] f(x) 13# plot [x=1:10] [1:10] f(x)
14# plot sin(x), cos(x) 14# plot sin(x), cos(x)
15# , f(x) 15# , f(x)
16 16
17plot "$I" using 1:2 17plot "$I" using 1:2, f(x)
18 18
19EOF 19EOF
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index a910696..a1704e7 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -27,7 +27,7 @@ import xdelta3
27#RCSDIR = '/tmp/PRCS_read_copy' 27#RCSDIR = '/tmp/PRCS_read_copy'
28#SAMPLEDIR = "/tmp/WESNOTH_tmp/diff" 28#SAMPLEDIR = "/tmp/WESNOTH_tmp/diff"
29 29
30RCSDIR = 'G:/jmacd/PRCS/prcs' 30RCSDIR = 'G:/jmacd/PRCS/prcs/b'
31SAMPLEDIR = "C:/sample_data/Wesnoth/tar" 31SAMPLEDIR = "C:/sample_data/Wesnoth/tar"
32 32
33# 33#
@@ -45,8 +45,8 @@ SKIP_DECODE = 1
45MIN_STDDEV_PCT = 1.5 45MIN_STDDEV_PCT = 1.5
46 46
47# How many results per round 47# How many results per round
48MAX_RESULTS = 100 48MAX_RESULTS = 10
49TEST_ROUNDS = 20 49TEST_ROUNDS = 50
50KEEP_P = (0.5) 50KEEP_P = (0.5)
51 51
52# For RCS testing, what percent to select 52# For RCS testing, what percent to select
@@ -876,7 +876,7 @@ def ConfigToArgs(config):
876# 876#
877class RandomTest: 877class RandomTest:
878 def __init__(self, tnum, tinput, config): 878 def __init__(self, tnum, tinput, config):
879 self.tinput = tinput[2] 879 self.mytinput = tinput[2]
880 self.myconfig = config 880 self.myconfig = config
881 self.tnum = tnum 881 self.tnum = tnum
882 882
@@ -921,6 +921,10 @@ class RandomTest:
921 def score(self): 921 def score(self):
922 return self.score 922 return self.score
923 #end 923 #end
924
925 def tinput(self):
926 return self.mytinput
927 #end
924#end 928#end
925 929
926def PosInAlist(l, e): 930def PosInAlist(l, e):
@@ -984,20 +988,47 @@ def RunTestLoop(rand, generator, rounds):
984 tests.append(RandomTest(x, tinput, configs[x])) 988 tests.append(RandomTest(x, tinput, configs[x]))
985 #end 989 #end
986 results = ScoreTests(tests) 990 results = ScoreTests(tests)
987 GraphResults(rnum, results) 991 GraphResults('expt%d' % rnum, results)
992 GraphSummary('sum%d' % rnum, results)
988 993
989 # re-test some fraction 994 # re-test some fraction
990 configs = [r.config() for r in results[0:int(MAX_RESULTS * KEEP_P)]] 995 configs = [r.config() for r in results[0:int(MAX_RESULTS * KEEP_P)]]
991 #end 996 #end
992#end 997#end
993 998
994def GraphResults(rnum, results): 999def GraphResults(desc, results):
995 f = open("data-%d.in" % rnum, "w") 1000 f = open("data-%s.csv" % desc, "w")
996 for r in results: 1001 for r in results:
997 f.write("%0.9f\t%d\t# %s\n" % (r.time(), r.size(), r)) 1002 f.write("%0.9f\t%d\t# %s\n" % (r.time(), r.size(), r))
998 #end 1003 #end
999 f.close() 1004 f.close()
1000 os.system("./plot.sh data-%d.in round-%d.jpg" % (rnum, rnum)) 1005 os.system("./plot.sh data-%s.csv plot-%s.jpg" % (desc, desc))
1006#end
1007
1008def GraphSummary(desc, results):
1009 results_by_input = {}
1010 this_tinput = results[0].tinput()
1011
1012 # all test results in this set share at least the current tinput.
1013 # find the set of all tinputs
1014 for rtest in results:
1015 s = c2s(rtest.config())
1016 all = test_state_xxx[s]
1017
1018 print '%s have %d results for %s' % (desc, len(all), s)
1019
1020 for atest in all:
1021 if not results_by_input.has_key(atest.tinput()):
1022 results_by_input[atest.tinput()] = [atest]
1023 else:
1024 results_by_input[atest.tinput()].append(atest)
1025 #end
1026 #end
1027 #end
1028
1029 for testkey, rlist in results_by_input.items():
1030
1031 #end
1001#end 1032#end
1002 1033
1003# TODO: cleanup 1034# TODO: cleanup
@@ -1104,3 +1135,5 @@ if __name__ == "__main__":
1104 else: 1135 else:
1105 RunCommand(['rm', '-rf', TMPDIR]) 1136 RunCommand(['rm', '-rf', TMPDIR])
1106 pass 1137 pass
1138 #end
1139#end