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
|
### Properties
|
||||||
|
|
||||||
- `.PhysicalTotalMemory`: `int` - is the total of used physical memory
|
- `.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
|
- `.PhysicalPercentUsed`: `float64` - is the percentage of physical memory in usage
|
||||||
- `.SwapTotalMemory`: `int` - is the total of used swap memory
|
- `.SwapTotalMemory`: `int` - is the total of used swap memory
|
||||||
- `.SwapFreeMemory`: `int` - is the total of free swap memory
|
- `.SwapFreeMemory`: `int` - is the total of free swap memory
|
||||||
|
|
|
@ -17,6 +17,7 @@ type SystemInfo struct {
|
||||||
Precision int
|
Precision int
|
||||||
// mem
|
// mem
|
||||||
PhysicalTotalMemory uint64
|
PhysicalTotalMemory uint64
|
||||||
|
PhysicalAvailableMemory uint64
|
||||||
PhysicalFreeMemory uint64
|
PhysicalFreeMemory uint64
|
||||||
PhysicalPercentUsed float64
|
PhysicalPercentUsed float64
|
||||||
SwapTotalMemory uint64
|
SwapTotalMemory uint64
|
||||||
|
@ -57,6 +58,7 @@ func (s *SystemInfo) Init(props properties.Properties, env environment.Environme
|
||||||
memStat, err := mem.VirtualMemory()
|
memStat, err := mem.VirtualMemory()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.PhysicalTotalMemory = memStat.Total
|
s.PhysicalTotalMemory = memStat.Total
|
||||||
|
s.PhysicalAvailableMemory = memStat.Available
|
||||||
s.PhysicalFreeMemory = memStat.Free
|
s.PhysicalFreeMemory = memStat.Free
|
||||||
s.PhysicalPercentUsed = memStat.UsedPercent
|
s.PhysicalPercentUsed = memStat.UsedPercent
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue