use perf instead of gprof

Signed-off-by: Ava Hahn <a.hahn@f5.com>
This commit is contained in:
Ava Hahn 2025-08-18 05:01:37 +00:00
parent ce3844ef4e
commit 8924f2ef22
3 changed files with 13 additions and 3 deletions

View file

@ -58,6 +58,7 @@ services:
platforms: platforms:
- linux/x86_64 - linux/x86_64
platform: linux/x86_64 platform: linux/x86_64
privileged: true
ports: ports:
- 8079:8080 - 8079:8080
networks: networks:

View file

@ -2,13 +2,13 @@ FROM archlinux:latest
EXPOSE 8080 EXPOSE 8080
RUN pacman -Syyu --noconfirm RUN pacman -Syyu --noconfirm
RUN pacman -S base-devel glibc gcc-libs --noconfirm RUN pacman -S base-devel glibc gcc-libs perf --noconfirm
COPY nginx /nginx COPY nginx /nginx
WORKDIR /nginx WORKDIR /nginx
RUN auto/configure \ RUN auto/configure \
--with-debug \ --with-debug \
--with-http_ssl_module \ --with-http_ssl_module \
--with-cc-opt=-pg --with-cc-opt="-ggdb -fno-omit-frame-pointer"
RUN make RUN make
RUN make install RUN make install
COPY nginx.conf / COPY nginx.conf /

View file

@ -1,5 +1,14 @@
#!/bin/bash #!/bin/bash
function p_invoke() {
perf record -F1000 --call-graph dwarf -o /perf.data \
-- /nginx/objs/nginx \
-p /tmp \
-e /tmp/error.log \
-c /nginx.conf \
-g "daemon off;"
}
function invoke() { function invoke() {
/nginx/objs/nginx \ /nginx/objs/nginx \
-p /tmp \ -p /tmp \
@ -23,7 +32,7 @@ function sigcont_handler() {
trap 'sigint_handler' INT trap 'sigint_handler' INT
trap 'sigcont_handler' CONT trap 'sigcont_handler' CONT
invoke & p_invoke &
wait wait
echo "NGINX down. waiting until signalled..." echo "NGINX down. waiting until signalled..."
sleep infinity sleep infinity