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
|
|
|
)
|
|
|
|
|
|
2025-09-17 15:10:08 -04:00
|
|
|
func BenchmarkShallowCopyEndpointStatus(b *testing.B) {
|
2024-05-09 22:56:16 -04:00
|
|
|
ep := &testEndpoint
|
|
|
|
|
status := endpoint.NewStatus(ep.Group, ep.Name)
|
2026-02-09 01:08:59 +01:00
|
|
|
for range storage.DefaultMaximumNumberOfResults {
|
2025-05-17 16:10:28 -04:00
|
|
|
AddResult(status, &testSuccessfulResult, storage.DefaultMaximumNumberOfResults, storage.DefaultMaximumNumberOfEvents)
|
2021-07-14 22:26:51 -04:00
|
|
|
}
|
2026-02-09 01:08:59 +01:00
|
|
|
for b.Loop() {
|
2025-09-17 15:10:08 -04:00
|
|
|
ShallowCopyEndpointStatus(status, paging.NewEndpointStatusParams().WithResults(1, 20))
|
2021-07-14 22:26:51 -04:00
|
|
|
}
|
|
|
|
|
b.ReportAllocs()
|
|
|
|
|
}
|