forked from dmacvicar/libvirt-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodeinfo.go
50 lines (39 loc) · 860 Bytes
/
nodeinfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package libvirt
/*
#cgo LDFLAGS: -lvirt
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
#include <stdlib.h>
*/
import "C"
import (
"unsafe"
)
type VirNodeInfo struct {
ptr C.virNodeInfo
}
func (ni *VirNodeInfo) GetModel() string {
model := C.GoString((*C.char)(unsafe.Pointer(&ni.ptr.model)))
return model
}
func (ni *VirNodeInfo) GetMemoryKB() uint64 {
return uint64(ni.ptr.memory)
}
func (ni *VirNodeInfo) GetCPUs() uint32 {
return uint32(ni.ptr.cpus)
}
func (ni *VirNodeInfo) GetMhz() uint32 {
return uint32(ni.ptr.mhz)
}
func (ni *VirNodeInfo) GetNodes() uint32 {
return uint32(ni.ptr.nodes)
}
func (ni *VirNodeInfo) GetSockets() uint32 {
return uint32(ni.ptr.sockets)
}
func (ni *VirNodeInfo) GetCores() uint32 {
return uint32(ni.ptr.cores)
}
func (ni *VirNodeInfo) GetThreads() uint32 {
return uint32(ni.ptr.threads)
}