Documentation
¶
Index ¶
- Variables
- func CPUPct(prevActive, currActive, prevTotal, currTotal uint64) float64
- func Delta(prev, curr uint64) uint64
- func FieldsAt(line string, idx int) string
- func FmtBytes(b uint64) string
- func IsBenignDropReason(reason string) bool
- func ParseFloat64(s string) float64
- func ParseInt(s string) int
- func ParseKeyValueFile(path string) (map[string]string, error)
- func ParseKeyValueLines(lines []string) map[string]string
- func ParseUint64(s string) uint64
- func Rate(prev, curr uint64, dt time.Duration) float64
- func RatePct(prev, curr uint64, dt time.Duration, capacity float64) float64
- func ReadFileLines(path string) ([]string, error)
- func ReadFileString(path string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var BenignDropReasons = map[string]bool{ "NOT_SPECIFIED": true, "NO_SOCKET": true, "SOCKET_FILTER": true, "OTHERHOST": true, "TCP_FLAGS": true, "TCP_ZEROWINDOW": true, "TCP_OLD_DATA": true, "TCP_OLD_SEQUENCE": true, "TCP_OVERWINDOW": true, "TCP_OFOMERGE": true, "SKB_CONSUMED": true, "TCP_OFO_QUEUE_PRUNE": true, }
BenignDropReasons is the canonical set of kernel SKB_DROP_REASON strings that represent normal TCP/IP lifecycle events, not actual packet loss. Maintained in one place to prevent divergence across packages.
Functions ¶
func FieldsAt ¶
FieldsAt returns the field at the given index from a whitespace-split line. Returns empty string if index is out of bounds.
func IsBenignDropReason ¶
IsBenignDropReason returns true if the drop reason string is benign.
func ParseFloat64 ¶
ParseFloat64 parses a string to float64, returning 0 on error. NaN and Inf inputs are also treated as 0 to prevent downstream poisoning.
func ParseKeyValueFile ¶
ParseKeyValueFile parses a file with "key value" or "key: value" lines.
func ParseKeyValueLines ¶
ParseKeyValueLines parses lines with "key value" or "key: value" format.
func ParseUint64 ¶
ParseUint64 parses a string to uint64, returning 0 on error.
func RatePct ¶
RatePct computes the percentage utilization between two counter values given a time delta and a total capacity in the same unit.
func ReadFileLines ¶
ReadFileLines reads a file and returns its lines.
func ReadFileString ¶
ReadFileString reads a file and returns its contents as a string.
Types ¶
This section is empty.