Example #1
0
// FormatRate format value to string, or nothing if 0.
//
func FormatRate(size uint64) string {
	if size > 0 {
		return bytesize.ByteSize(size).String()
	}
	return ""
}
Example #2
0
// Label display callback. One line for each device. Format="eth0: ↓ 42 / ↑ 128".
//
func formatLabel(dev string, in, out uint64) string {
	return fmt.Sprintf("%s: %s %s / %s %s", dev, "↓", bytesize.ByteSize(in), "↑", bytesize.ByteSize(out))
}
Example #3
0
// Label display callback. One line for each device. Format="eth0: r 42 / w 128".
//
func formatLabel(dev string, in, out uint64) string {
	return fmt.Sprintf("%s: %s %s / %s %s", dev, "r", bytesize.ByteSize(in*BlockSize), "w", bytesize.ByteSize(out*BlockSize))
}