add inclusive delta test case

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits 2026-01-30 09:23:29 +01:00
parent a0314d5539
commit 4ef8186575
No known key found for this signature in database
GPG Key ID: 47A8F9CE80FD7C7F

View File

@ -80,7 +80,7 @@ func foreachFmtSampleCase(b *testing.B, fn func(b *testing.B, f fmtCase, s sampl
{
// Delta simulates delta type or worst case for cumulatives, where ST
// is changing on every sample.
name: "vt=constant/st=delta",
name: "vt=constant/st=delta-exclusive",
samples: func() (ret []triple) {
t, v := initT, initV
for range nSamples {
@ -91,6 +91,20 @@ func foreachFmtSampleCase(b *testing.B, fn func(b *testing.B, f fmtCase, s sampl
return ret
}(),
},
{
// Delta simulates delta type or worst case for cumulatives, where ST
// is changing on every sample.
name: "vt=constant/st=delta-inclusive",
samples: func() (ret []triple) {
t, v := initT, initV
for range nSamples {
st := t // ST is the same as the previous t.
t += 15000
ret = append(ret, triple{st: st, t: t, v: v})
}
return ret
}(),
},
{
name: "vt=random steps/st=0",
samples: func() (ret []triple) {
@ -198,7 +212,7 @@ func foreachFmtSampleCase(b *testing.B, fn func(b *testing.B, f fmtCase, s sampl
}(),
},
{
name: "vt=random 0-1/st=delta",
name: "vt=random 0-1/st=delta-exclusive",
samples: func() (ret []triple) {
t, v := initT, initV
for range nSamples {
@ -210,6 +224,19 @@ func foreachFmtSampleCase(b *testing.B, fn func(b *testing.B, f fmtCase, s sampl
return ret
}(),
},
{
name: "vt=random 0-1/st=delta-inclusive",
samples: func() (ret []triple) {
t, v := initT, initV
for range nSamples {
st := t // ST is the same as the previous t.
t += int64(r.Intn(100) - 50 + 15000) // 15 seconds +- up to 100ms of jitter.
v += r.Float64() // Random between 0 and 1.0.
ret = append(ret, triple{st: st, t: t, v: v})
}
return ret
}(),
},
}
for _, f := range []fmtCase{