nginx-profile-setup/kaproxy/run.sh
Ava Hahn 78baa850a8 fixes for worker process profiling
Signed-off-by: Ava Hahn <a.hahn@f5.com>
2025-09-18 00:04:23 +00:00

47 lines
1 KiB
Bash
Executable file

#!/bin/bash
function p_invoke() {
valgrind --tool=callgrind \
--trace-children=yes \
--callgrind-out-file=/tmp/callgrind.out.%p \
--cache-sim=yes \
--instr-atstart=no \
/nginx/objs/nginx \
-e /tmp/error.log \
-c /nginx.conf \
-g "daemon off;"
}
function invoke() {
/nginx/objs/nginx \
-e /tmp/error.log \
-c /nginx.conf \
-g "daemon off;" \
$@
}
function sigint_handler() {
echo "sigint received. trigger again to kill."
invoke -s quit
trap - INT
}
function sigcont_handler() {
echo "sigcont received. reloading nginx."
invoke -s reload
}
trap 'sigint_handler' INT
trap 'sigcont_handler' CONT
# enable tracing
echo 1 > /proc/sys/kernel/yama/ptrace_scope
p_invoke &
wait
echo "NGINX down. waiting to find it again"
sleep 0.5
wait $(cat /tmp/pid)
echo "NGINX is GONE. waiting until signalled"
sleep infinity