app

package
v2.0.0-...-eaa2fab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Copyright (c) 2024-2026 Carsen Klock under MIT License mactop is a simple terminal based Apple Silicon power monitor written in Go Lang! github.com/context-labs/mactop

Copyright (c) 2024-2026 Carsen Klock under MIT License ioreport.go - Go wrappers for IOReport power/thermal metrics

Index

Constants

View Source
const (
	LayoutDefault         = "default"
	LayoutAlternative     = "alternative"
	LayoutAlternativeFull = "alternative_full"
	LayoutVertical        = "vertical"
	LayoutCompact         = "compact"
	LayoutDashboard       = "dashboard"
	LayoutGaugesOnly      = "gauges_only"
)

Variables

View Source
var (
	BracketColor       ui.Color = ui.ColorWhite
	SecondaryTextColor ui.Color = 245
	IsLightMode        bool     = false
)
View Source
var (
	PowerChart, NetworkInfo *w.Paragraph
)

Functions

func GetCPUPercentages

func GetCPUPercentages() ([]float64, error)

func GetProcessTextColor

func GetProcessTextColor(isCurrentUser bool) string

func GetThemeColor

func GetThemeColor(colorName string) ui.Color

func GetThemeColorWithLightMode

func GetThemeColorWithLightMode(colorName string, lightMode bool) ui.Color

func Run

func Run()

func StderrToLogfile

func StderrToLogfile(logfile *os.File)

Types

type AppConfig

type AppConfig struct {
	DefaultLayout string `json:"default_layout"`
	Theme         string `json:"theme"`
}

type CPUCoreWidget

type CPUCoreWidget struct {
	*ui.Block
	// contains filtered or unexported fields
}

func NewCPUCoreWidget

func NewCPUCoreWidget(modelInfo SystemInfo) *CPUCoreWidget

func (*CPUCoreWidget) Draw

func (w *CPUCoreWidget) Draw(buf *ui.Buffer)

func (*CPUCoreWidget) UpdateUsage

func (w *CPUCoreWidget) UpdateUsage(usage []float64)

type CPUMetrics

type CPUMetrics struct {
	EClusterActive, EClusterFreqMHz, PClusterActive, PClusterFreqMHz int
	ECores, PCores                                                   []int
	CoreMetrics                                                      map[string]int
	ANEW, CPUW, GPUW, DRAMW, GPUSRAMW, PackageW, SystemW             float64
	CoreUsages                                                       []float64
	Throttled                                                        bool
	CPUTemp                                                          float64
	GPUTemp                                                          float64
}

func NewCPUMetrics

func NewCPUMetrics() CPUMetrics

type CPUUsage

type CPUUsage struct {
	User   float64
	System float64
	Idle   float64
	Nice   float64
}

func GetCPUUsage

func GetCPUUsage() ([]CPUUsage, error)

type EventThrottler

type EventThrottler struct {
	C chan struct{}
	// contains filtered or unexported fields
}

func NewEventThrottler

func NewEventThrottler(gracePeriod time.Duration) *EventThrottler

func (*EventThrottler) Notify

func (e *EventThrottler) Notify()

type GPUMetrics

type GPUMetrics struct {
	FreqMHz       int
	ActivePercent float64
	Power         float64
	Temp          float32
}

type MemoryMetrics

type MemoryMetrics struct {
	Total     uint64 `json:"total"`
	Used      uint64 `json:"used"`
	Available uint64 `json:"available"`
	SwapTotal uint64 `json:"swap_total"`
	SwapUsed  uint64 `json:"swap_used"`
}

type NetDiskMetrics

type NetDiskMetrics struct {
	OutPacketsPerSec  float64 `json:"out_packets_per_sec"`
	OutBytesPerSec    float64 `json:"out_bytes_per_sec"`
	InPacketsPerSec   float64 `json:"in_packets_per_sec"`
	InBytesPerSec     float64 `json:"in_bytes_per_sec"`
	ReadOpsPerSec     float64 `json:"read_ops_per_sec"`
	WriteOpsPerSec    float64 `json:"write_ops_per_sec"`
	ReadKBytesPerSec  float64 `json:"read_kbytes_per_sec"`
	WriteKBytesPerSec float64 `json:"write_kbytes_per_sec"`
}

type ProcessMetrics

type ProcessMetrics struct {
	PID                                      int
	CPU, LastTime, Memory                    float64
	VSZ, RSS                                 int64
	User, TTY, State, Started, Time, Command string
	LastUpdated                              time.Time
}

type ProcessTimeState

type ProcessTimeState struct {
	Time      uint64 // Total CPU Time (user + system) in nanoseconds
	Timestamp time.Time
}

type SocMetrics

type SocMetrics struct {
	CPUPower     float64 `json:"cpu_power"`
	GPUPower     float64 `json:"gpu_power"`
	ANEPower     float64 `json:"ane_power"`
	DRAMPower    float64 `json:"dram_power"`
	GPUSRAMPower float64 `json:"gpu_sram_power"`
	SystemPower  float64 `json:"system_power"`
	TotalPower   float64 `json:"total_power"`
	GPUFreqMHz   int32   `json:"gpu_freq_mhz"`
	GPUActive    float64 `json:"-"`
	SocTemp      float32 `json:"soc_temp"`
	CPUTemp      float32 `json:"cpu_temp"`
	GPUTemp      float32 `json:"gpu_temp"`
}

type SystemInfo

type SystemInfo struct {
	Name         string `json:"name"`
	CoreCount    int    `json:"core_count"`
	ECoreCount   int    `json:"e_core_count"`
	PCoreCount   int    `json:"p_core_count"`
	GPUCoreCount int    `json:"gpu_core_count"`
}

type VolumeInfo

type VolumeInfo struct {
	Name      string
	Total     float64
	Used      float64
	Available float64
	UsedPct   float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL