mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-06 18:46:36 +00:00
Implement Lazy Loading of NameTable
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
committed by
Jan-Otto Kröpke
parent
9b5bc37a42
commit
11218a95d0
@@ -175,9 +175,6 @@ type PerfCounter struct {
|
||||
SecondValue int64
|
||||
}
|
||||
|
||||
// Error value returned by RegQueryValueEx if the buffer isn't sufficiently large
|
||||
const errorMoreData = syscall.Errno(syscall.ERROR_MORE_DATA)
|
||||
|
||||
var (
|
||||
bufLenGlobal = uint32(400000)
|
||||
bufLenCostly = uint32(2000000)
|
||||
@@ -223,7 +220,7 @@ func queryRawData(query string) ([]byte, error) {
|
||||
(*byte)(unsafe.Pointer(&buffer[0])),
|
||||
&bufLen)
|
||||
|
||||
if err == errorMoreData {
|
||||
if err == error(syscall.ERROR_MORE_DATA) {
|
||||
newBuffer := make([]byte, len(buffer)+16384)
|
||||
copy(newBuffer, buffer)
|
||||
buffer = newBuffer
|
||||
|
||||
Reference in New Issue
Block a user