Created
August 19, 2015 17:48
-
-
Save lukego/ad881364acb67c39d732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local C = ffi.C | |
local pmu = require("lib.pmu") | |
require("lib.checksum") | |
-- Use /etc/passwd contents as a dummy packet | |
local data = core.lib.readfile("/etc/passwd", "*all") | |
local ptr = ffi.cast("unsigned char *", data), #data | |
local len = #data | |
local loops = 100000 | |
print("loops: ", loops, "#data:", #data) | |
local function profile (name, ipsum) | |
print("profiling: " .. name) | |
pmu.profile(function () | |
for i = 1, loops do | |
ipsum(ptr, len, 0) | |
end | |
end, | |
{"mem_load_uops_retired.l._hit", | |
"mem_load_uops_retired.l3_miss"}, | |
{packet=loops, byte=loops*len}) | |
end | |
profile("generic", C.cksum_generic) | |
profile("sse2", C.cksum_sse2) | |
profile("avx2", C.cksum_avx2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
profiling: generic | |
EVENT TOTAL /byte /packet | |
instructions 420,255,210 2.918 4202.552 | |
cycles 429,483,566 2.983 4294.836 | |
ref-cycles 429,483,552 2.983 4294.836 | |
mem_load_uops_retired.l1_hit 271,618,029 1.886 2716.180 | |
mem_load_uops_retired.l2_hit 173 0.000 0.002 | |
mem_load_uops_retired.l3_hit 229 0.000 0.002 | |
mem_load_uops_retired.l3_miss 60 0.000 0.001 | |
byte 144,000,000 1.000 1440.000 | |
packet 100,000 0.001 1.000 | |
profiling: sse2 | |
EVENT TOTAL /byte /packet | |
instructions 116,882,789 0.812 1168.828 | |
cycles 32,942,396 0.229 329.424 | |
ref-cycles 32,942,400 0.229 329.424 | |
mem_load_uops_retired.l1_hit 11,508,798 0.080 115.088 | |
mem_load_uops_retired.l2_hit 65 0.000 0.001 | |
mem_load_uops_retired.l3_hit 157 0.000 0.002 | |
mem_load_uops_retired.l3_miss 1 0.000 0.000 | |
byte 144,000,000 1.000 1440.000 | |
packet 100,000 0.001 1.000 | |
profiling: avx2 | |
EVENT TOTAL /byte /packet | |
instructions 56,773,023 0.394 567.730 | |
cycles 16,444,852 0.114 164.449 | |
ref-cycles 16,444,848 0.114 164.448 | |
mem_load_uops_retired.l1_hit 6,910,824 0.048 69.108 | |
mem_load_uops_retired.l2_hit 107 0.000 0.001 | |
mem_load_uops_retired.l3_hit 100 0.000 0.001 | |
mem_load_uops_retired.l3_miss 0 0.000 0.000 | |
byte 144,000,000 1.000 1440.000 | |
packet 100,000 0.001 1.000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment