in clientui.go [118:193]
func printTestResult(test *ethrTest, seconds uint64) {
if test.testID.Type == Bandwidth &&
(test.testID.Protocol == TCP || test.testID.Protocol == UDP) {
if gInterval == 0 {
printBwTestDivider(test.testID.Protocol)
printBwTestHeader(test.testID.Protocol)
}
cbw := uint64(0)
cpps := uint64(0)
ccount := 0
test.connListDo(func(ec *ethrConn) {
bw := atomic.SwapUint64(&ec.bw, 0)
pps := atomic.SwapUint64(&ec.pps, 0)
bw /= seconds
if !gNoConnectionStats {
fd := fmt.Sprintf("%5d", ec.fd)
printBwTestResult(test.testID.Protocol, fd, gInterval, gInterval+1, bw, pps)
}
cbw += bw
cpps += pps
ccount++
})
if ccount > 1 || gNoConnectionStats {
printBwTestResult(test.testID.Protocol, "SUM", gInterval, gInterval+1, cbw, cpps)
if !gNoConnectionStats {
printBwTestDivider(test.testID.Protocol)
}
}
logResults([]string{test.session.remoteIP, protoToString(test.testID.Protocol),
bytesToRate(cbw), "", ppsToString(cpps), ""})
} else if test.testID.Type == Cps {
if gInterval == 0 {
ui.printMsg("- - - - - - - - - - - - - - - - - - ")
ui.printMsg("Protocol Interval Conn/s")
}
cps := atomic.SwapUint64(&test.testResult.cps, 0)
ui.printMsg(" %-5s %03d-%03d sec %7s",
protoToString(test.testID.Protocol),
gInterval, gInterval+1, cpsToString(cps))
logResults([]string{test.session.remoteIP, protoToString(test.testID.Protocol),
"", cpsToString(cps), "", ""})
} else if test.testID.Type == Pps {
if gInterval == 0 {
ui.printMsg("- - - - - - - - - - - - - - - - - - - - - - -")
ui.printMsg("Protocol Interval Bits/s Pkts/s")
}
bw := atomic.SwapUint64(&test.testResult.bw, 0)
pps := atomic.SwapUint64(&test.testResult.pps, 0)
ui.printMsg(" %-5s %03d-%03d sec %7s %7s",
protoToString(test.testID.Protocol),
gInterval, gInterval+1, bytesToRate(bw), ppsToString(pps))
logResults([]string{test.session.remoteIP, protoToString(test.testID.Protocol),
bytesToRate(bw), "", ppsToString(pps), ""})
} else if test.testID.Type == MyTraceRoute {
if gCurHops > 0 {
ui.printMsg("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
ui.printMsg("Host: %-40s Sent Recv Last Avg Best Wrst", test.session.remoteIP)
}
for i := 0; i < gCurHops; i++ {
hopData := gHop[i]
if hopData.addr != "" {
if hopData.sent > 0 {
avg := time.Duration(0)
if hopData.rcvd > 0 {
avg = time.Duration(hopData.total.Nanoseconds() / int64(hopData.rcvd))
}
ui.printMsg("%2d.|--%-40s %5d %5d %9s %9s %9s %9s", i+1, hopData.addr, hopData.sent, hopData.rcvd,
durationToString(hopData.last), durationToString(avg), durationToString(hopData.best), durationToString(hopData.worst))
}
} else {
ui.printMsg("%2d.|--%-40s %5s %5s %9s %9s %9s %9s", i+1, "???", "-", "-", "-", "-", "-", "-")
}
}
}
gInterval++
}