2021-07-14 22:26:51 -04:00
|
|
|
package memory
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2022-06-20 21:25:14 -04:00
|
|
|
"github.com/TwiN/gatus/v4/core"
|
|
|
|
|
"github.com/TwiN/gatus/v4/storage/store/common"
|
|
|
|
|
"github.com/TwiN/gatus/v4/storage/store/common/paging"
|
2021-07-14 22:26:51 -04:00
|
|
|
)
|
|
|
|
|
|
2021-10-23 16:47:12 -04:00
|
|
|
func BenchmarkShallowCopyEndpointStatus(b *testing.B) {
|
|
|
|
|
endpoint := &testEndpoint
|
|
|
|
|
status := core.NewEndpointStatus(endpoint.Group, endpoint.Name)
|
2021-08-12 21:54:23 -04:00
|
|
|
for i := 0; i < common.MaximumNumberOfResults; i++ {
|
2021-10-23 16:47:12 -04:00
|
|
|
AddResult(status, &testSuccessfulResult)
|
2021-07-14 22:26:51 -04:00
|
|
|
}
|
|
|
|
|
for n := 0; n < b.N; n++ {
|
2021-10-23 16:47:12 -04:00
|
|
|
ShallowCopyEndpointStatus(status, paging.NewEndpointStatusParams().WithResults(1, 20))
|
2021-07-14 22:26:51 -04:00
|
|
|
}
|
|
|
|
|
b.ReportAllocs()
|
|
|
|
|
}
|