Skip to content

Commit 18c8dbe

Browse files
marc-casavantCopilot
andcommitted
misc updates addressing PR review
Co-authored-by: Copilot <copilot@github.com>
1 parent cdecd02 commit 18c8dbe

9 files changed

Lines changed: 86 additions & 16 deletions

File tree

scripts/docker/build/ubuntu24/Dockerfile.cb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ RUN apt-get update && \
5252
apt-get clean && \
5353
rm -r /var/lib/apt/lists/*
5454

55+
#
56+
# Set up Ubuntu debug symbol repository and install OS library debug symbols.
57+
# These allow callgrind/valgrind to resolve system library calls (glibc,
58+
# OpenSSL, talloc, etc.) to named symbols instead of hex addresses.
59+
#
60+
RUN apt-get update && \
61+
apt-get install $APT_OPTS ubuntu-dbgsym-keyring && \
62+
printf 'deb http://ddebs.ubuntu.com noble main restricted universe multiverse\ndeb http://ddebs.ubuntu.com noble-updates main restricted universe multiverse\n' \
63+
> /etc/apt/sources.list.d/ddebs.list && \
64+
apt-get update && \
65+
apt-get install $APT_OPTS \
66+
libc6-dbg \
67+
libssl3t64-dbgsym \
68+
libtalloc2-dbgsym \
69+
libpcre2-8-0-dbgsym \
70+
libsqlite3-0-dbgsym && \
71+
apt-get clean && \
72+
rm -r /var/lib/apt/lists/*
73+
5574
#
5675
# Install FlameGraph scripts
5776
#
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Auto generated for ubuntu24
2+
# from scripts/docker/m4/profiling.deb.m4
3+
#
4+
# Rebuild this file with `make profiling.ubuntu24.regen`
5+
#
6+
ARG from=freeradius40x-build/ubuntu24
7+
FROM ${from}
8+
9+
# Copy profiling profile scripts into the container
10+
COPY scripts/docker/profiling/profiles/default-profiling /profile
11+
12+
RUN /profile/configure.sh
13+
RUN make
14+
RUN make install
15+
16+
# Mirror the package image: both binary names and both config dir paths work
17+
RUN ln -s /usr/local/sbin/radiusd /usr/local/sbin/freeradius
18+
RUN ln -s /etc/freeradius/radiusd.conf /etc/freeradius/freeradius.conf
19+
RUN ln -s /etc/freeradius /etc/raddb
20+
21+
WORKDIR /
22+
COPY scripts/docker/etc/docker-entrypoint.sh.deb docker-entrypoint.sh
23+
RUN chmod +x docker-entrypoint.sh
24+
25+
EXPOSE 1812/udp 1813/udp
26+
ENTRYPOINT ["/docker-entrypoint.sh"]
27+
CMD ["/profile/start.sh"]

scripts/docker/crossbuild.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ DD:=$(CB_DIR)/crossbuild
2626
DOCKER_TMPL:=$(CB_DIR)/m4/Dockerfile.m4
2727

2828
# List of all the docker images (sorted for "crossbuild.info")
29-
CB_IMAGES := $(sort $(filter-out profiling,\
30-
$(patsubst $(DT)/%/,%,$(wildcard $(DT)/*/))))
29+
CB_IMAGES:=$(sort $(patsubst $(DT)/%,%,$(wildcard $(DT)/*)))
3130

3231
# Location of the .git dir (may be different for e.g. submodules)
3332
GITDIR:=$(shell perl -MCwd -e 'print Cwd::abs_path shift' $$(git rev-parse --git-dir))
@@ -41,7 +40,13 @@ endif
4140
CB_IPREFIX:=freeradius40x-build
4241
CB_CPREFIX:=fr40x-crossbuild-
4342

44-
PROFILE ?= profiling1
43+
PROFILE ?= default-profiling
44+
45+
# Where profiling profiles live
46+
PROFILES_DIR:=$(CB_DIR)/profiling/profiles
47+
48+
# All available profiling profiles (one sub-directory per profile)
49+
CB_PROFILES:=$(sort $(patsubst $(PROFILES_DIR)/%,%,$(wildcard $(PROFILES_DIR)/*)))
4550

4651
#
4752
# This Makefile is included in-line, and not via the "boilermake"
@@ -99,11 +104,6 @@ crossbuild.help: crossbuild.info
99104
@echo " crossbuild.IMAGE.profbuild - build profiling image using default profile ($(PROFILE))"
100105
@echo " crossbuild.IMAGE.profreset - remove profiling stamp and Dockerfile.prof to force rebuild"
101106
@echo ""
102-
@echo "Available profiling profiles (scripts/docker/profiling/profiles/):"
103-
@echo " profiling1 - callgrind call graph and instruction profiling"
104-
@echo " profiling2 - FUTURE: e.g. massif heap memory profiling"
105-
@echo " profiling3 - FUTURE: e.g. gperftools CPU profiling"
106-
@echo ""
107107
@echo "Use 'make NOCACHE=1 ...' to disregard the Docker cache on build"
108108

109109
#

scripts/docker/docker.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ DT:=$(CB_DIR)/build
2222
DOCKER_TMPL:=$(CB_DIR)/m4/Dockerfile.m4
2323

2424
# List of all the docker images (sorted for "docker.info")
25-
IMAGES:=$(sort $(filter-out profiling,$(patsubst $(DT)/%,%,$(wildcard $(DT)/*))))
25+
IMAGES:=$(sort $(patsubst $(DT)/%,%,$(wildcard $(DT)/*)))
2626

2727
# Don't use the Docker cache if asked
2828
ifneq "$(NOCACHE)" ""

scripts/docker/m4/profiling.deb.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ ARG from=CB_IMAGE
22
FROM ${from}
33

44
# Copy profiling profile scripts into the container
5-
COPY scripts/docker/profiling/profiles/PROFILE_NAME /profiling
5+
COPY scripts/docker/profiling/profiles/PROFILE_NAME /profile
66

7-
RUN /profiling/configure.sh
7+
RUN /profile/configure.sh
88
RUN make
99
RUN make install
1010

@@ -19,4 +19,4 @@ RUN chmod +x docker-entrypoint.sh
1919

2020
EXPOSE 1812/udp 1813/udp
2121
ENTRYPOINT ["/docker-entrypoint.sh"]
22-
CMD ["/profiling/start.sh"]
22+
CMD ["/profile/start.sh"]

scripts/docker/m4/profiling.rpm.m4

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@ ARG from=CB_IMAGE
22
FROM ${from}
33

44
# Copy profiling profile scripts into the container
5-
COPY scripts/docker/profiling/profiles/PROFILE_NAME /profiling
5+
COPY scripts/docker/profiling/profiles/PROFILE_NAME /profile
66

7-
RUN /profiling/configure.sh
7+
RUN /profile/configure.sh
88
RUN make
99
RUN make install
1010

11-
# Make sure freeradius can also be used to run server
11+
# Mirror the package image: both binary names and both config dir paths work
1212
RUN ln -s /usr/local/sbin/radiusd /usr/local/sbin/freeradius
13+
RUN ln -s /etc/freeradius/radiusd.conf /etc/freeradius/freeradius.conf
14+
RUN ln -s /etc/freeradius /etc/raddb
1315

1416
WORKDIR /
1517
COPY scripts/docker/etc/docker-entrypoint.sh.PKG_TYPE docker-entrypoint.sh
1618
RUN chmod +x docker-entrypoint.sh
1719

1820
EXPOSE 1812/udp 1813/udp
1921
ENTRYPOINT ["/docker-entrypoint.sh"]
20-
CMD ["/profiling/start.sh"]
22+
CMD ["/profile/start.sh"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Vallgrind/Callgrind profiling with:
2+
- cache and branch simulation
3+
- per-thread output
4+
- instruction-level detail
5+
6+
Builds with debug symbols and reduced optimisation (-g3 -O1) so that
7+
callgrind output can be annotated back to source lines.
8+
9+
Server is run under valgrind with the following options (start.sh):
10+
11+
--cache-sim=yes Simulate L1/LL cache behaviour (I1, D1, LL miss counts)
12+
--branch-sim=yes Simulate branch prediction (Bc/Bcm, Bi/Bim counts)
13+
--dump-instr=yes Collect per-instruction costs (required for source annotation)
14+
--collect-jumps=yes Record conditional and indirect jump targets
15+
--trace-children=yes Follow forked child processes into valgrind
16+
--separate-threads=yes Write a separate callgrind.out.<pid>-<tid> file per thread
17+
18+
Configure flags (configure.sh):
19+
-g3 -O1 -fno-omit-frame-pointer
20+
21+
Use this profile as the baseline for call-graph and cache-miss analysis with
22+
kcachegrind / qcachegrind.

scripts/docker/profiling/profiles/profiling1/configure.sh renamed to scripts/docker/profiling/profiles/default-profiling/configure.sh

File renamed without changes.

scripts/docker/profiling/profiles/profiling1/start.sh renamed to scripts/docker/profiling/profiles/default-profiling/start.sh

File renamed without changes.

0 commit comments

Comments
 (0)