MCPcopy Index your code
hub / github.com/google/gopacket / BenchmarkNgWritePacket

Function BenchmarkNgWritePacket

pcapgo/ngwrite_test.go:223–239  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

221}
222
223func BenchmarkNgWritePacket(b *testing.B) {
224 ci := gopacket.CaptureInfo{
225 Timestamp: time.Unix(0x01020304, 0xAA*1000),
226 Length: 0xABCD,
227 CaptureLength: 10,
228 }
229 data := []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
230 w, err := NewNgWriter(&ngDevNull{}, layers.LinkTypeEthernet)
231 if err != nil {
232 b.Fatal("Failed creating writer:", err)
233 }
234 b.ResetTimer()
235
236 for i := 0; i < b.N; i++ {
237 w.WritePacket(ci, data)
238 }
239}

Callers

nothing calls this directly

Calls 2

WritePacketMethod · 0.95
NewNgWriterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…