|
|
@ -11,14 +11,14 @@ import (
|
|
|
|
// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
|
|
|
|
// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
|
|
|
|
// https://learn.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-performance_information
|
|
|
|
// https://learn.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-performance_information
|
|
|
|
type ExVirtualMemory struct {
|
|
|
|
type ExVirtualMemory struct {
|
|
|
|
CommitLimit uint64 `json:"commitLimit"`
|
|
|
|
CommitLimit uint64 `json:"commitLimit"`
|
|
|
|
CommitTotal uint64 `json:"commitTotal"`
|
|
|
|
CommitTotal uint64 `json:"commitTotal"`
|
|
|
|
VirtualTotal uint64 `json:"virtualTotal"`
|
|
|
|
VirtualTotal uint64 `json:"virtualTotal"`
|
|
|
|
VirtualAvail uint64 `json:"virtualAvail"`
|
|
|
|
VirtualAvail uint64 `json:"virtualAvail"`
|
|
|
|
PhysTotal uint64 `json:"physTotal"`
|
|
|
|
PhysTotal uint64 `json:"physTotal"`
|
|
|
|
PhysAvail uint64 `json:"physAvail"`
|
|
|
|
PhysAvail uint64 `json:"physAvail"`
|
|
|
|
SwapTotal uint64 `json:"swapTotal"`
|
|
|
|
PageFileTotal uint64 `json:"pageFileTotal"`
|
|
|
|
SwapAvail uint64 `json:"swapAvail"`
|
|
|
|
PageFileAvail uint64 `json:"pageFileAvail"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type ExWindows struct{}
|
|
|
|
type ExWindows struct{}
|
|
|
@ -48,14 +48,14 @@ func (e *ExWindows) VirtualMemory() (*ExVirtualMemory, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ret := &ExVirtualMemory{
|
|
|
|
ret := &ExVirtualMemory{
|
|
|
|
CommitLimit: perfInfo.commitLimit * perfInfo.pageSize,
|
|
|
|
CommitLimit: perfInfo.commitLimit * perfInfo.pageSize,
|
|
|
|
CommitTotal: perfInfo.commitTotal * perfInfo.pageSize,
|
|
|
|
CommitTotal: perfInfo.commitTotal * perfInfo.pageSize,
|
|
|
|
VirtualTotal: memInfo.ullTotalVirtual,
|
|
|
|
VirtualTotal: memInfo.ullTotalVirtual,
|
|
|
|
VirtualAvail: memInfo.ullAvailVirtual,
|
|
|
|
VirtualAvail: memInfo.ullAvailVirtual,
|
|
|
|
PhysTotal: memInfo.ullTotalPhys,
|
|
|
|
PhysTotal: memInfo.ullTotalPhys,
|
|
|
|
PhysAvail: memInfo.ullAvailPhys,
|
|
|
|
PhysAvail: memInfo.ullAvailPhys,
|
|
|
|
SwapTotal: memInfo.ullTotalPageFile,
|
|
|
|
PageFileTotal: memInfo.ullTotalPageFile,
|
|
|
|
SwapAvail: memInfo.ullAvailPageFile,
|
|
|
|
PageFileAvail: memInfo.ullAvailPageFile,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ret, nil
|
|
|
|
return ret, nil
|
|
|
|