forked from hyperhq/hyperd
/
sysinfo.go
100 lines (94 loc) · 2.13 KB
/
sysinfo.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package sysinfo
type CpuInfo struct {
Processor uint64
Vender_id string
CpuFamily uint64
Mode uint64
ModeName string
Stepping uint64
MicroCode string
CpuMhz float64
Cache string
PhyId uint64
Siblings uint64
CoreId uint64
CpuCores uint64
Apicid uint64
InitApicid uint64
Fpu bool
FpuException bool
CpuidLevel uint64
Wp bool
Flags string
Bogomips float64
ClFlushSize uint64
CacheAlianment uint64
AddressSizes string
PowerManagement string
}
type MemInfo struct {
MemTotal uint64
MemFree uint64
MemAvailable uint64
Buffers uint64
Cached uint64
SwapCached uint64
Active uint64
Inactive uint64
AnonActive uint64
AnonInactive uint64
FileActive uint64
FileInactive uint64
Unevictable uint64
Mlocked uint64
SwapTotal uint64
SwapFree uint64
Dirty uint64
Writeback uint64
AnonPages uint64
Mapped uint64
Shmem uint64
Slab uint64
SReclaimable uint64
SUnreclaim uint64
KernelStack uint64
PageTables uint64
NFS_Unstable uint64
Bounce uint64
WritebackTmp uint64
CommitLimit uint64
Committed_AS uint64
VmallocTotal uint64
VmallocUsed uint64
VmallocChunk uint64
HardwareCorrupted uint64
AnonHugePages uint64
HugePages_Total uint64
HugePages_Free uint64
HugePages_Rsvd uint64
HugePages_Surp uint64
Hugepagesize uint64
DirectMap4k uint64
DirectMap2M uint64
DirectMap1G uint64
}
type OSInfo struct {
Name string
Version string
Id string
IdLike string
PrettyName string
VersionId string
HomeURL string
SupportURL string
BugURL string
}
func GetCpuInfo() (*CpuInfo, error) {
return getCpuInfo()
}
func GetMemInfo() (*MemInfo, error) {
return getMemInfo()
}
func GetOSInfo() (*OSInfo, error) {
return getOSInfo()
}