MCPcopy
hub / github.com/segmentio/kafka-go / benchmarkConnRead

Function benchmarkConnRead

conn_test.go:1241–1264  ·  view source on GitHub ↗
(b *testing.B, conn *Conn, a []byte)

Source from the content-addressed store, hash-verified

1239}
1240
1241func benchmarkConnRead(b *testing.B, conn *Conn, a []byte) {
1242 n := 0
1243 i := 0
1244
1245 for i != b.N {
1246 if (i % benchmarkMessageCount) == 0 {
1247 if _, err := conn.Seek(0, SeekStart); err != nil {
1248 b.Error(err)
1249 return
1250 }
1251 }
1252
1253 c, err := conn.Read(a)
1254 if err != nil {
1255 b.Error(err)
1256 return
1257 }
1258
1259 n += c
1260 i++
1261 }
1262
1263 b.SetBytes(int64(n / i))
1264}
1265
1266func benchmarkConnReadBatch(b *testing.B, conn *Conn, a []byte) {
1267 const minBytes = 1

Callers

nothing calls this directly

Calls 3

SeekMethod · 0.45
ErrorMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected