...
1 package mem
2
3 import (
4 "encoding/json"
5
6 "github.com/shirou/gopsutil/internal/common"
7 )
8
9 var invoke common.Invoker = common.Invoke{}
10
11
12
13
14
15 type VirtualMemoryStat struct {
16
17 Total uint64 `json:"total"`
18
19
20
21
22 Available uint64 `json:"available"`
23
24
25
26
27 Used uint64 `json:"used"`
28
29
30
31
32 UsedPercent float64 `json:"usedPercent"`
33
34
35
36
37 Free uint64 `json:"free"`
38
39
40
41 Active uint64 `json:"active"`
42 Inactive uint64 `json:"inactive"`
43 Wired uint64 `json:"wired"`
44
45
46
47 Laundry uint64 `json:"laundry"`
48
49
50
51
52
53 Buffers uint64 `json:"buffers"`
54 Cached uint64 `json:"cached"`
55 Writeback uint64 `json:"writeback"`
56 Dirty uint64 `json:"dirty"`
57 WritebackTmp uint64 `json:"writebacktmp"`
58 Shared uint64 `json:"shared"`
59 Slab uint64 `json:"slab"`
60 SReclaimable uint64 `json:"sreclaimable"`
61 SUnreclaim uint64 `json:"sunreclaim"`
62 PageTables uint64 `json:"pagetables"`
63 SwapCached uint64 `json:"swapcached"`
64 CommitLimit uint64 `json:"commitlimit"`
65 CommittedAS uint64 `json:"committedas"`
66 HighTotal uint64 `json:"hightotal"`
67 HighFree uint64 `json:"highfree"`
68 LowTotal uint64 `json:"lowtotal"`
69 LowFree uint64 `json:"lowfree"`
70 SwapTotal uint64 `json:"swaptotal"`
71 SwapFree uint64 `json:"swapfree"`
72 Mapped uint64 `json:"mapped"`
73 VMallocTotal uint64 `json:"vmalloctotal"`
74 VMallocUsed uint64 `json:"vmallocused"`
75 VMallocChunk uint64 `json:"vmallocchunk"`
76 HugePagesTotal uint64 `json:"hugepagestotal"`
77 HugePagesFree uint64 `json:"hugepagesfree"`
78 HugePageSize uint64 `json:"hugepagesize"`
79 }
80
81 type SwapMemoryStat struct {
82 Total uint64 `json:"total"`
83 Used uint64 `json:"used"`
84 Free uint64 `json:"free"`
85 UsedPercent float64 `json:"usedPercent"`
86 Sin uint64 `json:"sin"`
87 Sout uint64 `json:"sout"`
88 PgIn uint64 `json:"pgin"`
89 PgOut uint64 `json:"pgout"`
90 PgFault uint64 `json:"pgfault"`
91
92
93
94 PgMajFault uint64 `json:"pgmajfault"`
95 }
96
97 func (m VirtualMemoryStat) String() string {
98 s, _ := json.Marshal(m)
99 return string(s)
100 }
101
102 func (m SwapMemoryStat) String() string {
103 s, _ := json.Marshal(m)
104 return string(s)
105 }
106
107 type SwapDevice struct {
108 Name string `json:"name"`
109 UsedBytes uint64 `json:"usedBytes"`
110 FreeBytes uint64 `json:"freeBytes"`
111 }
112
113 func (m SwapDevice) String() string {
114 s, _ := json.Marshal(m)
115 return string(s)
116 }
117
View as plain text