mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 17:33:19 +01:00
6ed93d4b82
* Add clarifications in comments * #191: Rename Service to Endpoint
27 lines
638 B
Go
27 lines
638 B
Go
package memory
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/TwiN/gatus/v3/core"
|
|
)
|
|
|
|
func BenchmarkProcessUptimeAfterResult(b *testing.B) {
|
|
uptime := core.NewUptime()
|
|
now := time.Now()
|
|
now = time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())
|
|
// Start 12000 days ago
|
|
timestamp := now.Add(-12000 * 24 * time.Hour)
|
|
for n := 0; n < b.N; n++ {
|
|
processUptimeAfterResult(uptime, &core.Result{
|
|
Duration: 18 * time.Millisecond,
|
|
Success: n%15 == 0,
|
|
Timestamp: timestamp,
|
|
})
|
|
// Simulate an endpoint with an interval of 3 minutes
|
|
timestamp = timestamp.Add(3 * time.Minute)
|
|
}
|
|
b.ReportAllocs()
|
|
}
|