+
Skip to content

Tags: bodji/gopacket

Tags

v1.1.2

Toggle v1.1.2's commit message
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.

v1.1.1

Toggle v1.1.1's commit message
Fix numerous small issues.

Issue 12:  pfring documentation
Issue 13:  winsock constants override enum.go
Issue 14:  PCAP_NETMASK_UNKNOWN not in all versions of pcap

v1.1.0

Toggle v1.1.0's commit message
Fix stupid english mistakes.

For some reason I totally forgot that Unactivated isn't a word... it's
"Inactive".  Sigh.  Fixed.

v1.0.12

Toggle v1.0.12's commit message
BENCH Capture pcap_activate errors, regen ports/prefixes.

----------------------------------------------------------
BENCHMARK_MARKER_DO_NOT_CHANGE
----------------------------------------------------------

Go version go version go1.2 darwin/amd64

TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         3.90 ns/op
BenchmarkMapLookup	500000000	         3.86 ns/op
BenchmarkNilMapLookup	500000000	         3.59 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.89 ns/op
BenchmarkArrayLookup	2000000000	         0.60 ns/op
BenchmarkTypeToInterface1	2000000000	         0.90 ns/op
BenchmarkTypeToInterface2	2000000000	         0.60 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.30 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.30 ns/op
BenchmarkLockOSThread	500000000	         4.55 ns/op
BenchmarkUnlockOSThread	500000000	         5.05 ns/op
BenchmarkLockUnlockOSThread	100000000	        10.4 ns/op
BenchmarkLockDeferUnlockOSThread	20000000	        76.4 ns/op
BenchmarkUnbufferedChannel	10000000	       278 ns/op
BenchmarkSmallBufferedChannel	 5000000	       335 ns/op
BenchmarkLargeBufferedChannel	 5000000	       331 ns/op
BenchmarkEndpointFastHashShort	100000000	        16.2 ns/op
BenchmarkEndpointFastHashLong	50000000	        34.0 ns/op
BenchmarkFlowFastHashShort	100000000	        21.7 ns/op
BenchmarkFlowFastHashLong	50000000	        57.4 ns/op
ok  	code.google.com/p/gopacket	38.404s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.20 ns/op
BenchmarkLayerClassMapContains	500000000	         4.00 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       933 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1461 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2281 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2513 ns/op
BenchmarkDefault	 1000000	      2840 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       252 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       258 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       576 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       584 ns/op
BenchmarkLazy	 1000000	      1117 ns/op
BenchmarkNoCopy	 1000000	      2151 ns/op
BenchmarkLazyNoCopy	 5000000	       476 ns/op
BenchmarkKnownStack	10000000	       181 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       252 ns/op
BenchmarkDecodingLayerParserHandlePanic	 5000000	       332 ns/op
BenchmarkAlloc	50000000	        35.7 ns/op
BenchmarkFlow	50000000	        43.0 ns/op
BenchmarkEndpoints	50000000	        55.3 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        12.5 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        50.7 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	500000000	         3.17 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.19 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.70 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	100000000	        10.8 ns/op
BenchmarkFmtVerboseString	   10000	    191740 ns/op
BenchmarkPacketString	   50000	     61088 ns/op
BenchmarkPacketDumpString	   50000	     61121 ns/op
BenchmarkDecodeICMP	 1000000	      1727 ns/op
BenchmarkDecodeICMP6	 1000000	      1945 ns/op
BenchmarkDecodeMPLS	 1000000	      1895 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2385 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1480 ns/op
ok  	code.google.com/p/gopacket/layers	84.545s

PCAP BENCHMARK
Local pcap file /var/folders/00/07mgr000h01000cxqpysvccm000yjz/T//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 /var/folders/00/07mgr000h01000cxqpysvccm000yjz/T//gopacket_benchmark.pcap , total of 341401548 bytes
Opening file "/var/folders/00/07mgr000h01000cxqpysvccm000yjz/T//gopacket_benchmark.pcap" for read
Reading all packets into memory with BufferPacketSource.
Reading packet data into memory: 1237119 packets in 1.165674079s, 942ns per packet
Time to read packet data into memory from file: 1.16570573s

Benchmarking decode 1/5
	Read in 1237119 packets in 1.782413711s, 1.44us per packet
