Commit eb178d1
committed
Enable custom prefix command from env var
I setup my machine with the kernel options to isolate a cpu
and then I have a custom script that writes to the necessary files,
and I have NOPASSWD sudo commands setup for the commands in that file.
Then I can set this env var to that script and it runs
benchmarks specifically configured for my machine with no sudo prompt.
Example script:
#!/bin/bash
# sudoers
# rwstauner ALL= NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/intel_pstate/no_turbo
# rwstauner ALL= NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
# rwstauner ALL= NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/cpu*/online
# rwstauner ALL= NOPASSWD: /usr/bin/renice
# NOTE: add `isolcpus=10,11 nohz_full=10,11` to the options line in /boot/loader conf
cpu=10
sibling=11
sudo () {
command sudo --bell "$@"
}
teardown () {
echo 0 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
echo 8 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
echo 1 | sudo tee /sys/devices/system/cpu/cpu$sibling/online
}
setup () {
echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
echo 100 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
echo 0 | sudo tee /sys/devices/system/cpu/cpu$sibling/online
}
setup > /dev/null
trap 'teardown > /dev/null' EXIT
setarch x86_64 -R taskset -c $cpu sh -c 'sudo renice -n -15 "$$" > /dev/null; exec "$@"' - "$@"1 parent e73823e commit eb178d1
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
| |||
0 commit comments