chore: enable more linter (#1557)

This commit is contained in:
Jan-Otto Kröpke
2024-08-10 22:05:33 +02:00
committed by GitHub
parent 27a3553dac
commit 9b02e4a0ea
87 changed files with 337 additions and 494 deletions

View File

@@ -1,39 +1,9 @@
package perflib
import (
"fmt"
"testing"
)
func ExampleQueryPerformanceData() {
objects, err := QueryPerformanceData("2")
if err != nil {
panic(err)
}
for _, object := range objects {
fmt.Printf("%d %s [%d counters, %d instances]\n",
object.NameIndex, object.Name, len(object.CounterDefs), len(object.Instances))
for _, instance := range object.Instances {
if !((instance.Name == "_Total") || (instance.Name == "")) {
continue
}
if instance.Name == "" {
fmt.Println("No instance.", instance.Name)
} else {
fmt.Println("Instance:", instance.Name)
}
for _, counter := range instance.Counters {
fmt.Printf(" -> %s %d\n", counter.Def.Name, counter.Def.NameIndex)
}
}
}
}
func BenchmarkQueryPerformanceData(b *testing.B) {
for n := 0; n < b.N; n++ {
_, _ = QueryPerformanceData("Global")