2021-07-15 04:26:51 +02:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/TwinProduction/gatus/core"
|
2021-08-13 03:54:23 +02:00
|
|
|
"github.com/TwinProduction/gatus/storage/store/common"
|
|
|
|
"github.com/TwinProduction/gatus/storage/store/common/paging"
|
2021-07-15 04:26:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkShallowCopyServiceStatus(b *testing.B) {
|
|
|
|
service := &testService
|
|
|
|
serviceStatus := core.NewServiceStatus(service.Key(), service.Group, service.Name)
|
2021-08-13 03:54:23 +02:00
|
|
|
for i := 0; i < common.MaximumNumberOfResults; i++ {
|
2021-07-15 04:26:51 +02:00
|
|
|
AddResult(serviceStatus, &testSuccessfulResult)
|
|
|
|
}
|
|
|
|
for n := 0; n < b.N; n++ {
|
|
|
|
ShallowCopyServiceStatus(serviceStatus, paging.NewServiceStatusParams().WithResults(1, 20))
|
|
|
|
}
|
|
|
|
b.ReportAllocs()
|
|
|
|
}
|