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

Function BenchmarkWritePacket

pcapgo/write_test.go:65–80  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

63}
64
65func BenchmarkWritePacket(b *testing.B) {
66 b.StopTimer()
67 ci := gopacket.CaptureInfo{
68 Timestamp: time.Unix(0x01020304, 0xAA*1000),
69 Length: 0xABCD,
70 CaptureLength: 10,
71 }
72 data := []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
73 var buf bytes.Buffer
74 w := NewWriter(&buf)
75 b.StartTimer()
76
77 for i := 0; i < b.N; i++ {
78 w.WritePacket(ci, data)
79 }
80}
81
82func TestCaptureInfoErrors(t *testing.T) {
83 data := []byte{1, 2, 3, 4}

Callers

nothing calls this directly

Calls 2

WritePacketMethod · 0.95
NewWriterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…