summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua MacDonald <josh.macdonald@gmail.com>2015-12-12 20:36:07 -0800
committerJoshua MacDonald <josh.macdonald@gmail.com>2015-12-12 20:36:07 -0800
commit41bc46207416ef73dab0f201c064415241af2ffc (patch)
tree5b8140cce2b23bb3bfd34af83b4cfdf8d607b0eb
parent29a5718a2c10feb0d3b92b52dfa7dc470f7c705e (diff)
Print timing stats for dataset test
-rw-r--r--xdelta3/go/src/regtest.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/xdelta3/go/src/regtest.go b/xdelta3/go/src/regtest.go
index 233e005..c6691b0 100644
--- a/xdelta3/go/src/regtest.go
+++ b/xdelta3/go/src/regtest.go
@@ -3,7 +3,9 @@ package main
3import ( 3import (
4 "fmt" 4 "fmt"
5 "io" 5 "io"
6 "path"
6 "os" 7 "os"
8 "time"
7 9
8 "xdelta" 10 "xdelta"
9) 11)
@@ -65,6 +67,7 @@ type PairTest struct {
65 67
66 // Output 68 // Output
67 encoded int64 69 encoded int64
70 duration time.Duration
68} 71}
69 72
70// P is the test program, Q is the reference version. 73// P is the test program, Q is the reference version.
@@ -94,14 +97,22 @@ func (cfg Config) datasetTest(t *xdelta.TestGroup, p, q xdelta.Program) {
94 largest := uint(20) 97 largest := uint(20)
95 for ; largest <= 31 && 1<<largest < meansize; largest++ {} 98 for ; largest <= 31 && 1<<largest < meansize; largest++ {}
96 99
97 // 1/8, 1/4, 1/2, and 1/1 of the power-of-2 rounded-up mean size 100 // 1/4, 1/2, and 1/1 of the power-of-2 rounded-up mean size
98 for b := largest /* - 3*/; b <= largest; b++ { 101 for b := largest - 2; b <= largest; b++ {
99 c1 := cfg 102 c1 := cfg
100 c1.srcbuf_size = 1<<b 103 c1.srcbuf_size = 1<<b
101 ptest := &PairTest{c1, p, in1, in2, -1} 104 ptest := &PairTest{c1, p, in1, in2, -1, 0}
102 ptest.datasetPairTest(t, 1<<b); 105 ptest.datasetPairTest(t, 1<<b);
103 qtest := &PairTest{c1, q, in1, in2, -1} 106 qtest := &PairTest{c1, q, in1, in2, -1, 0}
104 qtest.datasetPairTest(t, 1<<b) 107 qtest.datasetPairTest(t, 1<<b)
108
109 fmt.Printf("%s, %s: %+d / %d bytes, %s / %s [B=%d]\n",
110 path.Base(in1), path.Base(in2),
111 ptest.encoded - qtest.encoded,
112 qtest.encoded,
113 (ptest.duration - qtest.duration).String(),
114 qtest.duration,
115 1<<b)
105 } 116 }
106 } 117 }
107 } 118 }
@@ -137,7 +148,7 @@ func (pt *PairTest) datasetPairTest(t *xdelta.TestGroup, meanSize int64) {
137 148
138 t.Wait(enc, dec) 149 t.Wait(enc, dec)
139 150
140 fmt.Println("PairTest", pt, "success") 151 pt.duration = enc.Cmd.ProcessState.UserTime()
141} 152}
142 153
143func (cfg Config) offsetTest(t *xdelta.TestGroup, p xdelta.Program, offset, length int64) { 154func (cfg Config) offsetTest(t *xdelta.TestGroup, p xdelta.Program, offset, length int64) {