Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark,doc: add CPU scaling governor to perf #54723

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions benchmark/cpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

Check failure on line 1 in benchmark/cpu.sh

View workflow job for this annotation

GitHub Actions / lint-sh

Invalid hashbang for /home/runner/work/node/node/benchmark/cpu.sh (expected /bin/sh).

CPUPATH=/sys/devices/system/cpu

MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}')

set_governor() {
echo "Setting CPU frequency governor to \"$1\""
for (( i=0; i<=$MAXID; i++ )); do
echo "$1" > $CPUPATH/cpu$i/cpufreq/scaling_governor
done
}

case "$1" in

Check failure on line 14 in benchmark/cpu.sh

View workflow job for this annotation

GitHub Actions / lint-sh

/home/runner/work/node/node/benchmark/cpu.sh:14:1: The mentioned syntax error was in this case expression.
fast | performance)
set_governor "performance"
;;
echo "Usage: $0 fast"

Check failure on line 18 in benchmark/cpu.sh

View workflow job for this annotation

GitHub Actions / lint-sh

/home/runner/work/node/node/benchmark/cpu.sh:18:5: Couldn't parse this case item. Fix to allow more checks.

Check failure on line 18 in benchmark/cpu.sh

View workflow job for this annotation

GitHub Actions / lint-sh

/home/runner/work/node/node/benchmark/cpu.sh:18:10: Expected ) to open a new case item. Fix any mentioned problems and try again.

Check failure on line 18 in benchmark/cpu.sh

View workflow job for this annotation

GitHub Actions / lint-sh

/home/runner/work/node/node/benchmark/cpu.sh:18:10: Did you forget to move the ;; after extending this case item?
exit 1
;;
esac
10 changes: 10 additions & 0 deletions doc/contributing/writing-and-running-benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ensures that each benchmark run can achieve peak performance
according to the hardware. Therefore, run:
RafaelGSS marked this conversation as resolved.
Show resolved Hide resolved

```console
$ ./benchmarks/cpu.sh fast
```

### Running individual benchmarks

This can be useful for debugging a benchmark or doing a quick performance
Expand Down
Loading