Benchmarking decode 2/5
	Read in 1237119 packets in 1.57956433s, 1.276us per packet
Benchmarking decode 3/5
	Read in 1237119 packets in 1.624183055s, 1.312us per packet
Benchmarking decode 4/5
	Read in 1237119 packets in 1.658876275s, 1.34us per packet
Benchmarking decode 5/5
	Read in 1237119 packets in 1.646003362s, 1.33us per packet

Benchmarking decoding layer parser 1/5
	Read in 1237120 packets in 397.893264ms, decoded 4330909 layers, assembled 0 packets: 321ns per packet
Benchmarking decoding layer parser 2/5
	Read in 1237120 packets in 399.336627ms, decoded 4330909 layers, assembled 0 packets: 322ns per packet
Benchmarking decoding layer parser 3/5
	Read in 1237120 packets in 402.378176ms, decoded 4330909 layers, assembled 0 packets: 325ns per packet
Benchmarking decoding layer parser 4/5
	Read in 1237120 packets in 398.963177ms, decoded 4330909 layers, assembled 0 packets: 322ns per packet
Benchmarking decoding layer parser 5/5
	Read in 1237120 packets in 399.818023ms, decoded 4330909 layers, assembled 0 packets: 323ns per packet

Benchmarking decoding layer parser with assembly 1/5
	Read in 1237120 packets in 716.477067ms, decoded 4330909 layers, assembled 1153247 packets: 579ns per packet
Benchmarking decoding layer parser with assembly 2/5
	Read in 1237120 packets in 713.966645ms, decoded 4330909 layers, assembled 1153247 packets: 577ns per packet
Benchmarking decoding layer parser with assembly 3/5
	Read in 1237120 packets in 714.703714ms, decoded 4330909 layers, assembled 1153247 packets: 577ns per packet
Benchmarking decoding layer parser with assembly 4/5
	Read in 1237120 packets in 717.088317ms, decoded 4330909 layers, assembled 1153247 packets: 579ns per packet
Benchmarking decoding layer parser with assembly 5/5
	Read in 1237120 packets in 713.728779ms, decoded 4330909 layers, assembled 1153247 packets: 576ns per packet
----------------------------------------------------------
BENCHMARKING AGAINST COMMIT bbaeda7
----------------------------------------------------------

OLD TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         3.91 ns/op
BenchmarkMapLookup	500000000	         3.82 ns/op
BenchmarkNilMapLookup	500000000	         3.56 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.89 ns/op
BenchmarkArrayLookup	2000000000	         0.59 ns/op
BenchmarkTypeToInterface1	2000000000	         0.89 ns/op
BenchmarkTypeToInterface2	2000000000	         0.59 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.30 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.30 ns/op
BenchmarkLockOSThread	500000000	         4.51 ns/op
BenchmarkUnlockOSThread	500000000	         5.04 ns/op
BenchmarkLockUnlockOSThread	100000000	        10.4 ns/op
BenchmarkLockDeferUnlockOSThread	20000000	        76.1 ns/op
BenchmarkUnbufferedChannel	10000000	       289 ns/op
BenchmarkSmallBufferedChannel	 5000000	       329 ns/op
BenchmarkLargeBufferedChannel	 5000000	       331 ns/op
BenchmarkEndpointFastHashShort	100000000	        16.7 ns/op
BenchmarkEndpointFastHashLong	50000000	        34.1 ns/op
BenchmarkFlowFastHashShort	100000000	        21.6 ns/op
BenchmarkFlowFastHashLong	50000000	        57.0 ns/op
ok  	code.google.com/p/gopacket	38.367s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.19 ns/op
BenchmarkLayerClassMapContains	500000000	         4.04 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       902 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1456 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2269 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2441 ns/op
BenchmarkDefault	 1000000	      2773 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       250 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       255 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       571 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       577 ns/op
BenchmarkLazy	 1000000	      1122 ns/op
BenchmarkNoCopy	 1000000	      2121 ns/op
BenchmarkLazyNoCopy	 5000000	       471 ns/op
BenchmarkKnownStack	10000000	       181 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       256 ns/op
BenchmarkDecodingLayerParserHandlePanic	 5000000	       337 ns/op
BenchmarkAlloc	50000000	        35.6 ns/op
BenchmarkFlow	50000000	        43.0 ns/op
BenchmarkEndpoints	50000000	        55.2 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        12.5 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        40.2 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	500000000	         3.22 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.19 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.67 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	100000000	        10.8 ns/op
BenchmarkFmtVerboseString	   10000	    191703 ns/op
BenchmarkPacketString	   50000	     60965 ns/op
BenchmarkPacketDumpString	   50000	     60962 ns/op
BenchmarkDecodeICMP	 1000000	      1720 ns/op
BenchmarkDecodeICMP6	 1000000	      1915 ns/op
BenchmarkDecodeMPLS	 1000000	      1889 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2425 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1456 ns/op
ok  	code.google.com/p/gopacket/layers	83.548s

