benchmark testing file

This commit is contained in:
Ella Pietraroia 2020-02-06 17:19:58 +10:30
parent f076330799
commit 06a854c661
1 changed files with 31 additions and 0 deletions

View File

@ -35,11 +35,18 @@ func (d *d) Write(p []byte) (int, error) { return len(p), nil }
func (d *d) Close() error { return nil }
func BenchmarkBasic(b *testing.B) {
<<<<<<< HEAD
const BasicThreshold = 45000
const BasicPixels = 1000
buffer := &d{}
f := NewBasic(buffer, BasicThreshold, BasicPixels)
b.Log("Frames: ", len(testPackets))
=======
file, _ := os.Create("testout/test_outBasic.mjpeg")
w := io.WriteCloser(file)
f := NewBasic(w, false, 45000, 1000)
fmt.Print("\nFrames: ", len(testPackets))
>>>>>>> 31ccc30a... benchmark testing file
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
_, err := f.Write(x)
@ -51,6 +58,7 @@ func BenchmarkBasic(b *testing.B) {
}
func BenchmarkDifference(b *testing.B) {
<<<<<<< HEAD
const DiffThreshold = 3.0
buffer := &d{}
f := NewDifference(buffer, DiffThreshold)
@ -61,11 +69,21 @@ func BenchmarkDifference(b *testing.B) {
if err != nil {
b.Fatalf("cannot write to diff filter: %v#", err)
}
=======
file, _ := os.Create("testout/test_outDiff.mjpeg")
w := io.WriteCloser(file)
f := NewDifference(w, false, 3)
fmt.Print("\nFrames: ", len(testPackets))
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
f.Write(x)
>>>>>>> 31ccc30a... benchmark testing file
}
}
}
func BenchmarkKNN(b *testing.B) {
<<<<<<< HEAD
const motionDownscaling = 1
const motionInterval = 1
const KNNMinArea = 25.0
@ -75,6 +93,12 @@ func BenchmarkKNN(b *testing.B) {
buffer := &d{}
f := NewKNN(buffer, KNNMinArea, KNNThreshold, KNNHistory, KNNKernel, motionInterval, motionDownscaling)
b.Log("Frames: ", len(testPackets))
=======
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))
>>>>>>> 31ccc30a... benchmark testing file
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
_, err := f.Write(x)
@ -86,6 +110,7 @@ func BenchmarkKNN(b *testing.B) {
}
func BenchmarkMOG(b *testing.B) {
<<<<<<< HEAD
const motionDownscaling = 1
const motionInterval = 1
const MOGMinArea = 25.0
@ -94,6 +119,12 @@ func BenchmarkMOG(b *testing.B) {
buffer := &d{}
f := NewMOG(buffer, MOGMinArea, MOGThreshold, MOGHistory, motionInterval, motionDownscaling)
b.Log("Frames: ", len(testPackets))
=======
file, _ := os.Create("testout/test_outMOG.mjpeg")
w := io.WriteCloser(file)
f := NewMOG(w, 25, 20, 500, false, 1, 1)
fmt.Print("\nFrames: ", len(testPackets))
>>>>>>> 31ccc30a... benchmark testing file
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
_, err := f.Write(x)