Documentation
¶
Index ¶
- func ProgressBar(percentage float64, baseStyle lipgloss.Style) string
- type LiveStatsFetcher
- func (l LiveStatsFetcher) CpuUsage() (*cpu.TimesStat, error)
- func (l LiveStatsFetcher) HostInfo() (*host.InfoStat, error)
- func (l LiveStatsFetcher) LoadAvg() (*load.AvgStat, error)
- func (l LiveStatsFetcher) MemUsage() (*mem.VirtualMemoryStat, error)
- func (l LiveStatsFetcher) SwapUsage() (*mem.SwapMemoryStat, error)
- type Model
- type ProcessInfo
- type StatsFetcher
- type TickMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LiveStatsFetcher ¶
type LiveStatsFetcher struct{}
LiveStatsFetcher is the production implementation of StatsFetcher that uses gopsutil.
func (LiveStatsFetcher) MemUsage ¶
func (l LiveStatsFetcher) MemUsage() (*mem.VirtualMemoryStat, error)
func (LiveStatsFetcher) SwapUsage ¶
func (l LiveStatsFetcher) SwapUsage() (*mem.SwapMemoryStat, error)
type Model ¶
type Model struct {
HostInfo *host.InfoStat
CpuUsage *cpu.TimesStat
MemUsage *mem.VirtualMemoryStat
SwapUsage *mem.SwapMemoryStat
LoadAvg *load.AvgStat
// contains filtered or unexported fields
}
func (Model) ViewHeader ¶
ViewHeader renders the header section with CPU and Memory usage
func (Model) ViewProcess ¶
type ProcessInfo ¶
type ProcessInfo struct {
PID int32
ParentPID int32
Name string
Username string
CPUPercent float64
MemoryPercent float32
MemoryUsage float64
RunningTime string
}
func GetProcess ¶
func GetProcess() ([]ProcessInfo, error)
type StatsFetcher ¶
type StatsFetcher interface {
HostInfo() (*host.InfoStat, error)
CpuUsage() (*cpu.TimesStat, error)
MemUsage() (*mem.VirtualMemoryStat, error)
SwapUsage() (*mem.SwapMemoryStat, error)
LoadAvg() (*load.AvgStat, error)
}
StatsFetcher defines the interface for fetching system statistics. This allows us to use a real implementation in production and a mock for testing.
Click to show internal directories.
Click to hide internal directories.