Skip to content

Commit 0250674

Browse files
committed
New profiling image build option
1 parent 11b8427 commit 0250674

66 files changed

Lines changed: 1205 additions & 2974 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/ci/kafka-subscribe.sh

Lines changed: 0 additions & 73 deletions
This file was deleted.

scripts/ci/kafka-wait-and-cleanup.sh

Lines changed: 0 additions & 101 deletions
This file was deleted.

scripts/docker/build/ubuntu24/Dockerfile.cb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,15 @@ RUN git clone --depth 1 --no-single-branch ${source}
8181

8282
#
8383
# Install build dependencies for all branches from v4 onwards
84+
# Debian sid fails if debian/control doesn't exist due to an issue
85+
# in one of the included make files, so we create a blank file.
8486
#
8587
WORKDIR freeradius-server
8688
RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^(v[4-9]*\.[0-9x]*\.x|master|${branch})$" | sort -u); \
8789
do \
8890
git checkout $i; \
8991
if [ -e ./debian/control.in ] ; then \
92+
touch -t 202001010000 debian/control; \
9093
debian/rules debian/control ; \
9194
fi ; \
9295
mk-build-deps -irt"apt-get -o Debug::pkgProblemResolver=yes $APT_OPTS" debian/control ; \
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
#
13+
# Install profiling tools
14+
#
15+
RUN apt-get update && \
16+
apt-get install -y $APT_OPTS \
17+
libgoogle-perftools-dev \
18+
google-perftools \
19+
valgrind \
20+
heaptrack \
21+
psmisc \
22+
kcachegrind \
23+
kio \
24+
libkf5iconthemes5 \
25+
libkf5parts5 \
26+
libkf5textwidgets5 \
27+
libqt5gui5 \
28+
libqt5widgets5 && \
29+
apt-get clean && \
30+
rm -r /var/lib/apt/lists/*
31+
32+
#
33+
# Set up Ubuntu debug symbol repository and install OS library debug symbols.
34+
# These allow callgrind/valgrind to resolve system library calls (glibc,
35+
# OpenSSL, talloc, etc.) to named symbols instead of hex addresses.
36+
#
37+
RUN apt-get update && \
38+
apt-get install -y $APT_OPTS ubuntu-dbgsym-keyring && \
39+
printf 'deb http://ddebs.ubuntu.com noble main restricted universe multiverse\ndeb http://ddebs.ubuntu.com noble-updates main restricted universe multiverse\n' \
40+
> /etc/apt/sources.list.d/ddebs.list && \
41+
apt-get update && \
42+
apt-get install -y $APT_OPTS \
43+
libc6-dbg \
44+
libssl3t64-dbgsym \
45+
libtalloc2-dbgsym \
46+
libpcre2-8-0-dbgsym \
47+
libsqlite3-0-dbgsym && \
48+
apt-get clean && \
49+
rm -r /var/lib/apt/lists/*
50+
51+
#
52+
# Install FlameGraph scripts
53+
#
54+
RUN git clone --depth 1 https://github.com/brendangregg/FlameGraph /opt/flamegraph \
55+
&& chmod +x /opt/flamegraph/*.pl /opt/flamegraph/*.sh
56+
57+
ENV PATH="/opt/flamegraph:${PATH}"
58+
59+
EXPOSE 1812/udp 1813/udp
60+
CMD ["/bin/sh", "-c", "while true; do sleep 60; done"]

scripts/docker/crossbuild.mk

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ endif
4040
CB_IPREFIX:=freeradius40x-build
4141
CB_CPREFIX:=fr40x-crossbuild-
4242

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)/*)))
50+
4351
#
4452
# This Makefile is included in-line, and not via the "boilermake"
4553
# wrapper. But it's still useful to use the same process for
@@ -90,6 +98,12 @@ crossbuild.help: crossbuild.info
9098
@echo " crossbuild.IMAGE.clean - stop container and tidy up"
9199
@echo " crossbuild.IMAGE.wipe - remove Docker image"
92100
@echo ""
101+
@echo "Profiling targets:"
102+
@echo " crossbuild.IMAGE.profile.regen - regenerate Dockerfile.prof using default profile ($(PROFILE))"
103+
@echo " crossbuild.IMAGE.profile.regen PROFILE=<name> - regenerate using a specific profile"
104+
@echo " crossbuild.IMAGE.profile.build - build profiling image using default profile ($(PROFILE))"
105+
@echo " crossbuild.IMAGE.profile.reset - remove profiling stamp to force rebuild"
106+
@echo ""
93107
@echo "Use 'make NOCACHE=1 ...' to disregard the Docker cache on build"
94108

95109
#
@@ -140,6 +154,20 @@ $(DD)/stamp-image.${1}:
140154
${Q}docker build $(DOCKER_BUILD_OPTS) $(DT)/${1} -f $(DT)/${1}/Dockerfile.cb -t $(CB_IPREFIX)/${1} >$(DD)/build.${1} 2>&1
141155
${Q}touch $(DD)/stamp-image.${1}
142156

157+
#
158+
# Build the profiling image
159+
#
160+
.PHONY: crossbuild.${1}.profile.build
161+
crossbuild.${1}.profile.build: $(DD)/stamp-image.${1}-profile.build
162+
163+
$(DD)/stamp-image.${1}-profile.build: $(DT)/${1}/Dockerfile.prof
164+
${Q}echo "BUILD ${1} (freeradius4-$(PROFILE)/${1}) > $(DD)/build.${1}-profile.build"
165+
${Q}docker build $(DOCKER_BUILD_OPTS) . \
166+
-f $(DT)/${1}/Dockerfile.prof \
167+
-t freeradius4-$(PROFILE)/${1} \
168+
>$(DD)/build.${1}-profile.build 2>&1
169+
${Q}touch $(DD)/stamp-image.${1}-profile.build
170+
143171
#
144172
# Start up the docker container
145173
#
@@ -249,6 +277,29 @@ $(DT)/${1}/Dockerfile.cb: $(DOCKER_TMPL) $(CB_DIR)/m4/crossbuild.deb.m4 $(CB_DIR
249277
${Q}echo REGEN ${1}
250278
${Q}m4 -I $(CB_DIR)/m4 -D D_NAME=${1} -D D_TYPE=crossbuild $$< > $$@
251279

280+
#
281+
# Regenerate Dockerfile.prof from m4 template
282+
#
283+
.PHONY: crossbuild.${1}.profile.regen
284+
crossbuild.${1}.profile.regen: $(DT)/${1}/Dockerfile.prof
285+
286+
$(DT)/${1}/Dockerfile.prof: $(DOCKER_TMPL) $(CB_DIR)/m4/profiling.deb.m4
287+
${Q}echo REGEN ${1}
288+
${Q}m4 -I $(CB_DIR)/m4 \
289+
-D D_NAME=${1} \
290+
-D D_TYPE=profiling \
291+
-D CB_IMAGE=$(CB_IPREFIX)/${1} \
292+
-D PROFILE_NAME=$(PROFILE) \
293+
$$< > $$@
294+
295+
#
296+
# Remove profiling stamp so next profile.build starts clean
297+
#
298+
.PHONY: crossbuild.${1}.profile.reset
299+
crossbuild.${1}.profile.reset:
300+
${Q}echo RESET profiling ${1}
301+
${Q}rm -f $(DD)/stamp-image.${1}-profile.build
302+
252303
#
253304
# Run the build test
254305
#

scripts/docker/m4/profiling.deb.m4

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
ARG from=CB_IMAGE
2+
FROM ${from}
3+
4+
# Copy profiling profile scripts into the container
5+
COPY scripts/docker/profiling/profiles/PROFILE_NAME /profile
6+
7+
#
8+
# Install profiling tools
9+
#
10+
RUN apt-get update && \
11+
apt-get install -y $APT_OPTS \
12+
libgoogle-perftools-dev \
13+
google-perftools \
14+
valgrind \
15+
heaptrack \
16+
psmisc \
17+
kcachegrind \
18+
kio \
19+
libkf5iconthemes5 \
20+
libkf5parts5 \
21+
libkf5textwidgets5 \
22+
libqt5gui5 \
23+
libqt5widgets5 && \
24+
apt-get clean && \
25+
rm -r /var/lib/apt/lists/*
26+
27+
#
28+
# Set up Ubuntu debug symbol repository and install OS library debug symbols.
29+
# These allow callgrind/valgrind to resolve system library calls (glibc,
30+
# OpenSSL, talloc, etc.) to named symbols instead of hex addresses.
31+
#
32+
RUN apt-get update && \
33+
apt-get install -y $APT_OPTS ubuntu-dbgsym-keyring && \
34+
printf 'deb http://ddebs.ubuntu.com OS_CODENAME main restricted universe multiverse\ndeb http://ddebs.ubuntu.com OS_CODENAME-updates main restricted universe multiverse\n' \
35+
> /etc/apt/sources.list.d/ddebs.list && \
36+
apt-get update && \
37+
apt-get install -y $APT_OPTS \
38+
libc6-dbg \
39+
libssl3t64-dbgsym \
40+
libtalloc2-dbgsym \
41+
libpcre2-8-0-dbgsym \
42+
libsqlite3-0-dbgsym && \
43+
apt-get clean && \
44+
rm -r /var/lib/apt/lists/*
45+
46+
#
47+
# Install FlameGraph scripts
48+
#
49+
RUN git clone --depth 1 https://github.com/brendangregg/FlameGraph /opt/flamegraph \
50+
&& chmod +x /opt/flamegraph/*.pl /opt/flamegraph/*.sh
51+
52+
ENV PATH="/opt/flamegraph:${PATH}"
53+
54+
EXPOSE 1812/udp 1813/udp
55+
CMD ["/bin/sh", "-c", "while true; do sleep 60; done"]

0 commit comments

Comments
 (0)