Stream forever with eviction-based per-stream loss detection
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -56,6 +57,11 @@ func pad(s string, w int, right bool) string {
|
||||
return s + strings.Repeat(" ", gap)
|
||||
}
|
||||
|
||||
func uptime(d time.Duration) string {
|
||||
total := int(d.Seconds())
|
||||
return fmt.Sprintf("%d:%02d:%02d", total/3600, (total/60)%60, total%60)
|
||||
}
|
||||
|
||||
func commas(v uint64) string {
|
||||
s := fmt.Sprintf("%d", v)
|
||||
if len(s) <= 3 {
|
||||
@@ -182,20 +188,6 @@ func statusCell(v uint64) string {
|
||||
return paint(s, cRed)
|
||||
}
|
||||
|
||||
func gapCell(v int64) string {
|
||||
if v <= 0 {
|
||||
return paint("0", cGreen)
|
||||
}
|
||||
return paint(commas(uint64(v)), cYellow)
|
||||
}
|
||||
|
||||
func lostCell(v int64) string {
|
||||
if v <= 0 {
|
||||
return paint("0", cGreen)
|
||||
}
|
||||
return paint(commas(uint64(v)), cRed)
|
||||
}
|
||||
|
||||
func rateCell(gb float64, target float64) string {
|
||||
s := fmt.Sprintf("%.2f", gb)
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user