Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Remove the reg key close on hdata performance #42

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tools/dumps
*.exe
_*.go
*~
vendor/
3 changes: 0 additions & 3 deletions perflib/perflib.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ func queryRawData(query string) ([]byte, error) {
return nil, fmt.Errorf("failed to encode query string: %v", err)
}

defer syscall.RegCloseKey(syscall.HKEY_PERFORMANCE_DATA)

for {
bufLen := uint32(len(buffer))

Expand All @@ -237,7 +235,6 @@ func queryRawData(query string) ([]byte, error) {
newBuffer := make([]byte, len(buffer)+16384)
copy(newBuffer, buffer)
buffer = newBuffer
syscall.RegCloseKey(syscall.HKEY_PERFORMANCE_DATA)
continue
} else if err != nil {
if errno, ok := err.(syscall.Errno); ok {
Expand Down