benchmark testing file

This commit is contained in:
Ella Pietraroia 2020-02-06 17:19:58 +10:30
parent 08bbe7c917
commit 034a2622b7
1 changed files with 17 additions and 5 deletions

View File

@ -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 {