Documentation
¶
Overview ¶
Package statsprint 提供与 iperf3 UDP 周期表相近的终端定宽输出。
Index ¶
- Constants
- func FormatJitter(ms float64, ok bool) string
- func FormatLostTotal(lost, total int64) string
- func FormatUDPRow(r UDPRow) string
- func MeanInterArrivalJitterMs(arrivalNs []int64, expectedSpacingNs int64) (ms float64, ok bool)
- func WriteUDPRow(w io.Writer, r UDPRow) error
- func WriteUDPTableHeader(w io.Writer) error
- type UDPRow
Constants ¶
View Source
const ( RoleDirWidth = 12 TimeWidth = 12 TransferWidth = 13 BitrateWidth = 17 JitterWidth = 12 LostTotalWidth = 20 )
列宽度常量
View Source
const ( DirectionUL = "UL" // 上行 DirectionDL = "DL" // 下行 DirectionTotal = "SUM" // 总计 )
Direction 流量方向
View Source
const ( RoleClient = "CLIENT" // 客户端 RoleServer = "SERVER" // 服务端 )
Role 角色标识
Variables ¶
This section is empty.
Functions ¶
func FormatJitter ¶
FormatJitter 返回抖动列字符串;无样本时为 " N/A "。
func FormatLostTotal ¶
FormatLostTotal 格式化为 iperf 风格 "lost/total (pct%)";total==0 时百分比为 0。
func MeanInterArrivalJitterMs ¶
MeanInterArrivalJitterMs 根据本端入站包到达时间戳(纳秒,单调递增)与理论包间隔(纳秒)计算平均绝对到达偏差,单位毫秒。 样本不足(少于 2 个到达)时返回 ok=false。
Types ¶
Source Files
¶
- statsprint.go
Click to show internal directories.
Click to hide internal directories.