MCPcopy
hub / github.com/google/gopacket / BenchmarkKnownStack

Function BenchmarkKnownStack

layers/decode_test.go:178–188  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

176}
177
178func BenchmarkKnownStack(b *testing.B) {
179 stack := []gopacket.DecodingLayer{&Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{}}
180 nf := gopacket.NilDecodeFeedback
181 for i := 0; i < b.N; i++ {
182 data := testSimpleTCPPacket[:]
183 for _, d := range stack {
184 _ = d.DecodeFromBytes(data, nf)
185 data = d.LayerPayload()
186 }
187 }
188}
189
190func BenchmarkDecodingLayerParserIgnorePanic(b *testing.B) {
191 decoded := make([]gopacket.LayerType, 0, 20)

Callers

nothing calls this directly

Calls 2

DecodeFromBytesMethod · 0.65
LayerPayloadMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…