0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

benchmark,doc: add CPU scaling governor to perf

PR-URL: https://github.com/nodejs/node/pull/54723
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Rafael Gonzaga 2024-09-04 16:21:18 -03:00 committed by GitHub
parent 133d2d9fad
commit a63882bece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

24
benchmark/cpu.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
CPUPATH=/sys/devices/system/cpu
MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}')
set_governor() {
echo "Setting CPU frequency governor to \"$1\""
i=0
while [ "$i" -le "$MAXID" ]; do
echo "$1" > "$CPUPATH/cpu$i/cpufreq/scaling_governor"
i=$((i + 1))
done
}
case "$1" in
fast | performance)
set_governor "performance"
;;
*)
echo "Usage: $0 fast"
exit 1
;;
esac

View File

@ -94,6 +94,16 @@ A list of mirrors is [located here](https://cran.r-project.org/mirrors.html).
## Running benchmarks
### Setting CPU Frequency scaling governor to "performance"
It is recommended to set the CPU frequency to `performance` before running
benchmarks. This increases the likelihood of each benchmark achieving peak performance
according to the hardware. Therefore, run:
```console
$ ./benchmarks/cpu.sh fast
```
### Running individual benchmarks
This can be useful for debugging a benchmark or doing a quick performance