OLD PCAP BENCHMARK
Reading file once through to hopefully cache most of it
Read in file /var/folders/00/07mgr000h01000cxqpysvccm000yjz/T//gopacket_benchmark.pcap , total of 341401548 bytes
Opening file "/var/folders/00/07mgr000h01000cxqpysvccm000yjz/T//gopacket_benchmark.pcap" for read
Reading all packets into memory with BufferPacketSource.
Reading packet data into memory: 1237119 packets in 1.102306453s, 891ns per packet
Time to read packet data into memory from file: 1.102352274s

Benchmarking decode 1/5
	Read in 1237119 packets in 1.758718353s, 1.421us per packet
Benchmarking decode 2/5
	Read in 1237119 packets in 1.580887575s, 1.277us per packet
Benchmarking decode 3/5
	Read in 1237119 packets in 1.618946992s, 1.308us per packet
Benchmarking decode 4/5
	Read in 1237119 packets in 1.696694762s, 1.371us per packet
Benchmarking decode 5/5
	Read in 1237119 packets in 1.751296183s, 1.415us per packet

Benchmarking decoding layer parser 1/5
	Read in 1237120 packets in 429.062095ms, decoded 4330909 layers, assembled 0 packets: 346ns per packet
Benchmarking decoding layer parser 2/5
	Read in 1237120 packets in 428.495618ms, decoded 4330909 layers, assembled 0 packets: 346ns per packet
Benchmarking decoding layer parser 3/5
	Read in 1237120 packets in 426.39996ms, decoded 4330909 layers, assembled 0 packets: 344ns per packet
Benchmarking decoding layer parser 4/5
	Read in 1237120 packets in 425.744012ms, decoded 4330909 layers, assembled 0 packets: 344ns per packet
Benchmarking decoding layer parser 5/5
	Read in 1237120 packets in 427.540916ms, decoded 4330909 layers, assembled 0 packets: 345ns per packet

Benchmarking decoding layer parser with assembly 1/5
	Read in 1237120 packets in 750.800395ms, decoded 4330909 layers, assembled 1153247 packets: 606ns per packet
Benchmarking decoding layer parser with assembly 2/5
	Read in 1237120 packets in 745.20974ms, decoded 4330909 layers, assembled 1153247 packets: 602ns per packet
Benchmarking decoding layer parser with assembly 3/5
	Read in 1237120 packets in 739.565771ms, decoded 4330909 layers, assembled 1153247 packets: 597ns per packet
Benchmarking decoding layer parser with assembly 4/5
	Read in 1237120 packets in 740.975055ms, decoded 4330909 layers, assembled 1153247 packets: 598ns per packet
Benchmarking decoding layer parser with assembly 5/5
	Read in 1237120 packets in 764.387062ms, decoded 4330909 layers, assembled 1153247 packets: 617ns per packet

v1.0.11

Toggle v1.0.11's commit message
Fix writer to use format that older libpcap can read (microsecond

timestamp) and write test to make sure it works.

v1.0.10

Toggle v1.0.10's commit message
Fix stripEmpty behavior, issue google#6.

v1.0.9

Toggle v1.0.9's commit message
Fix BPF setting to activate the pcap filter after activation.

v1.0.8

Toggle v1.0.8's commit message
BENCH PCAP: set packet timestamp source.

Add the ability to specify a timestamp source for PCAP handles pulling live
traffic.

----------------------------------------------------------
BENCHMARK_MARKER_DO_NOT_CHANGE
----------------------------------------------------------

Go version go version go1.2 linux/amd64

TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         3.44 ns/op
BenchmarkMapLookup	500000000	         3.55 ns/op
BenchmarkNilMapLookup	500000000	         3.17 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.79 ns/op
BenchmarkArrayLookup	2000000000	         0.53 ns/op
BenchmarkTypeToInterface1	2000000000	         0.79 ns/op
BenchmarkTypeToInterface2	2000000000	         0.53 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.26 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.26 ns/op
BenchmarkLockOSThread	500000000	         3.99 ns/op
BenchmarkUnlockOSThread	500000000	         4.49 ns/op
BenchmarkLockUnlockOSThread	200000000	         9.26 ns/op
BenchmarkLockDeferUnlockOSThread	50000000	        58.6 ns/op
BenchmarkUnbufferedChannel	10000000	       250 ns/op
BenchmarkSmallBufferedChannel	 5000000	       304 ns/op
BenchmarkLargeBufferedChannel	 5000000	       306 ns/op
BenchmarkEndpointFastHashShort	100000000	        15.8 ns/op
BenchmarkEndpointFastHashLong	50000000	        34.4 ns/op
BenchmarkFlowFastHashShort	100000000	        22.2 ns/op
BenchmarkFlowFastHashLong	50000000	        59.0 ns/op
ok  	code.google.com/p/gopacket	38.794s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.06 ns/op
BenchmarkLayerClassMapContains	500000000	         3.92 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       907 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1403 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2284 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2453 ns/op
BenchmarkDefault	 1000000	      2893 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       234 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       245 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       575 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       578 ns/op
BenchmarkLazy	 1000000	      1152 ns/op
BenchmarkNoCopy	 1000000	      2117 ns/op
BenchmarkLazyNoCopy	 5000000	       491 ns/op
BenchmarkKnownStack	10000000	       175 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       237 ns/op
BenchmarkDecodingLayerParserHandlePanic	 5000000	       299 ns/op
BenchmarkAlloc	50000000	        31.7 ns/op
BenchmarkFlow	50000000	        39.7 ns/op
BenchmarkEndpoints	50000000	        48.9 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        11.6 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        35.1 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	1000000000	         2.87 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.06 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.10 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	200000000	         9.54 ns/op
BenchmarkFmtVerboseString	   10000	    168515 ns/op
BenchmarkPacketString	   50000	     57416 ns/op
BenchmarkPacketDumpString	   50000	     57340 ns/op
BenchmarkDecodeICMP	 1000000	      1654 ns/op
BenchmarkDecodeICMP6	 1000000	      1892 ns/op
BenchmarkDecodeMPLS	 1000000	      1855 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2378 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1424 ns/op
ok  	code.google.com/p/gopacket/layers	83.212s

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 890.461754ms, 719ns per packet
Time to read packet data into memory from file: 890.487143ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.569173023s, 1.268us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.522993314s, 1.231us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.554004907s, 1.256us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.567200224s, 1.266us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.574095788s, 1.272us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.588142265s, 1.283us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.588310232s, 1.283us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.581589607s, 1.278us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.5818236s, 1.278us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.582320805s, 1.279us per packet
----------------------------------------------------------
BENCHMARKING AGAINST COMMIT ee0baca
----------------------------------------------------------

