(b *testing.B, dlc gopacket.DecodingLayerContainer, ignorePanic bool)
| 206 | } |
| 207 | |
| 208 | func benchmarkDecodingLayerParser(b *testing.B, dlc gopacket.DecodingLayerContainer, ignorePanic bool) { |
| 209 | decoded := make([]gopacket.LayerType, 0, 20) |
| 210 | dlc = dlc.Put(&Ethernet{}) |
| 211 | dlc = dlc.Put(&IPv4{}) |
| 212 | dlc = dlc.Put(&TCP{}) |
| 213 | dlc = dlc.Put(&gopacket.Payload{}) |
| 214 | dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet) |
| 215 | dlp.SetDecodingLayerContainer(dlc) |
| 216 | dlp.IgnorePanic = ignorePanic |
| 217 | for i := 0; i < b.N; i++ { |
| 218 | dlp.DecodeLayers(testSimpleTCPPacket, &decoded) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | func BenchmarkDecodingLayerParserSparseIgnorePanic(b *testing.B) { |
| 223 | benchmarkDecodingLayerParser(b, gopacket.DecodingLayerSparse(nil), true) |
no test coverage detected
searching dependent graphs…