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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
package constants
// Paths and limits
const (
ConfFile = ".loadbarsrc"
CSSHConfFile = "/etc/clusters"
CSSHMaxRecursion = 10
ColorDepth = 32
Interval = 0.14 // CPU sampling interval (seconds)
IntervalNet = 3.0 // Network stats interval
IntervalMem = 1.0 // Memory stats interval
IntervalSDL = 0.14 // Display refresh interval
IntervalSDLWarn = 1.0 // Warn if loop is slower than this
SystemBlueThreshold = 30 // CPU system % for lighter blue
UserOrangeThreshold = 70 // CPU user % for orange
UserYellowThreshold = 50 // CPU user % for dark yellow
)
// CPUMode controls which CPU bars are displayed (cycles with the 1 key).
const (
CPUModeAverage = 0 // Show only the aggregate CPU bar (default)
CPUModeCores = 1 // Show individual core bars plus the aggregate
CPUModeOff = 2 // Hide all CPU bars entirely
CPUModeCount = 3 // Total number of CPU modes for cycling
)
// Exit codes
const (
Success = 0
EUnknown = 1
ENoHost = 2
)
// Copyright string
const Copyright = "2010-2026 (c) Paul Buetow <loadbars@dev.buetow.org>"
// RGB holds R, G, B in 0-255 for SDL.
type RGB struct{ R, G, B uint8 }
// Colors used by the display (matching Perl Constants.pm)
var (
Black = RGB{0x00, 0x00, 0x00}
Blue0 = RGB{0x00, 0x00, 0xff}
LightBlue = RGB{0x00, 0x00, 0xdd}
LightBlue0 = RGB{0x00, 0x00, 0xcc}
Blue = RGB{0x00, 0x00, 0x88}
Green = RGB{0x00, 0x90, 0x00}
LimeGreen = RGB{0x50, 0xc8, 0x00}
LightGreen = RGB{0x00, 0xf0, 0x00}
Orange = RGB{0xff, 0x70, 0x00}
Purple = RGB{0xa0, 0x20, 0xf0}
Pink = RGB{0xff, 0x40, 0xff}
Red = RGB{0xff, 0x00, 0x00}
White = RGB{0xff, 0xff, 0xff}
Grey0 = RGB{0x11, 0x11, 0x11}
Grey = RGB{0xaa, 0xaa, 0xaa}
DarkGrey = RGB{0x15, 0x15, 0x15}
Yellow0 = RGB{0xff, 0xa0, 0x00}
Yellow = RGB{0xff, 0xc0, 0x00}
)
// BytesPerSec for link speed reference (bytes per second at given mbit)
const (
BytesMbit = 125000
Bytes10Mbit = 1250000
Bytes100Mbit = 12500000
BytesGbit = 125000000
Bytes10Gbit = 1250000000
)
|