2021-07-14 22:26:51 -04:00
|
|
|
package memory
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2024-05-09 22:56:16 -04:00
|
|
|
"github.com/TwiN/gatus/v5/config/endpoint"
|
2025-05-17 16:10:28 -04:00
|
|
|
"github.com/TwiN/gatus/v5/storage"
|
2022-12-06 01:41:09 -05:00
|
|
|
"github.com/TwiN/gatus/v5/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) {
|
2024-05-09 22:56:16 -04:00
|
|
|
ep := &testEndpoint
|
|
|
|
|
status := endpoint.NewStatus(ep.Group, ep.Name)
|
2025-05-17 16:10:28 -04:00
|
|
|
for i := 0; i < storage.DefaultMaximumNumberOfResults; i++ {
|
|
|
|
|
AddResult(status, &testSuccessfulResult, storage.DefaultMaximumNumberOfResults, storage.DefaultMaximumNumberOfEvents)
|
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()
|
|
|
|
|
}
|