Skip to content

Commit

Permalink
win fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zak-pawel committed Sep 14, 2024
1 parent cc5993d commit be75036
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 80 deletions.
32 changes: 9 additions & 23 deletions plugins/inputs/win_perf_counters/pdh_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,34 @@
package win_perf_counters

// pdhFmtCountervalueDouble is a union specialization for double values
type PdhFmtCountervalueDouble struct {
type pdhFmtCountervalueDouble struct {
CStatus uint32
padding [4]byte
DoubleValue float64
}

// pdhFmtCountervalueLarge is a union specialization for 64-bit integer values
type PdhFmtCountervalueLarge struct {
CStatus uint32
padding [4]byte //nolint:unused // Memory reservation
LargeValue int64
}

// pdhFmtCountervalueLong is a union specialization for long values
type PdhFmtCountervalueLong struct {
type pdhFmtCountervalueLong struct {
CStatus uint32
LongValue int32
padding [4]byte //nolint:unused // Memory reservation
}

type PdhFmtCountervalueItemDouble struct {
type pdhFmtCountervalueItemDouble struct {
SzName *uint16
padding [4]byte //nolint:unused // Memory reservation
FmtValue PdhFmtCountervalueDouble
}

// pdhFmtCountervalueItemLarge is a union specialization for 'large' values, used by PdhGetFormattedCounterArrayLarge()
type PdhFmtCountervalueItemLarge struct {
SzName *uint16 // pointer to a string
padding [4]byte //nolint:unused // Memory reservation
FmtValue PdhFmtCountervalueLarge
FmtValue pdhFmtCountervalueDouble
}

// pdhFmtCountervalueItemLong is a union specialization for long values, used by PdhGetFormattedCounterArrayLong()
type PdhFmtCountervalueItemLong struct {
SzName *uint16 // pointer to a string
padding [4]byte //nolint:unused // Memory reservation
FmtValue PdhFmtCountervalueLong
FmtValue pdhFmtCountervalueLong
}

// pdhCounterInfo structure contains information describing the properties of a counter. This information also includes the counter path.
type PdhCounterInfo struct {
type pdhCounterInfo struct {
//Size of the structure, including the appended strings, in bytes.
DwLength uint32
//Counter type. For a list of counter types, see the Counter Types section of the
Expand Down Expand Up @@ -124,7 +110,7 @@ type PdhCounterInfo struct {

// The pdhRawCounter structure returns the data as it was collected from the counter provider. No translation, formatting,
// or other interpretation is performed on the data
type PdhRawCounter struct {
type pdhRawCounter struct {
// Counter status that indicates if the counter value is valid. Check this member before using the data in a calculation or displaying its value.
// For a list of possible values, see https://docs.microsoft.com/windows/desktop/PerfCtrs/checking-pdh-interface-return-values
CStatus uint32
Expand All @@ -139,9 +125,9 @@ type PdhRawCounter struct {
MultiCount uint32
}

type PdhRawCounterItem struct {
type pdhRawCounterItem struct {
// Pointer to a null-terminated string that specifies the instance name of the counter. The string is appended to the end of this structure.
SzName *uint16
//A pdhRawCounter structure that contains the raw counter value of the instance
RawValue PdhRawCounter
RawValue pdhRawCounter
}
25 changes: 0 additions & 25 deletions plugins/inputs/win_perf_counters/pdh_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,12 @@ type pdhFmtCountervalueDouble struct {
DoubleValue float64
}

// pdhFmtCountervalueLarge is a union specialization for 64-bit integer values
type pdhFmtCountervalueLarge struct {
CStatus uint32
LargeValue int64
}

// pdhFmtCountervalueLong is a union specialization for long values
type pdhFmtCountervalueLong struct {
CStatus uint32
LongValue int32
padding [4]byte //nolint:unused // Memory reservation
}

// pdhFmtCountervalueItemDouble is a union specialization for double values, used by PdhGetFormattedCounterArrayDouble
type pdhFmtCountervalueItemDouble struct {
SzName *uint16
FmtValue pdhFmtCountervalueDouble
}

// pdhFmtCountervalueItemLarge is a union specialization for 'large' values, used by PdhGetFormattedCounterArrayLarge()
type pdhFmtCountervalueItemLarge struct {
SzName *uint16 // pointer to a string
FmtValue pdhFmtCountervalueLarge
}

// pdhFmtCountervalueItemLong is a union specialization for long values, used by PdhGetFormattedCounterArrayLong()
type pdhFmtCountervalueItemLong struct {
SzName *uint16 // pointer to a string
FmtValue pdhFmtCountervalueLong
}

// pdhCounterInfo structure contains information describing the properties of a counter. This information also includes the counter path.
type pdhCounterInfo struct {
//Size of the structure, including the appended strings, in bytes.
Expand Down
39 changes: 7 additions & 32 deletions plugins/inputs/win_perf_counters/pdh_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,18 @@
package win_perf_counters

// pdhFmtCountervalueDouble is a union specialization for double values
type PdhFmtCountervalueDouble struct {
type pdhFmtCountervalueDouble struct {
CStatus uint32
DoubleValue float64
}

// pdhFmtCountervalueLarge is a union specialization for 64-bit integer values
type PdhFmtCountervalueLarge struct {
CStatus uint32
LargeValue int64
}

// pdhFmtCountervalueLong is a union specialization for long values
type PdhFmtCountervalueLong struct {
CStatus uint32
LongValue int32
padding [4]byte //nolint:unused // Memory reservation
}

type PdhFmtCountervalueItemDouble struct {
type pdhFmtCountervalueItemDouble struct {
SzName *uint16
FmtValue PdhFmtCountervalueDouble
}

// pdhFmtCountervalueItemLarge is a union specialization for 'large' values, used by PdhGetFormattedCounterArrayLarge()
type PdhFmtCountervalueItemLarge struct {
SzName *uint16 // pointer to a string
FmtValue PdhFmtCountervalueLarge
}

// pdhFmtCountervalueItemLong is a union specialization for long values, used by PdhGetFormattedCounterArrayLong()
type PdhFmtCountervalueItemLong struct {
SzName *uint16 // pointer to a string
FmtValue PdhFmtCountervalueLong
FmtValue pdhFmtCountervalueDouble
}

// pdhCounterInfo structure contains information describing the properties of a counter. This information also includes the counter path.
type PdhCounterInfo struct {
type pdhCounterInfo struct {
//Size of the structure, including the appended strings, in bytes.
DwLength uint32
//Counter type. For a list of counter types, see the Counter Types section
Expand Down Expand Up @@ -117,7 +92,7 @@ type PdhCounterInfo struct {

// The pdhRawCounter structure returns the data as it was collected from the counter provider.
// No translation, formatting, or other interpretation is performed on the data.
type PdhRawCounter struct {
type pdhRawCounter struct {
// Counter status that indicates if the counter value is valid. Check this member before using the data in a calculation or displaying its value.
// For a list of possible values, see https://docs.microsoft.com/windows/desktop/PerfCtrs/checking-pdh-interface-return-values
CStatus uint32
Expand All @@ -132,9 +107,9 @@ type PdhRawCounter struct {
MultiCount uint32
}

type PdhRawCounterItem struct {
type pdhRawCounterItem struct {
// Pointer to a null-terminated string that specifies the instance name of the counter. The string is appended to the end of this structure.
SzName *uint16
//A pdhRawCounter structure that contains the raw counter value of the instance
RawValue PdhRawCounter
RawValue pdhRawCounter
}

0 comments on commit be75036

Please sign in to comment.