OLD TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         3.45 ns/op
BenchmarkMapLookup	500000000	         3.56 ns/op
BenchmarkNilMapLookup	500000000	         3.17 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.80 ns/op
BenchmarkArrayLookup	2000000000	         0.53 ns/op
BenchmarkTypeToInterface1	2000000000	         0.79 ns/op
BenchmarkTypeToInterface2	2000000000	         0.53 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.26 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.26 ns/op
BenchmarkLockOSThread	500000000	         3.98 ns/op
BenchmarkUnlockOSThread	500000000	         4.50 ns/op
BenchmarkLockUnlockOSThread	200000000	         9.26 ns/op
BenchmarkLockDeferUnlockOSThread	50000000	        58.3 ns/op
BenchmarkUnbufferedChannel	10000000	       251 ns/op
BenchmarkSmallBufferedChannel	 5000000	       307 ns/op
BenchmarkLargeBufferedChannel	 5000000	       306 ns/op
BenchmarkEndpointFastHashShort	100000000	        15.7 ns/op
BenchmarkEndpointFastHashLong	50000000	        34.5 ns/op
BenchmarkFlowFastHashShort	100000000	        22.4 ns/op
BenchmarkFlowFastHashLong	50000000	        59.0 ns/op
ok  	code.google.com/p/gopacket	38.855s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.06 ns/op
BenchmarkLayerClassMapContains	500000000	         3.90 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       907 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1402 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2197 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2372 ns/op
BenchmarkDefault	 1000000	      2799 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       232 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       239 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       570 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       572 ns/op
BenchmarkLazy	 1000000	      1165 ns/op
BenchmarkNoCopy	 1000000	      2147 ns/op
BenchmarkLazyNoCopy	 5000000	       496 ns/op
BenchmarkKnownStack	10000000	       176 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       237 ns/op
BenchmarkDecodingLayerParserHandlePanic	10000000	       297 ns/op
BenchmarkAlloc	50000000	        31.7 ns/op
BenchmarkFlow	50000000	        39.7 ns/op
BenchmarkEndpoints	50000000	        48.9 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        11.6 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        35.1 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	1000000000	         2.87 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.06 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.10 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	200000000	         9.54 ns/op
BenchmarkFmtVerboseString	   10000	    168389 ns/op
BenchmarkPacketString	   50000	     57383 ns/op
BenchmarkPacketDumpString	   50000	     57324 ns/op
BenchmarkDecodeICMP	 1000000	      1652 ns/op
BenchmarkDecodeICMP6	 1000000	      1905 ns/op
BenchmarkDecodeMPLS	 1000000	      1855 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2373 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1423 ns/op
ok  	code.google.com/p/gopacket/layers	84.342s

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 814.464902ms, 658ns per packet
Time to read packet data into memory from file: 814.492122ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.589288933s, 1.284us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.525617561s, 1.233us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.557489589s, 1.258us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.573925009s, 1.272us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.580358283s, 1.277us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.582076713s, 1.278us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.583285942s, 1.279us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.582542394s, 1.279us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.583204198s, 1.279us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.583540421s, 1.28us per packet

v1.0.7

Toggle v1.0.7's commit message
BENCH Pull down most recent generated data for ports/macs.

----------------------------------------------------------
BENCHMARK_MARKER_DO_NOT_CHANGE
----------------------------------------------------------

Go version go version go1.2 linux/amd64

TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         4.15 ns/op
BenchmarkMapLookup	500000000	         4.24 ns/op
BenchmarkNilMapLookup	500000000	         3.69 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.83 ns/op
BenchmarkArrayLookup	2000000000	         0.55 ns/op
BenchmarkTypeToInterface1	2000000000	         0.85 ns/op
BenchmarkTypeToInterface2	2000000000	         0.55 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.27 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.28 ns/op
BenchmarkLockOSThread	500000000	         4.31 ns/op
BenchmarkUnlockOSThread	500000000	         4.88 ns/op
BenchmarkLockUnlockOSThread	200000000	         9.61 ns/op
BenchmarkLockDeferUnlockOSThread	50000000	        61.2 ns/op
BenchmarkUnbufferedChannel	10000000	       264 ns/op
BenchmarkSmallBufferedChannel	 5000000	       306 ns/op
BenchmarkLargeBufferedChannel	 5000000	       304 ns/op
BenchmarkEndpointFastHashShort	100000000	        15.8 ns/op
BenchmarkEndpointFastHashLong	50000000	        34.8 ns/op
BenchmarkFlowFastHashShort	100000000	        22.4 ns/op
BenchmarkFlowFastHashLong	50000000	        59.6 ns/op
ok  	code.google.com/p/gopacket	41.057s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.08 ns/op
BenchmarkLayerClassMapContains	500000000	         3.94 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       888 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1380 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2217 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2386 ns/op
BenchmarkDefault	 1000000	      2825 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       236 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       249 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       575 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       586 ns/op
BenchmarkLazy	 1000000	      1167 ns/op
BenchmarkNoCopy	 1000000	      2115 ns/op
BenchmarkLazyNoCopy	 5000000	       507 ns/op
BenchmarkKnownStack	10000000	       177 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       240 ns/op
BenchmarkDecodingLayerParserHandlePanic	 5000000	       305 ns/op
BenchmarkAlloc	50000000	        32.2 ns/op
BenchmarkFlow	50000000	        41.1 ns/op
BenchmarkEndpoints	50000000	        50.4 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        11.7 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        35.7 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	500000000	         3.14 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.13 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.12 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	200000000	        10.1 ns/op
BenchmarkFmtVerboseString	   10000	    177466 ns/op
BenchmarkPacketString	   50000	     58101 ns/op
BenchmarkPacketDumpString	   50000	     65632 ns/op
BenchmarkDecodeICMP	 1000000	      1692 ns/op
BenchmarkDecodeICMP6	 1000000	      2006 ns/op
BenchmarkDecodeMPLS	 1000000	      1873 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2378 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1413 ns/op
ok  	code.google.com/p/gopacket/layers	83.261s

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 963.131682ms, 778ns per packet
Time to read packet data into memory from file: 963.161539ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.88714507s, 1.525us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.57602487s, 1.273us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.553588024s, 1.255us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.560645717s, 1.261us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.572628212s, 1.271us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.577386833s, 1.275us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.607753063s, 1.299us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.591877161s, 1.286us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.570962967s, 1.269us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.569812453s, 1.268us per packet
----------------------------------------------------------
BENCHMARKING AGAINST COMMIT 94474fd
----------------------------------------------------------

