Tags: scroot/gopacket
Tags
BENCH Update ports/macs. ---------------------------------------------------------- BENCHMARK_MARKER_DO_NOT_CHANGE ---------------------------------------------------------- Go version go version go1.3 linux/amd64 TEST BENCHMARKS PASS BenchmarkTypeAssertion 500000000 3.81 ns/op BenchmarkMapLookup 500000000 3.95 ns/op BenchmarkNilMapLookup 500000000 3.20 ns/op BenchmarkNilMapLookupWithNilCheck 2000000000 0.81 ns/op BenchmarkArrayLookup 2000000000 0.54 ns/op BenchmarkTypeToInterface1 2000000000 1.08 ns/op BenchmarkTypeToInterface2 2000000000 0.54 ns/op BenchmarkPassDecodeOptionsByValue 2000000000 0.27 ns/op BenchmarkPassDecodeOptionsByPointer 2000000000 0.28 ns/op BenchmarkLockOSThread 500000000 4.20 ns/op BenchmarkUnlockOSThread 500000000 4.84 ns/op BenchmarkLockUnlockOSThread 200000000 9.63 ns/op BenchmarkLockDeferUnlockOSThread 50000000 43.1 ns/op BenchmarkUnbufferedChannel 10000000 254 ns/op BenchmarkSmallBufferedChannel 5000000 303 ns/op BenchmarkLargeBufferedChannel 5000000 302 ns/op BenchmarkEndpointFastHashShort 200000000 9.02 ns/op BenchmarkEndpointFastHashLong 100000000 27.9 ns/op BenchmarkFlowFastHashShort 100000000 15.5 ns/op BenchmarkFlowFastHashLong 50000000 52.5 ns/op ok code.google.com/p/gopacket 40.812s PASS BenchmarkLayerClassSliceContains 2000000000 1.25 ns/op BenchmarkLayerClassMapContains 500000000 4.09 ns/op BenchmarkLazyNoCopyEthLayer 2000000 842 ns/op BenchmarkLazyNoCopyIPLayer 1000000 1305 ns/op BenchmarkLazyNoCopyTCPLayer 1000000 2057 ns/op BenchmarkLazyNoCopyAllLayers 1000000 2255 ns/op BenchmarkDefault 1000000 2727 ns/op BenchmarkSerializeTcpNoOptions 10000000 198 ns/op BenchmarkSerializeTcpFixLengths 10000000 210 ns/op BenchmarkSerializeTcpComputeChecksums 5000000 525 ns/op BenchmarkSerializeTcpFixLengthsComputeChecksums 5000000 539 ns/op BenchmarkLazy 1000000 1153 ns/op BenchmarkNoCopy 1000000 2083 ns/op BenchmarkLazyNoCopy 5000000 482 ns/op BenchmarkKnownStack 20000000 139 ns/op BenchmarkDecodingLayerParserIgnorePanic 10000000 205 ns/op BenchmarkDecodingLayerParserHandlePanic 10000000 245 ns/op BenchmarkAlloc 100000000 24.5 ns/op BenchmarkFlow 50000000 33.1 ns/op BenchmarkEndpoints 100000000 21.7 ns/op BenchmarkTCPLayerFromDecodedPacket 100000000 13.6 ns/op BenchmarkTCPLayerClassFromDecodedPacket 50000000 40.9 ns/op BenchmarkTCPTransportLayerFromDecodedPacket 500000000 3.03 ns/op BenchmarkDecodeFuncCallOverheadDirectCall 2000000000 1.14 ns/op BenchmarkDecodeFuncCallOverheadDecoderCall 500000000 6.87 ns/op BenchmarkDecodeFuncCallOverheadArrayCall 100000000 11.4 ns/op BenchmarkFmtVerboseString 50000 71803 ns/op BenchmarkPacketString 50000 61967 ns/op BenchmarkPacketDumpString 50000 61787 ns/op BenchmarkDecodeICMP 1000000 1661 ns/op BenchmarkDecodeICMP6 1000000 1899 ns/op BenchmarkDecodeMPLS 1000000 1845 ns/op BenchmarkDecodePPPoE_ICMPv6 1000000 2353 ns/op BenchmarkDecodePacketDot11CtrlCTS 1000000 1245 ns/op BenchmarkDecodePacketDot11MgmtBeacon 1000000 1578 ns/op BenchmarkDecodePacketDot11DataQOSData 1000000 3134 ns/op BenchmarkDecodePacketDot11MgmtAction 1000000 1550 ns/op BenchmarkDecodePacketDot11CtrlAck 1000000 1262 ns/op BenchmarkDecodePacketDot11DataARP 1000000 2515 ns/op BenchmarkDecodePacketDot11DataIP 1000000 3367 ns/op BenchmarkDecodePacketP6196 1000000 1609 ns/op BenchmarkDecodePacketIPSecESP 1000000 1472 ns/op ok code.google.com/p/gopacket/layers 101.591s PCAP BENCHMARK Local pcap file /tmp/gopacket_benchmark.pcap doesn't exist, reading from http://www.ll.mit.edu/mission/communications/cyber/CSTcorpora/ideval/data/1999/training/week1/tuesday/inside.tcpdump.gz Successfully read 341401548 bytes from url, unzipped to local storage Reading file once through to hopefully cache most of it Read in file /tmp/gopacket_benchmark.pcap , total of 341401548 bytes Opening file "/tmp/gopacket_benchmark.pcap" for read Reading all packets into memory with BufferPacketSource. Reading packet data into memory: 1237119 packets in 900.83028ms, 728ns per packet Time to read packet data into memory from file: 900.855383ms Benchmarking decode 1/5 Read in 1237119 packets in 1.75230302s, 1.416us per packet Benchmarking decode 2/5 Read in 1237119 packets in 1.649278462s, 1.333us per packet Benchmarking decode 3/5 Read in 1237119 packets in 2.01798188s, 1.631us per packet Benchmarking decode 4/5 Read in 1237119 packets in 1.636554324s, 1.322us per packet Benchmarking decode 5/5 Read in 1237119 packets in 1.66225894s, 1.343us per packet Benchmarking decoding layer parser 1/5 Read in 1237120 packets in 349.802063ms, decoded 4330909 layers, assembled 0 packets: 282ns per packet Benchmarking decoding layer parser 2/5 Read in 1237120 packets in 349.78844ms, decoded 4330909 layers, assembled 0 packets: 282ns per packet Benchmarking decoding layer parser 3/5 Read in 1237120 packets in 350.033489ms, decoded 4330909 layers, assembled 0 packets: 282ns per packet Benchmarking decoding layer parser 4/5 Read in 1237120 packets in 350.117178ms, decoded 4330909 layers, assembled 0 packets: 283ns per packet Benchmarking decoding layer parser 5/5 Read in 1237120 packets in 349.910114ms, decoded 4330909 layers, assembled 0 packets: 282ns per packet Benchmarking decoding layer parser with assembly 1/5 Read in 1237120 packets in 643.945511ms, decoded 4330909 layers, assembled 1153247 packets: 520ns per packet Benchmarking decoding layer parser with assembly 2/5 Read in 1237120 packets in 648.112965ms, decoded 4330909 layers, assembled 1153247 packets: 523ns per packet Benchmarking decoding layer parser with assembly 3/5 Read in 1237120 packets in 643.102959ms, decoded 4330909 layers, assembled 1153247 packets: 519ns per packet Benchmarking decoding layer parser with assembly 4/5 Read in 1237120 packets in 647.405443ms, decoded 4330909 layers, assembled 1153247 packets: 523ns per packet Benchmarking decoding layer parser with assembly 5/5 Read in 1237120 packets in 643.113587ms, decoded 4330909 layers, assembled 1153247 packets: 519ns per packet ---------------------------------------------------------- BENCHMARKING AGAINST COMMIT e4ba99e ---------------------------------------------------------- OLD TEST BENCHMARKS PASS BenchmarkTypeAssertion 500000000 4.11 ns/op BenchmarkMapLookup 500000000 4.08 ns/op BenchmarkNilMapLookup 500000000 3.22 ns/op BenchmarkNilMapLookupWithNilCheck 2000000000 0.81 ns/op BenchmarkArrayLookup 2000000000 0.54 ns/op BenchmarkTypeToInterface1 2000000000 1.08 ns/op BenchmarkTypeToInterface2 2000000000 0.54 ns/op BenchmarkPassDecodeOptionsByValue 2000000000 0.27 ns/op BenchmarkPassDecodeOptionsByPointer 2000000000 0.29 ns/op BenchmarkLockOSThread 500000000 4.05 ns/op BenchmarkUnlockOSThread 500000000 4.56 ns/op BenchmarkLockUnlockOSThread 200000000 9.39 ns/op BenchmarkLockDeferUnlockOSThread 50000000 41.6 ns/op BenchmarkUnbufferedChannel 10000000 247 ns/op BenchmarkSmallBufferedChannel 10000000 297 ns/op BenchmarkLargeBufferedChannel 5000000 299 ns/op BenchmarkEndpointFastHashShort 200000000 8.85 ns/op BenchmarkEndpointFastHashLong 100000000 27.4 ns/op BenchmarkFlowFastHashShort 100000000 15.4 ns/op BenchmarkFlowFastHashLong 50000000 54.6 ns/op ok code.google.com/p/gopacket 42.078s PASS BenchmarkLayerClassSliceContains 2000000000 1.14 ns/op BenchmarkLayerClassMapContains 500000000 4.03 ns/op BenchmarkLazyNoCopyEthLayer 2000000 918 ns/op BenchmarkLazyNoCopyIPLayer 1000000 1441 ns/op BenchmarkLazyNoCopyTCPLayer 1000000 2155 ns/op BenchmarkLazyNoCopyAllLayers 1000000 2360 ns/op BenchmarkDefault 1000000 2804 ns/op BenchmarkSerializeTcpNoOptions 10000000 203 ns/op BenchmarkSerializeTcpFixLengths 10000000 224 ns/op BenchmarkSerializeTcpComputeChecksums 5000000 542 ns/op BenchmarkSerializeTcpFixLengthsComputeChecksums 5000000 524 ns/op BenchmarkLazy 1000000 1156 ns/op BenchmarkNoCopy 1000000 2166 ns/op BenchmarkLazyNoCopy 5000000 479 ns/op BenchmarkKnownStack 20000000 138 ns/op BenchmarkDecodingLayerParserIgnorePanic 10000000 208 ns/op BenchmarkDecodingLayerParserHandlePanic 10000000 253 ns/op BenchmarkAlloc 100000000 25.2 ns/op BenchmarkFlow 50000000 38.0 ns/op BenchmarkEndpoints 100000000 21.5 ns/op BenchmarkTCPLayerFromDecodedPacket 100000000 13.1 ns/op BenchmarkTCPLayerClassFromDecodedPacket 50000000 40.4 ns/op BenchmarkTCPTransportLayerFromDecodedPacket 1000000000 2.96 ns/op BenchmarkDecodeFuncCallOverheadDirectCall 2000000000 1.25 ns/op BenchmarkDecodeFuncCallOverheadDecoderCall 500000000 6.96 ns/op BenchmarkDecodeFuncCallOverheadArrayCall 100000000 10.9 ns/op BenchmarkFmtVerboseString 50000 71313 ns/op BenchmarkPacketString 50000 60784 ns/op BenchmarkPacketDumpString 50000 60979 ns/op BenchmarkDecodeICMP 1000000 1624 ns/op BenchmarkDecodeICMP6 1000000 1854 ns/op BenchmarkDecodeMPLS 1000000 1831 ns/op BenchmarkDecodePPPoE_ICMPv6 1000000 2340 ns/op BenchmarkDecodePacketIPSecESP 1000000 1394 ns/op ok code.google.com/p/gopacket/layers 87.062s OLD PCAP BENCHMARK Reading file once through to hopefully cache most of it Read in file /tmp/gopacket_benchmark.pcap , total of 341401548 bytes Opening file "/tmp/gopacket_benchmark.pcap" for read Reading all packets into memory with BufferPacketSource. Reading packet data into memory: 1237119 packets in 946.79758ms, 765ns per packet Time to read packet data into memory from file: 946.835528ms Benchmarking decode 1/5 Read in 1237119 packets in 1.715498607s, 1.386us per packet Benchmarking decode 2/5 Read in 1237119 packets in 1.670698893s, 1.35us per packet Benchmarking decode 3/5 Read in 1237119 packets in 1.640986722s, 1.326us per packet Benchmarking decode 4/5 Read in 1237119 packets in 1.62888651s, 1.316us per packet Benchmarking decode 5/5 Read in 1237119 packets in 1.628940146s, 1.316us per packet Benchmarking decoding layer parser 1/5 Read in 1237120 packets in 341.300876ms, decoded 4330909 layers, assembled 0 packets: 275ns per packet Benchmarking decoding layer parser 2/5 Read in 1237120 packets in 341.290275ms, decoded 4330909 layers, assembled 0 packets: 275ns per packet Benchmarking decoding layer parser 3/5 Read in 1237120 packets in 341.337149ms, decoded 4330909 layers, assembled 0 packets: 275ns per packet Benchmarking decoding layer parser 4/5 Read in 1237120 packets in 341.300983ms, decoded 4330909 layers, assembled 0 packets: 275ns per packet Benchmarking decoding layer parser 5/5 Read in 1237120 packets in 341.235645ms, decoded 4330909 layers, assembled 0 packets: 275ns per packet Benchmarking decoding layer parser with assembly 1/5 Read in 1237120 packets in 636.345696ms, decoded 4330909 layers, assembled 1153247 packets: 514ns per packet Benchmarking decoding layer parser with assembly 2/5 Read in 1237120 packets in 636.20898ms, decoded 4330909 layers, assembled 1153247 packets: 514ns per packet Benchmarking decoding layer parser with assembly 3/5 Read in 1237120 packets in 636.485875ms, decoded 4330909 layers, assembled 1153247 packets: 514ns per packet Benchmarking decoding layer parser with assembly 4/5 Read in 1237120 packets in 637.245984ms, decoded 4330909 layers, assembled 1153247 packets: 515ns per packet Benchmarking decoding layer parser with assembly 5/5 Read in 1237120 packets in 636.384694ms, decoded 4330909 layers, assembled 1153247 packets: 514ns per packet
Fix Issue 15 in PFRing. Fix issue where we tried to truncate byte slice by the packet length, not the captured length. Since the packet length could be longer than the input buffer, this can cause slice out-of-bounds errors whenever we see a packet bigger than our snaplen.
Minor comments/fixes, expose bytediff. Some minor additions of comments and slight refactorings in the base gopacket library. Also, I've exposed byte differences, used in layers/decode_test, to the outside world at gopacket/bytediff. It's a small, simple-to-use library for displaying differences between small byte slices (read: packets ;) to humans in an understandable way.
PreviousNext