GeezerVison is showing github.com — benchmark,doc: add CPU scaling governor to perf · nodejs/node@68e45b4
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +24Lines changed: 24 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +CPUPATH=/sys/devices/system/cpu |
| 4 | + |
| 5 | +MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}') |
| 6 | + |
| 7 | +set_governor() { |
| 8 | + echo "Setting CPU frequency governor to \"$1\"" |
| 9 | + i=0 |
| 10 | + while [ "$i" -le "$MAXID" ]; do |
| 11 | + echo "$1" > "$CPUPATH/cpu$i/cpufreq/scaling_governor" |
| 12 | + i=$((i + 1)) |
| 13 | + done |
| 14 | +} |
| 15 | + |
| 16 | +case "$1" in |
| 17 | + fast | performance) |
| 18 | + set_governor "performance" |
| 19 | + ;; |
| 20 | + *) |
| 21 | + echo "Usage: $0 fast" |
| 22 | + exit 1 |
| 23 | + ;; |
| 24 | +esac |
Collapse file
Copy file name to clipboardExpand all lines: doc/contributing/writing-and-running-benchmarks.md +10Lines changed: 10 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -94,6 +94,16 @@ A list of mirrors is [located here](https://cran.r-project.org/mirrors.html). |
94 | 94 |
|
95 | 95 | ## Running benchmarks |
96 | 96 |
|
| 97 | +### Setting CPU Frequency scaling governor to "performance" |
| 98 | + |
| 99 | +It is recommended to set the CPU frequency to `performance` before running |
| 100 | +benchmarks. This increases the likelihood of each benchmark achieving peak performance |
| 101 | +according to the hardware. Therefore, run: |
| 102 | + |
| 103 | +```console |
| 104 | +$ ./benchmarks/cpu.sh fast |
| 105 | +``` |
| 106 | + |
97 | 107 | ### Running individual benchmarks |
98 | 108 |
|
99 | 109 | This can be useful for debugging a benchmark or doing a quick performance |
|