OLD TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         3.63 ns/op
BenchmarkMapLookup	500000000	         3.66 ns/op
BenchmarkNilMapLookup	500000000	         3.20 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.80 ns/op
BenchmarkArrayLookup	2000000000	         0.54 ns/op
BenchmarkTypeToInterface1	2000000000	         0.80 ns/op
BenchmarkTypeToInterface2	2000000000	         0.53 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.27 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.29 ns/op
BenchmarkLockOSThread	500000000	         4.15 ns/op
BenchmarkUnlockOSThread	500000000	         4.60 ns/op
BenchmarkLockUnlockOSThread	200000000	         9.49 ns/op
BenchmarkLockDeferUnlockOSThread	50000000	        60.2 ns/op
BenchmarkUnbufferedChannel	10000000	       254 ns/op
BenchmarkSmallBufferedChannel	 5000000	       314 ns/op
BenchmarkLargeBufferedChannel	 5000000	       308 ns/op
BenchmarkEndpointFastHashShort	100000000	        15.9 ns/op
BenchmarkEndpointFastHashLong	50000000	        36.9 ns/op
BenchmarkFlowFastHashShort	100000000	        23.1 ns/op
BenchmarkFlowFastHashLong	50000000	        59.5 ns/op
ok  	code.google.com/p/gopacket	39.832s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.09 ns/op
BenchmarkLayerClassMapContains	500000000	         3.97 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       909 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1381 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2173 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2340 ns/op
BenchmarkDefault	 1000000	      2724 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       236 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       243 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       580 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       582 ns/op
BenchmarkLazy	 1000000	      1134 ns/op
BenchmarkNoCopy	 1000000	      2082 ns/op
BenchmarkLazyNoCopy	 5000000	       474 ns/op
BenchmarkKnownStack	10000000	       175 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       243 ns/op
BenchmarkDecodingLayerParserHandlePanic	10000000	       302 ns/op
BenchmarkAlloc	50000000	        32.0 ns/op
BenchmarkFlow	50000000	        40.0 ns/op
BenchmarkEndpoints	50000000	        50.3 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        11.7 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        35.7 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	1000000000	         2.91 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.10 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.05 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	200000000	         9.63 ns/op
BenchmarkFmtVerboseString	   10000	    169634 ns/op
BenchmarkPacketString	   50000	     57977 ns/op
BenchmarkPacketDumpString	   50000	     58121 ns/op
BenchmarkDecodeICMP	 1000000	      1643 ns/op
BenchmarkDecodeICMP6	 1000000	      1888 ns/op
BenchmarkDecodeMPLS	 1000000	      1855 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2404 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1437 ns/op
ok  	code.google.com/p/gopacket/layers	84.695s

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 997.980242ms, 806ns per packet
Time to read packet data into memory from file: 998.009848ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.910500851s, 1.544us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.778323064s, 1.437us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.813530895s, 1.465us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.578306418s, 1.275us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.571400176s, 1.27us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.572453s, 1.271us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.570522558s, 1.269us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.582784681s, 1.279us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.598131386s, 1.291us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.585144307s, 1.281us per packet

v1.0.6

