Add latency benchmark

pull/158/head
Andy Wang 3 years ago
parent 2d08e88efb
commit 3ad04aa7e9
No known key found for this signature in database
GPG Key ID: 181B49F9F38F3374

@ -508,7 +508,7 @@ func TestClosingStreamsFromProxy(t *testing.T) {
}
}
func BenchmarkThroughput(b *testing.B) {
func BenchmarkIntegration(b *testing.B) {
log.SetLevel(log.ErrorLevel)
worldState := common.WorldOfTime(time.Unix(10, 0))
lcc, rcc, ai := generateClientConfigs(basicTCPConfig, worldState)
@ -529,7 +529,7 @@ func BenchmarkThroughput(b *testing.B) {
b.Fatal(err)
}
b.Run("single stream", func(b *testing.B) {
b.Run("single stream bandwidth", func(b *testing.B) {
more := make(chan int, 10)
go func() {
// sender
@ -553,6 +553,19 @@ func BenchmarkThroughput(b *testing.B) {
}
})
b.Run("single stream latency", func(b *testing.B) {
clientConn, _ := proxyToCkClientD.Dial("", "")
buf := []byte{1}
clientConn.Write(buf)
serverConn, _ := proxyFromCkServerL.Accept()
serverConn.Read(buf)
b.ResetTimer()
for i := 0; i < b.N; i++ {
clientConn.Write(buf)
serverConn.Read(buf)
}
})
})
}

Loading…
Cancel
Save