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

Function benchmarkDecodingLayerContainer

layers/decode_test.go:246–257  ·  view source on GitHub ↗
(b *testing.B, dlc gopacket.DecodingLayerContainer)

Source from the content-addressed store, hash-verified

244}
245
246func benchmarkDecodingLayerContainer(b *testing.B, dlc gopacket.DecodingLayerContainer) {
247 decoded := make([]gopacket.LayerType, 0, 20)
248 dlc = dlc.Put(&Ethernet{})
249 dlc = dlc.Put(&IPv4{})
250 dlc = dlc.Put(&TCP{})
251 dlc = dlc.Put(&gopacket.Payload{})
252 df := gopacket.NewDecodingLayerParser(LayerTypeEthernet)
253 decoder := dlc.LayersDecoder(LayerTypeEthernet, df)
254 for i := 0; i < b.N; i++ {
255 decoder(testSimpleTCPPacket, &decoded)
256 }
257}
258
259func BenchmarkDecodingLayerArray(b *testing.B) {
260 benchmarkDecodingLayerContainer(b, gopacket.DecodingLayerArray(nil))

Callers 3

Calls 3

NewDecodingLayerParserFunction · 0.92
PutMethod · 0.65
LayersDecoderMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…