Documentation ¶
Overview ¶
gopsutil is a port of psutil(http://pythonhosted.org/psutil/). This covers these architectures.
- linux (amd64, arm)
- freebsd (amd64)
- windows (amd64)
Index ¶
- Constants
- Variables
- func BytePtrToString(p *uint8) string
- func ByteToString(orig []byte) string
- func CreateQuery() (syscall.Handle, error)
- func GetWmic(target string, query ...string) ([][]string, error)
- func IntToString(orig []int8) string
- func PathExists(filename string) bool
- func ReadLines(filename string) ([]string, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)
- func StringContains(target []string, src string) bool
- type CounterInfo
- type FILETIME
- type PDH_FMT_COUNTERVALUE_DOUBLE
- type PDH_FMT_COUNTERVALUE_LARGE
- type PDH_FMT_COUNTERVALUE_LONG
Constants ¶
const ( ERROR_SUCCESS = 0 ERROR_FILE_NOT_FOUND = 2 DRIVE_REMOVABLE = 2 DRIVE_FIXED = 3 HKEY_LOCAL_MACHINE = 0x80000002 RRF_RT_REG_SZ = 0x00000002 RRF_RT_REG_DWORD = 0x00000010 PDH_FMT_LONG = 0x00000100 PDH_FMT_DOUBLE = 0x00000200 PDH_FMT_LARGE = 0x00000400 PDH_INVALID_DATA = 0xc0000bc6 PDH_INVALID_HANDLE = 0xC0000bbc PDH_NO_DATA = 0x800007d5 )
windows system const
Variables ¶
var ( Modkernel32 = syscall.NewLazyDLL("kernel32.dll") ModNt = syscall.NewLazyDLL("ntdll.dll") ModPdh = syscall.NewLazyDLL("pdh.dll") ProcGetSystemTimes = Modkernel32.NewProc("GetSystemTimes") ProcNtQuerySystemInformation = ModNt.NewProc("NtQuerySystemInformation") PdhOpenQuery = ModPdh.NewProc("PdhOpenQuery") PdhAddCounter = ModPdh.NewProc("PdhAddCounterW") PdhCollectQueryData = ModPdh.NewProc("PdhCollectQueryData") PdhGetFormattedCounterValue = ModPdh.NewProc("PdhGetFormattedCounterValue") PdhCloseQuery = ModPdh.NewProc("PdhCloseQuery") )
var NotImplementedError = errors.New("not implemented yet")
Functions ¶
func ByteToString ¶
func CreateQuery ¶
CreateQuery XXX copied from https://github.com/mackerelio/mackerel-agent/
func IntToString ¶
func PathExists ¶
func ReadLines ¶
ReadLines reads contents from file and splits them by new line. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).
func ReadLinesOffsetN ¶
ReadLines reads contents from file and splits them by new line. The offset tells at which line number to start. The count determines the number of lines to read (starting from offset):
n >= 0: at most n lines n < 0: whole file
func StringContains ¶
Check the target string slice containes src or not
Types ¶
type CounterInfo ¶
CounterInfo copied from https://github.com/mackerelio/mackerel-agent/
func CreateCounter ¶
func CreateCounter(query syscall.Handle, pname, cname string) (*CounterInfo, error)
CreateCounter XXX
type PDH_FMT_COUNTERVALUE_DOUBLE ¶
for double values
type PDH_FMT_COUNTERVALUE_LARGE ¶
for 64 bit integer values
type PDH_FMT_COUNTERVALUE_LONG ¶
type PDH_FMT_COUNTERVALUE_LONG struct { CStatus uint32 LongValue int32 // contains filtered or unexported fields }
for long values