metrics: fix issues reported by staticcheck (#20365)
This commit is contained in:
committed by
Felix Lange
parent
dd21f079e8
commit
58f2ce8671
@ -22,27 +22,27 @@ func TestRuntimeMemStats(t *testing.T) {
|
||||
zero := runtimeMetrics.MemStats.PauseNs.Count() // Get a "zero" since GC may have run before these tests.
|
||||
runtime.GC()
|
||||
CaptureRuntimeMemStatsOnce(r)
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); 1 != count-zero {
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); count-zero != 1 {
|
||||
t.Fatal(count - zero)
|
||||
}
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
CaptureRuntimeMemStatsOnce(r)
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); 3 != count-zero {
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); count-zero != 3 {
|
||||
t.Fatal(count - zero)
|
||||
}
|
||||
for i := 0; i < 256; i++ {
|
||||
runtime.GC()
|
||||
}
|
||||
CaptureRuntimeMemStatsOnce(r)
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); 259 != count-zero {
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); count-zero != 259 {
|
||||
t.Fatal(count - zero)
|
||||
}
|
||||
for i := 0; i < 257; i++ {
|
||||
runtime.GC()
|
||||
}
|
||||
CaptureRuntimeMemStatsOnce(r)
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); 515 != count-zero { // We lost one because there were too many GCs between captures.
|
||||
if count := runtimeMetrics.MemStats.PauseNs.Count(); count-zero != 515 { // We lost one because there were too many GCs between captures.
|
||||
t.Fatal(count - zero)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user