Skip to content

Commit 84fbd20

Browse files
WIP: moved profile-callgrind.sh to scripts/profiling
1 parent 2d0b9a8 commit 84fbd20

3 files changed

Lines changed: 299 additions & 119 deletions

File tree

scripts/osx/README.md

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -50,113 +50,3 @@ The information below is for future reference.
5050
cp ./org.freeradius.radius.plist /Library/LaunchDaemons
5151
launchctl load -w Library/LaunchDaemons/org.freeradius.radiusd.plist
5252
```
53-
54-
Examples:
55-
56-
Reconfigure + rebuild + profile in one run:
57-
```
58-
scripts/osx/profile-callgrind.sh \
59-
--clean \
60-
--cflags "-g3 -O1 -fno-omit-frame-pointer" \
61-
--ldflags "-fno-omit-frame-pointer" \
62-
--jobs 16 \
63-
--run-seconds 60
64-
```
65-
66-
Configure and build, no profiling run
67-
```
68-
scripts/osx/profile-callgrind.sh \
69-
--clean \
70-
--build-only \
71-
--cflags "-g3 -O1 -fno-omit-frame-pointer" \
72-
--ldflags "-fno-omit-frame-pointer" \
73-
--jobs 16
74-
```
75-
76-
Build first, then run profiling as a separate step:
77-
```
78-
scripts/osx/profile-callgrind.sh \
79-
--clean \
80-
--build-only \
81-
--cflags "-g3 -O1 -fno-omit-frame-pointer" \
82-
--ldflags "-fno-omit-frame-pointer" \
83-
--jobs 16
84-
85-
scripts/osx/profile-callgrind.sh \
86-
--profile-only \
87-
--env-file build/tests/multi-server/prof-accept/short_ci/freeradius/profiling-server/proto_load_config.env \
88-
--reset-radiusd-args \
89-
--radiusd-arg -f \
90-
--radiusd-arg -m \
91-
--radiusd-arg -l \
92-
--radiusd-arg stdout \
93-
--radiusd-conf-file raddb/radiusd.conf \
94-
--run-seconds 60
95-
```
96-
97-
Profile-only run using an explicit env file:
98-
```
99-
scripts/osx/profile-callgrind.sh \
100-
--profile-only \
101-
--env-file build/tests/multi-server/prof-accept/short_ci/freeradius/profiling-server/proto_load_config.env \
102-
--reset-radiusd-args \
103-
--radiusd-arg -f \
104-
--radiusd-arg -m \
105-
--radiusd-arg -l \
106-
--radiusd-arg stdout \
107-
--radiusd-conf-file raddb/radiusd.conf \
108-
--run-seconds 60
109-
```
110-
111-
Profile-only run using the auto-detected default env file:
112-
```
113-
scripts/osx/profile-callgrind.sh \
114-
--profile-only \
115-
--reset-radiusd-args \
116-
--radiusd-arg -f \
117-
--radiusd-arg -m \
118-
--radiusd-arg -l \
119-
--radiusd-arg stdout \
120-
--radiusd-conf-file raddb/radiusd.conf \
121-
--run-seconds 60
122-
```
123-
124-
The `--env-file` argument is optional. If you omit it, `profile-callgrind.sh` automatically sources `build/tests/multi-server/prof-accept/short_ci/freeradius/profiling-server/proto_load_config.env` when that file exists.
125-
126-
Argument reference for the profile-only command:
127-
128-
- `--profile-only` skips configure and build steps and only runs the profiling phase.
129-
- `--env-file <path>` sources an environment file before starting `radiusd`. This is mainly used to export `TEST_LOADGEN_*` variables for the `listen load` section in `raddb/radiusd.conf`.
130-
- `--reset-radiusd-args` clears the script's default `radiusd` arguments before any later `--radiusd-arg` values are appended.
131-
- `--radiusd-arg -f` keeps `radiusd` in the foreground so valgrind can monitor the live server process directly.
132-
- `--radiusd-arg -m` enables the runtime behavior you were already using in the wrapper-based runs. If you omit it after `--reset-radiusd-args`, it will not be added automatically.
133-
- `--radiusd-arg -l` and `--radiusd-arg stdout` send server log output to standard output.
134-
- `--radiusd-conf-file raddb/radiusd.conf` appends `-d <confdir> -n <name>` for that config file. In this case it tells `radiusd` to use the repository's `raddb/radiusd.conf` profile.
135-
- `--run-seconds 60` runs the callgrind session for 60 seconds, then stops the profiled valgrind processes and writes the final callgrind output.
136-
137-
Behavior notes:
138-
139-
- The script launches the `scripts/bin/radiusd` wrapper by default, not `build/bin/local/radiusd` directly.
140-
- The wrapper supplies the repository-local dictionary and library setup, while the profile script adds your extra `radiusd` flags on top.
141-
- dSYM generation is enabled by default. Use `--no-dsym` to skip all dSYM generation, or `--no-dsym-modules` to keep the main binary dSYM but skip module dSYMs.
142-
143-
Reconfigure (no profiling run):
144-
```
145-
scripts/osx/profile-callgrind.sh \
146-
--clean \
147-
--configure-only \
148-
--cflags "-g3 -O1 -fno-omit-frame-pointer" \
149-
--ldflags "-fno-omit-frame-pointer" \
150-
--jobs 16
151-
```
152-
153-
Confirm command history log was written:
154-
```
155-
ls -t build/callgrind/commands.radiusd.*.log | head -n 1
156-
```
157-
158-
Inspect the newest log:
159-
```
160-
latest_log=$(ls -t build/callgrind/commands.radiusd.*.log | head -n 1)
161-
sed -n '1,200p' "$latest_log"
162-
```

0 commit comments

Comments
 (0)