FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
containerlab/virt/memory.go at main · mgorripa/containerlab · GitHub
mgorripa
/
containerlab
Public
forked from
srl-labs/containerlab
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
containerlab
/
virt
/
memory.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (25 loc) · 571 Bytes
Breadcrumbs
containerlab
/
virt
/
memory.go
Copy path
File metadata and controls
29 lines (25 loc) · 571 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
virt
import
(
"github.com/charmbracelet/log"
"github.com/mackerelio/go-osstat/memory"
)
type
MemoryType
int
const
(
MemoryTypeTotal
MemoryType
=
iota
MemoryTypeAvailable
)
// GetSysMemory reports on total installed or available memory (in bytes).
func
GetSysMemory
(
mt
MemoryType
)
uint64
{
memoryResult
,
err
:=
memory
.
Get
()
if
err
!=
nil
{
log
.
Errorf
(
"unable to determine available memory: %v"
,
err
)
return
0
}
switch
mt
{
case
MemoryTypeAvailable
:
return
memoryResult
.
Available
case
MemoryTypeTotal
:
return
memoryResult
.
Total
}
return
0
}
Back
|
FazBrowse Home
|
New Git URL