mirror of https://github.com/cbeuw/Cloak
Add latency benchmark
This commit is contained in:
parent
2d08e88efb
commit
3ad04aa7e9
|
|
@ -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…
Reference in New Issue