mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
container: fix collector (#2057)
This commit is contained in:
@@ -31,7 +31,13 @@ const (
|
||||
)
|
||||
|
||||
func OpenJobObject(name string) (windows.Handle, error) {
|
||||
handle, _, err := procOpenJobObject.Call(JobObjectQuery, 0, uintptr(unsafe.Pointer(&name)))
|
||||
ptr, _ := windows.UTF16PtrFromString(name)
|
||||
handle, _, err := procOpenJobObject.Call(
|
||||
JobObjectQuery,
|
||||
0,
|
||||
uintptr(unsafe.Pointer(ptr)),
|
||||
)
|
||||
|
||||
if handle == 0 {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
|
||||
package kernel32
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
type JobObjectBasicAccountingInformation struct {
|
||||
TotalUserTime uint64
|
||||
@@ -30,22 +34,18 @@ type JobObjectBasicAccountingInformation struct {
|
||||
TotalTerminatedProcesses uint32
|
||||
}
|
||||
|
||||
type IOCounters struct {
|
||||
ReadOperationCount uint64
|
||||
WriteOperationCount uint64
|
||||
OtherOperationCount uint64
|
||||
ReadTransferCount uint64
|
||||
WriteTransferCount uint64
|
||||
OtherTransferCount uint64
|
||||
// JobObjectBasicAndIOAccountingInformation is a structure that contains
|
||||
// both basic accounting information and I/O accounting information
|
||||
// for a job object. It is used with the QueryInformationJobObject function.
|
||||
// The structure is defined in the Windows API documentation.
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_basic_and_io_accounting_information
|
||||
type JobObjectBasicAndIOAccountingInformation struct {
|
||||
BasicInfo JobObjectBasicAccountingInformation
|
||||
IoInfo windows.IO_COUNTERS
|
||||
}
|
||||
|
||||
type JobObjectExtendedLimitInformation struct {
|
||||
BasicInfo JobObjectBasicAccountingInformation
|
||||
IoInfo IOCounters
|
||||
ProcessMemoryLimit uint64
|
||||
JobMemoryLimit uint64
|
||||
PeakProcessMemoryUsed uint64
|
||||
PeakJobMemoryUsed uint64
|
||||
type JobObjectMemoryUsageInformation struct {
|
||||
JobMemory uint64
|
||||
PeakJobMemoryUsed uint64
|
||||
}
|
||||
|
||||
type JobObjectBasicProcessIDList struct {
|
||||
|
||||
Reference in New Issue
Block a user