packagemainimport("runtime""testing""github.com/windasunny/ddos/packet")// Benchmark for the first udp code (using gopacket)
funcBenchmarkGopacket(b*testing.B){b.ReportAllocs()fori:=0;i<b.N;i++{packet.Udp()}varmemStatsruntime.MemStatsruntime.ReadMemStats(&memStats)}// Benchmark for the second udp code (using unix)
funcBenchmarkUnixUDP(b*testing.B){b.ReportAllocs()fori:=0;i<b.N;i++{packet.SysUdp()}varmemStatsruntime.MemStatsruntime.ReadMemStats(&memStats)}