-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/issue11893
- Loading branch information
Showing
6 changed files
with
1,066 additions
and
1,015 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Notes for monitoring performance on Linux | ||
|
||
Context: I've been having trouble getting consistent performance measurements on my MacBook Pro, so I decided to try my luck on an Intel Linux desktop running Ubuntu 24. | ||
|
||
## `perf` settings | ||
|
||
We'll want to monitor some performance counters that have potential security implications, so we need to disable some settings. ONLY DO THIS ON A MACHINE YOU TRUST AND THAT WILL NOT RUN POTENTIALLY-MALICIOUS THIRD-PARTY CODE! | ||
|
||
### Source `scripts/linux-perf-settings.sh` | ||
|
||
(These come from <https://easyperf.net/blog/2019/08/02/Perf-measurement-environment-on-Linux>) | ||
|
||
### `sysctl.conf` settings | ||
|
||
``` | ||
$ cat /proc/sys/kernel/perf_event_paranoid | ||
``` | ||
|
||
If the result isn't `-1`, then add this to `/etc/sysctl.conf`: | ||
|
||
``` | ||
kernel.perf_event_paranoid = -1 | ||
``` | ||
|
||
``` | ||
$ cat /proc/sys/kernel/kptr_restrict | ||
``` | ||
|
||
If the result isn't `0`, then add this to `/etc/sysctl.conf`: | ||
|
||
``` | ||
kernel.kptr_restrict = 0 | ||
``` | ||
|
||
After these changes, you'll need to reboot. |
16 changes: 16 additions & 0 deletions
16
dev-docs/performance-monitoring/scripts/linux-perf-settings.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# This assumes intel processors!! | ||
|
||
# Intel | ||
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo | ||
# AMD | ||
# echo 0 > /sys/devices/system/cpu/cpufreq/boost | ||
|
||
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | ||
do | ||
echo performance > $i | ||
done | ||
|
||
echo 0 > /proc/sys/kernel/randomize_va_space | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.