2024-11-17 20:51:12 +00:00
|
|
|
//go:build windows
|
|
|
|
|
|
|
|
package perfdata_test
|
2024-09-10 22:34:10 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-11-17 20:51:12 +00:00
|
|
|
v2 "github.com/prometheus-community/windows_exporter/internal/perfdata"
|
2024-09-10 22:34:10 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkTestCollector(b *testing.B) {
|
|
|
|
counters := []string{
|
|
|
|
"% Processor Time",
|
|
|
|
"% Privileged Time",
|
|
|
|
"% User Time",
|
|
|
|
"Creating Process ID",
|
|
|
|
"Elapsed Time",
|
|
|
|
"Handle Count",
|
|
|
|
"ID Process",
|
|
|
|
"IO Data Bytes/sec",
|
|
|
|
"IO Data Operations/sec",
|
|
|
|
"IO Other Bytes/sec",
|
|
|
|
"IO Other Operations/sec",
|
|
|
|
"IO Read Bytes/sec",
|
|
|
|
"IO Read Operations/sec",
|
|
|
|
"IO Write Bytes/sec",
|
|
|
|
"IO Write Operations/sec",
|
|
|
|
"Page Faults/sec",
|
|
|
|
"Page File Bytes Peak",
|
|
|
|
"Page File Bytes",
|
|
|
|
"Pool Nonpaged Bytes",
|
|
|
|
"Pool Paged Bytes",
|
|
|
|
"Priority Base",
|
|
|
|
"Private Bytes",
|
|
|
|
"Thread Count",
|
|
|
|
"Virtual Bytes Peak",
|
|
|
|
"Virtual Bytes",
|
|
|
|
"Working Set - Private",
|
|
|
|
"Working Set Peak",
|
|
|
|
"Working Set",
|
|
|
|
}
|
2024-10-05 19:33:40 +00:00
|
|
|
performanceData, err := v2.NewCollector("Process", []string{"*"}, counters)
|
2024-09-10 22:34:10 +00:00
|
|
|
require.NoError(b, err)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_, _ = performanceData.Collect()
|
|
|
|
}
|
|
|
|
|
|
|
|
performanceData.Close()
|
|
|
|
}
|