bheisler / iai

Experimental one-shot benchmarking/profiling harness for Rust
Apache License 2.0
563 stars 35 forks source link

setarch not working in docker #12

Open exastion opened 3 years ago

exastion commented 3 years ago

In an unprivileged Docker container, setarch is not allowed to run. From #9 it seems setarch isn't the best tool anyway.

extrawurst commented 3 years ago

I am running into the same issue. I was hoping to be able to use iai in my ci like advertised in the readme but I guess it does not work because gitlab ci uses docker containers to run the CI in :(

extrawurst commented 3 years ago

@exastion what would be an alternative to setarch? the freebsd solution does not work for other linux distros, right?

exastion commented 3 years ago

@extrawurst I haven't looked into it further.

I guess one solution would be to put ASLR disabling behind a feature flag, so that setarch could be skipped for CI builds.

bheisler commented 3 years ago

Hey, thanks for the bug report, and thanks for the patience.

Yeah, I didn't know setarch was so restricted. Disabling ASLR is helpful for stability of the measurements. Unfortunately, it sounds as if it's not possible to disable it in docker, so having some option to prevent Iai from trying to enable it is probably necessary.

bheisler commented 3 years ago

I've pushed a version to the main branch that adds an environment variable (IAI_ALLOW_ASLR) that you can set. I'm not really sure an environment variable is the right way to configure this, but this is much lighter-weight than bringing in a CLI parsing library like clap. I was kinda hoping I could get away with not needing configuration of any sort in Iai. Anyway, let me know if this works for you folks.

extrawurst commented 3 years ago

@bheisler I finally had time to check this out: it works like a charm! lets have a release please :) it is part of my CI now: https://github.com/extrawurst/ip2country