in network/benchmarks/netperf/nptest/nptest.go [495:562]
func (t *NetPerfRPC) ReceiveOutput(data *WorkerOutput, reply *int) error {
globalLock.Lock()
defer globalLock.Unlock()
testcase := testcases[currentJobIndex]
var outputLog string
var bw string
var cpuSender string
var cpuReceiver string
switch data.Type {
case iperfTCPTest:
mss := testcases[currentJobIndex].MSS - mssStepSize
outputLog = outputLog + fmt.Sprintln("Received TCP output from worker", data.Worker, "for test", testcase.Label,
"from", testcase.SourceNode, "to", testcase.DestinationNode, "MSS:", mss) + data.Output
writeOutputFile(outputCaptureFile, outputLog)
bw = parseIperfTCPBandwidth(data.Output)
cpuSender, cpuReceiver = parseIperfCPUUsage(data.Output)
registerDataPoint(testcase.Label, mss, bw, currentJobIndex)
case qperfTCPTest:
msgSize := testcases[currentJobIndex].MsgSize / 2
outputLog = outputLog + fmt.Sprintln("Received TCP output from worker", data.Worker, "for test", testcase.Label,
"from", testcase.SourceNode, "to", testcase.DestinationNode, "MsgSize:", msgSize) + data.Output
writeOutputFile(outputCaptureFile, outputLog)
bw = parseQperfTCPLatency(data.Output)
cpuSender, cpuReceiver = "na", "na"
registerDataPoint(testcase.Label, msgSize, bw, currentJobIndex)
case iperfSctpTest:
mss := testcases[currentJobIndex].MSS - mssStepSize
outputLog = outputLog + fmt.Sprintln("Received SCTP output from worker", data.Worker, "for test", testcase.Label,
"from", testcase.SourceNode, "to", testcase.DestinationNode, "MSS:", mss) + data.Output
writeOutputFile(outputCaptureFile, outputLog)
bw = parseIperfSctpBandwidth(data.Output)
cpuSender, cpuReceiver = parseIperfCPUUsage(data.Output)
registerDataPoint(testcase.Label, mss, bw, currentJobIndex)
case iperfUDPTest:
mss := testcases[currentJobIndex].MSS - mssStepSize
outputLog = outputLog + fmt.Sprintln("Received UDP output from worker", data.Worker, "for test", testcase.Label,
"from", testcase.SourceNode, "to", testcase.DestinationNode, "MSS:", mss) + data.Output
writeOutputFile(outputCaptureFile, outputLog)
bw = parseIperfUDPBandwidth(data.Output)
registerDataPoint(testcase.Label, mss, bw, currentJobIndex)
case netperfTest:
outputLog = outputLog + fmt.Sprintln("Received netperf output from worker", data.Worker, "for test", testcase.Label,
"from", testcase.SourceNode, "to", testcase.DestinationNode) + data.Output
writeOutputFile(outputCaptureFile, outputLog)
bw = parseNetperfBandwidth(data.Output)
registerDataPoint(testcase.Label, 0, bw, currentJobIndex)
testcases[currentJobIndex].Finished = true
}
switch data.Type {
case iperfTCPTest, iperfSctpTest:
fmt.Println("Jobdone from worker", data.Worker, "Bandwidth was", bw, "Mbits/sec. CPU usage sender was", cpuSender, "%. CPU usage receiver was", cpuReceiver, "%.")
case qperfTCPTest:
fmt.Println("Jobdone from worker QPERF", data.Worker, "Bandwidth, Latency was", bw, "CPU usage sender was", cpuSender, "%. CPU usage receiver was", cpuReceiver, "%.")
default:
fmt.Println("Jobdone from worker", data.Worker, "Bandwidth was", bw, "Mbits/sec")
}
return nil
}