2021-07-15 04:26:51 +02:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-05-10 04:56:16 +02:00
|
|
|
"github.com/TwiN/gatus/v5/config/endpoint"
|
2022-12-06 07:41:09 +01:00
|
|
|
"github.com/TwiN/gatus/v5/storage/store/common"
|
|
|
|
"github.com/TwiN/gatus/v5/storage/store/common/paging"
|
2021-07-15 04:26:51 +02:00
|
|
|
)
|
|
|
|
|
2021-10-23 22:47:12 +02:00
|
|
|
func BenchmarkShallowCopyEndpointStatus(b *testing.B) {
|
2024-05-10 04:56:16 +02:00
|
|
|
ep := &testEndpoint
|
|
|
|
status := endpoint.NewStatus(ep.Group, ep.Name)
|
2021-08-13 03:54:23 +02:00
|
|
|
for i := 0; i < common.MaximumNumberOfResults; i++ {
|
2021-10-23 22:47:12 +02:00
|
|
|
AddResult(status, &testSuccessfulResult)
|
2021-07-15 04:26:51 +02:00
|
|
|
}
|
|
|
|
for n := 0; n < b.N; n++ {
|
2021-10-23 22:47:12 +02:00
|
|
|
ShallowCopyEndpointStatus(status, paging.NewEndpointStatusParams().WithResults(1, 20))
|
2021-07-15 04:26:51 +02:00
|
|
|
}
|
|
|
|
b.ReportAllocs()
|
|
|
|
}
|