From 318dabfa4bd68711900f59cbc9d75c7b1d15d958 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Sat, 26 Dec 2015 21:44:56 -0800 Subject: Sum and print summary by source window size --- xdelta3/go/src/regtest.go | 59 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/xdelta3/go/src/regtest.go b/xdelta3/go/src/regtest.go index 7b23ce0..f5c5480 100644 --- a/xdelta3/go/src/regtest.go +++ b/xdelta3/go/src/regtest.go @@ -66,9 +66,28 @@ type PairTest struct { source, target string // Output + TestOutput +} + +type TestOutput struct { encoded int64 encDuration time.Duration decDuration time.Duration + encSysDuration time.Duration + decSysDuration time.Duration +} + +func (to *TestOutput) Add(a TestOutput) { + to.encoded += a.encoded + to.encDuration += a.encDuration + to.decDuration += a.decDuration + to.encSysDuration += a.encSysDuration + to.decSysDuration += a.decSysDuration +} + +func (to *TestOutput) String() string { + return fmt.Sprintf("SIZE: %v\tTIME: %v", + to.encoded, to.encDuration) } // P is the test program, Q is the reference version. @@ -91,6 +110,8 @@ func (cfg Config) datasetTest(t *xdelta.TestGroup, p, q xdelta.Program) { total += d.Size() } meansize := total / int64(len(dents)) + testSum := map[uint]*TestOutput{} + compSum := map[uint]*TestOutput{} for _, in1 := range paths { for _, in2 := range paths { if in1 == in2 { continue } @@ -99,26 +120,46 @@ func (cfg Config) datasetTest(t *xdelta.TestGroup, p, q xdelta.Program) { for ; largest <= 31 && 1<