Toggle v1.0.6's commit message
BENCH TCP Assembly work, small behavior changes.

I've added a new example to show how tcpassembly can be used without tcpreader.
It also illustrates the use of DecodingLayerParser and ZeroCopyReadPacketData.

Along the way, found and fixed a few minor issues with TCP assembly, and added a
debugging flag to provide VERY verbose logging should the need arise.

Bug 1)  If a TCP stream is stopped halfway through, one side may continue to
send some packet data until the RST reaches the other side.  All packets sent
during this time will also trigger RSTs, meaning a bunch of packets being sent
back over the wire without any data in them.  The problem is that with the old
code this created a new connection object (empty, of course).  This has been
fixed to not create connections for these "empty" packets.

Bug 2)  TCP SYN received out of order:  If a SYN was received after other data
had already been flushed (it was SUPER late), the old code would have actually
reset nextSeq to the SYN and blindly sent it along, not a good story at all.
The new code only sends a SYN if nextSeq shows that no packets have been sent
yet.

----------------------------------------------------------
BENCHMARK_MARKER_DO_NOT_CHANGE
----------------------------------------------------------

Go version go version go1.2 linux/amd64

TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         3.63 ns/op
BenchmarkMapLookup	500000000	         3.58 ns/op
BenchmarkNilMapLookup	500000000	         3.23 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.82 ns/op
BenchmarkArrayLookup	2000000000	         0.56 ns/op
BenchmarkTypeToInterface1	2000000000	         0.81 ns/op
BenchmarkTypeToInterface2	2000000000	         0.53 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.27 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.27 ns/op
BenchmarkLockOSThread	500000000	         4.09 ns/op
BenchmarkUnlockOSThread	500000000	         4.53 ns/op
BenchmarkLockUnlockOSThread	200000000	         9.50 ns/op
BenchmarkLockDeferUnlockOSThread	50000000	        59.0 ns/op
BenchmarkUnbufferedChannel	10000000	       253 ns/op
BenchmarkSmallBufferedChannel	 5000000	       308 ns/op
BenchmarkLargeBufferedChannel	 5000000	       309 ns/op
BenchmarkEndpointFastHashShort	100000000	        16.1 ns/op
BenchmarkEndpointFastHashLong	50000000	        34.9 ns/op
BenchmarkFlowFastHashShort	100000000	        22.6 ns/op
BenchmarkFlowFastHashLong	50000000	        62.2 ns/op
ok  	code.google.com/p/gopacket	39.620s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.08 ns/op
BenchmarkLayerClassMapContains	500000000	         3.94 ns/op
BenchmarkLazyNoCopyEthLayer	 2000000	       877 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1362 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2139 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2303 ns/op
BenchmarkDefault	 1000000	      2706 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       230 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       240 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       572 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       574 ns/op
BenchmarkLazy	 1000000	      1108 ns/op
BenchmarkNoCopy	 1000000	      2068 ns/op
BenchmarkLazyNoCopy	 5000000	       471 ns/op
BenchmarkKnownStack	10000000	       177 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       238 ns/op
BenchmarkDecodingLayerParserHandlePanic	 5000000	       299 ns/op
BenchmarkAlloc	50000000	        31.9 ns/op
BenchmarkFlow	50000000	        44.0 ns/op
BenchmarkEndpoints	50000000	        54.3 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        12.0 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        37.6 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	1000000000	         2.98 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.09 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         6.15 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	200000000	         9.76 ns/op
BenchmarkFmtVerboseString	   10000	    173119 ns/op
BenchmarkPacketString	   50000	     58455 ns/op
BenchmarkPacketDumpString	   50000	     58198 ns/op
BenchmarkDecodeICMP	 1000000	      1692 ns/op
BenchmarkDecodeICMP6	 1000000	      1980 ns/op
BenchmarkDecodeMPLS	 1000000	      1867 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2406 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1516 ns/op
ok  	code.google.com/p/gopacket/layers	83.607s

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 949.154065ms, 767ns per packet
Time to read packet data into memory from file: 949.182945ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.764314354s, 1.426us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.518063063s, 1.227us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.56021317s, 1.261us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.602134797s, 1.295us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.604758522s, 1.297us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.583547905s, 1.28us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.561558827s, 1.262us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.640037612s, 1.325us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.757084824s, 1.42us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.675972214s, 1.354us per packet
----------------------------------------------------------
BENCHMARKING AGAINST COMMIT 7556c6c
----------------------------------------------------------

