From 034a2622b702000cfca6ec55fde4ee9a3f50ee10 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Thu, 6 Feb 2020 17:19:58 +1030 Subject: [PATCH] benchmark testing file --- filter/filter_test.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/filter/filter_test.go b/filter/filter_test.go index bb6eb22d..81ab3c18 100644 --- a/filter/filter_test.go +++ b/filter/filter_test.go @@ -39,7 +39,7 @@ import ( //frames into a byte slice of 10 func BenchmarkBasic(b *testing.B) { - file, _ := os.Create("test_outMOG.mjpeg") + file, _ := os.Create("testout/test_outBasic.mjpeg") w := io.WriteCloser(file) f := NewBasic(w, false, 45000, 1000) fmt.Print("\nFrames: ", len(testPackets)) @@ -51,9 +51,21 @@ func BenchmarkBasic(b *testing.B) { } func BenchmarkDifference(b *testing.B) { - file, _ := os.Create("test_outMOG.mjpeg") + file, _ := os.Create("testout/test_outDiff.mjpeg") w := io.WriteCloser(file) - f := NewDifference() + f := NewDifference(w, false, 3) + fmt.Print("\nFrames: ", len(testPackets)) + for n := 0; n < b.N; n++ { + for _, x := range testPackets { + f.Write(x) + } + } +} + +func BenchmarkKNN(b *testing.B) { + file, _ := os.Create("testout/test_outKNN.mjpeg") + w := io.WriteCloser(file) + f := NewKNN(w, 25, 20, 300, 9, false, 1, 1) fmt.Print("\nFrames: ", len(testPackets)) for n := 0; n < b.N; n++ { for _, x := range testPackets { @@ -63,9 +75,9 @@ func BenchmarkDifference(b *testing.B) { } func BenchmarkMOG(b *testing.B) { - file, _ := os.Create("test_outMOG.mjpeg") + file, _ := os.Create("testout/test_outMOG.mjpeg") w := io.WriteCloser(file) - f := NewMOGFilter(w, 25, 20, 500, false, 1) + f := NewMOG(w, 25, 20, 500, false, 1, 1) fmt.Print("\nFrames: ", len(testPackets)) for n := 0; n < b.N; n++ { for _, x := range testPackets {