move directory

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2023-07-10 02:17:24 +02:00
parent 9e368d49e7
commit 976e055252
8 changed files with 3 additions and 4 deletions

41
perflib/perflib_test.go Normal file
View File

@@ -0,0 +1,41 @@
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")
}
}