OLD TEST BENCHMARKS
PASS
BenchmarkTypeAssertion	500000000	         4.09 ns/op
BenchmarkMapLookup	500000000	         4.26 ns/op
BenchmarkNilMapLookup	500000000	         3.79 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.94 ns/op
BenchmarkArrayLookup	2000000000	         0.63 ns/op
BenchmarkTypeToInterface1	2000000000	         0.94 ns/op
BenchmarkTypeToInterface2	2000000000	         0.64 ns/op
BenchmarkPassDecodeOptionsByValue	2000000000	         0.31 ns/op
BenchmarkPassDecodeOptionsByPointer	2000000000	         0.31 ns/op
BenchmarkLockOSThread	500000000	         4.80 ns/op
BenchmarkUnlockOSThread	500000000	         5.36 ns/op
BenchmarkLockUnlockOSThread	100000000	        11.0 ns/op
BenchmarkLockDeferUnlockOSThread	50000000	        69.6 ns/op
BenchmarkUnbufferedChannel	10000000	       300 ns/op
BenchmarkSmallBufferedChannel	 5000000	       364 ns/op
BenchmarkLargeBufferedChannel	 5000000	       365 ns/op
BenchmarkEndpointFastHashShort	100000000	        19.1 ns/op
BenchmarkEndpointFastHashLong	50000000	        41.0 ns/op
BenchmarkFlowFastHashShort	100000000	        26.3 ns/op
BenchmarkFlowFastHashLong	50000000	        70.5 ns/op
ok  	code.google.com/p/gopacket	44.046s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.26 ns/op
BenchmarkLayerClassMapContains	500000000	         4.67 ns/op
BenchmarkLazyNoCopyEthLayer	 1000000	      1038 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1645 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      2573 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      2794 ns/op
BenchmarkDefault	 1000000	      3246 ns/op
BenchmarkSerializeTcpNoOptions	10000000	       281 ns/op
BenchmarkSerializeTcpFixLengths	10000000	       289 ns/op
BenchmarkSerializeTcpComputeChecksums	 5000000	       670 ns/op
BenchmarkSerializeTcpFixLengthsComputeChecksums	 5000000	       676 ns/op
BenchmarkLazy	 1000000	      1328 ns/op
BenchmarkNoCopy	 1000000	      2461 ns/op
BenchmarkLazyNoCopy	 5000000	       563 ns/op
BenchmarkKnownStack	10000000	       233 ns/op
BenchmarkDecodingLayerParserIgnorePanic	10000000	       284 ns/op
BenchmarkDecodingLayerParserHandlePanic	 5000000	       359 ns/op
BenchmarkAlloc	50000000	        37.7 ns/op
BenchmarkFlow	50000000	        46.8 ns/op
BenchmarkEndpoints	50000000	        58.4 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        13.7 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        42.0 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	500000000	         3.45 ns/op
BenchmarkDecodeFuncCallOverheadDirectCall	2000000000	         1.27 ns/op
BenchmarkDecodeFuncCallOverheadDecoderCall	500000000	         7.25 ns/op
BenchmarkDecodeFuncCallOverheadArrayCall	100000000	        11.3 ns/op
BenchmarkFmtVerboseString	   10000	    200931 ns/op
BenchmarkPacketString	   50000	     68417 ns/op
BenchmarkPacketDumpString	   50000	     67297 ns/op
BenchmarkDecodeICMP	 1000000	      1930 ns/op
BenchmarkDecodeICMP6	 1000000	      2181 ns/op
BenchmarkDecodeMPLS	 1000000	      2144 ns/op
BenchmarkDecodePPPoE_ICMPv6	 1000000	      2754 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1658 ns/op
ok  	code.google.com/p/gopacket/layers	91.764s

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 925.00163ms, 747ns per packet
Time to read packet data into memory from file: 925.030333ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.865679504s, 1.508us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.767544157s, 1.428us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.806912137s, 1.46us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.824212874s, 1.474us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.845799292s, 1.492us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.84048428s, 1.487us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.834548144s, 1.482us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.827650238s, 1.477us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.83048333s, 1.479us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.878186782s, 1.518us per packet
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载