mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
feat: add property for available memory
This commit is contained in:
parent
3fc13f7893
commit
1cd02cb77f
|
@ -41,7 +41,9 @@ Display SysInfo.
|
|||
### Properties
|
||||
|
||||
- `.PhysicalTotalMemory`: `int` - is the total of used physical memory
|
||||
- `.PhysicalFreeMemory`: `int` - is the total of free physical memory
|
||||
- `.PhysicalAvailableMemory`: `int` - is the total available physical memory (i.e. the amount immediately available to processes)
|
||||
- `.PhysicalFreeMemory`: `int` - is the total of free physical memory (i.e. considers memory used by the system for any reason
|
||||
[e.g. caching] as occupied)
|
||||
- `.PhysicalPercentUsed`: `float64` - is the percentage of physical memory in usage
|
||||
- `.SwapTotalMemory`: `int` - is the total of used swap memory
|
||||
- `.SwapFreeMemory`: `int` - is the total of free swap memory
|
||||
|
|
|
@ -16,12 +16,13 @@ type SystemInfo struct {
|
|||
|
||||
Precision int
|
||||
// mem
|
||||
PhysicalTotalMemory uint64
|
||||
PhysicalFreeMemory uint64
|
||||
PhysicalPercentUsed float64
|
||||
SwapTotalMemory uint64
|
||||
SwapFreeMemory uint64
|
||||
SwapPercentUsed float64
|
||||
PhysicalTotalMemory uint64
|
||||
PhysicalAvailableMemory uint64
|
||||
PhysicalFreeMemory uint64
|
||||
PhysicalPercentUsed float64
|
||||
SwapTotalMemory uint64
|
||||
SwapFreeMemory uint64
|
||||
SwapPercentUsed float64
|
||||
// cpu
|
||||
Times float64
|
||||
CPU []cpu.InfoStat
|
||||
|
@ -57,6 +58,7 @@ func (s *SystemInfo) Init(props properties.Properties, env environment.Environme
|
|||
memStat, err := mem.VirtualMemory()
|
||||
if err == nil {
|
||||
s.PhysicalTotalMemory = memStat.Total
|
||||
s.PhysicalAvailableMemory = memStat.Available
|
||||
s.PhysicalFreeMemory = memStat.Free
|
||||
s.PhysicalPercentUsed = memStat.UsedPercent
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue