Replace the CS collector with native WinAPI calls to sysinfoapi

Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
Ben Ridley
2020-12-18 18:02:33 +11:00
committed by Ben Ridley
parent 18495abb69
commit 71054ac429
3 changed files with 155 additions and 28 deletions

23
collector/cs_test.go Normal file
View File

@@ -0,0 +1,23 @@
package collector
import (
"testing"
"github.com/prometheus/client_golang/prometheus"
)
func BenchmarkCsCollect(b *testing.B) {
c, err := NewCSCollector()
if err != nil {
b.Error(err)
}
metrics := make(chan prometheus.Metric)
go func() {
for {
<-metrics
}
}()
for i := 0; i < b.N; i++ {
c.Collect(&ScrapeContext{}, metrics)
}
}