mirror of
https://github.com/sched-ext/scx.git
synced 2024-11-22 10:51:49 +00:00
enable bpftrace when using stress tests (#688)
* enable bpftrace when using stress tests update meson/stress test runner to enable running bpftrace scripts while running stress tests. * disable layered stats output on ci
This commit is contained in:
parent
f9b39244cc
commit
2282a0af37
@ -48,6 +48,8 @@ def run_stress_test(
|
||||
timeout_sec = int(config.get("timeout_sec"))
|
||||
if vng_path:
|
||||
vm_input = f"{stress_cmd} & timeout --foreground --preserve-status {timeout_sec} {sched_cmd}"
|
||||
if bpftrace_scripts := config.get('bpftrace_scripts'):
|
||||
vm_input = f"\"{build_dir}/bpftrace_stress_wrapper.sh\" '{stress_cmd}' '{sched_cmd}' '{timeout_sec}' '{bpftrace_scripts}'"
|
||||
cmd = [vng_path, "--user", "root", "-v", "--", vm_input]
|
||||
err = sys.stderr if output == "-" else open(output, "w")
|
||||
out = sys.stdout if output == "-" else err
|
||||
|
@ -21,3 +21,10 @@ sched: scx_bpfland
|
||||
sched_args:
|
||||
stress_cmd: stress-ng -t 14 --aggressive -M -c `nproc` -f `nproc`
|
||||
timeout_sec: 15
|
||||
|
||||
[scx_layered]
|
||||
sched: scx_layered
|
||||
sched_args: --run-example
|
||||
stress_cmd: stress-ng -t 14 --aggressive -M -c `nproc` -f `nproc`
|
||||
timeout_sec: 15
|
||||
bpftrace_scripts: dsq_lat.bt,process_runqlat.bt
|
||||
|
27
meson.build
27
meson.build
@ -383,11 +383,34 @@ run_target('veristat_diff', command: [run_veristat_diff, meson.current_build_dir
|
||||
get_option('veristat_diff_dir')])
|
||||
|
||||
if enable_stress
|
||||
# not sure there's a better way
|
||||
# only different...
|
||||
copys = [
|
||||
custom_target('copy stress wrapper',
|
||||
input : 'scripts/bpftrace_stress_wrapper.sh',
|
||||
output : 'bpftrace_stress_wrapper.sh',
|
||||
command : ['cp', '-a', '@INPUT@', '@OUTPUT@'],
|
||||
install : false,
|
||||
build_by_default : true),
|
||||
custom_target('copy dsq_lat',
|
||||
input : 'scripts/dsq_lat.bt',
|
||||
output : 'dsq_lat.bt',
|
||||
command : ['cp', '-a', '@INPUT@', '@OUTPUT@'],
|
||||
install : false,
|
||||
build_by_default : true),
|
||||
custom_target('copy runq_lat',
|
||||
input : 'scripts/process_runqlat.bt',
|
||||
output : 'process_runqlat.bt',
|
||||
command : ['cp', '-a', '@INPUT@', '@OUTPUT@'],
|
||||
install : false,
|
||||
build_by_default : true)
|
||||
]
|
||||
|
||||
run_target('stress_tests', command: [run_stress_tests, '-k', kernel, '-b',
|
||||
meson.current_build_dir()])
|
||||
meson.current_build_dir()], depends: [copys])
|
||||
foreach s : rust_scheds
|
||||
run_target('stress_tests_'+s, command: [run_stress_tests, '-k', kernel, '-b',
|
||||
meson.current_build_dir(), '--sched', s])
|
||||
meson.current_build_dir(), '--sched', s], depends: [copys])
|
||||
endforeach
|
||||
endif
|
||||
|
||||
|
36
scripts/bpftrace_stress_wrapper.sh
Executable file
36
scripts/bpftrace_stress_wrapper.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
STRESS_CMD="$1"
|
||||
SCHED_CMD="$2"
|
||||
TIMEOUT_SEC="$3"
|
||||
BPFTRACE_SCRIPTS="$4"
|
||||
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
for a in $(echo "$BPFTRACE_SCRIPTS" | tr ',' ' '); do
|
||||
bpftrace "$SCRIPT_DIR/$a" > "$(basename a).txt" 2>&1 &
|
||||
done
|
||||
|
||||
$STRESS_CMD > stress_cmd.txt 2>&1 &
|
||||
|
||||
STRESS_PID=$!
|
||||
|
||||
timeout --foreground --preserve-status $TIMEOUT_SEC $SCHED_CMD > sched_output.txt 2>&1 &
|
||||
|
||||
STATUS_PID=$!
|
||||
|
||||
tail --pid=$STATUS_PID -f sched_output.txt
|
||||
|
||||
for a in $(echo "$BPFTRACE_SCRIPTS" | tr ',' ' '); do
|
||||
echo "$a OUTPUT"
|
||||
cat "$(basename a).txt"
|
||||
echo "$a OUTPUT DONE"
|
||||
done
|
||||
|
||||
echo "STRESS OUTPUT"
|
||||
cat stress_cmd.txt
|
||||
echo "STRESS OUTPUT DONE"
|
||||
|
||||
# if anything isn't right, exit non 0 so we know.
|
||||
wait $STRESS_PID
|
||||
wait $STATUS_PID
|
Loading…
Reference in New Issue
Block a user