Function
benchmarkConnRead
(b *testing.B, conn *Conn, a []byte)
Source from the content-addressed store, hash-verified
| 1239 | } |
| 1240 | |
| 1241 | func 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 | |
| 1266 | func benchmarkConnReadBatch(b *testing.B, conn *Conn, a []byte) { |
| 1267 | const minBytes = 1 |
Callers
nothing calls this directly
Tested by
no test coverage detected