2 # SPDX-License-Identifier: GPL-2.0-or-later
5 # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc.
7 # Ondemand up_threshold and sampling rate test script for cpufreq-bench
9 # Modify the general variables at the top or extend or copy out parts
10 # if you want to test other things
13 # Default with latest kernels is 95, before micro account patches
14 # it was 80, cmp. with git commit 808009131046b62ac434dbc796
15 UP_THRESHOLD
="60 80 95"
16 # Depending on the kernel and the HW sampling rate could be restricted
17 # and cannot be set that low...
18 # E.g. before git commit cef9615a853ebc4972084f7 one could only set
19 # min sampling rate of 80000 if CONFIG_HZ=250
20 SAMPLING_RATE
="20000 80000"
24 local -i up_threshold_set
25 local -i sampling_rate_set
27 for up_threshold
in $UP_THRESHOLD;do
28 for sampling_rate
in $SAMPLING_RATE;do
30 echo $up_threshold >/sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/up_threshold
31 echo $sampling_rate >/sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/sampling_rate
32 up_threshold_set
=$
(cat /sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/up_threshold
)
33 sampling_rate_set
=$
(cat /sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/sampling_rate
)
35 # Verify set values in sysfs
36 if [ ${up_threshold_set} -eq ${up_threshold} ];then
37 echo "up_threshold: $up_threshold, set in sysfs: ${up_threshold_set}"
39 echo "WARNING: Tried to set up_threshold: $up_threshold, set in sysfs: ${up_threshold_set}"
41 if [ ${sampling_rate_set} -eq ${sampling_rate} ];then
42 echo "sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}"
44 echo "WARNING: Tried to set sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}"
48 cpufreq-bench
-o /var
/log
/cpufreq-bench
/up_threshold_
${up_threshold}_sampling_rate_
${sampling_rate}
53 function create_plots
()
57 for up_threshold
in $UP_THRESHOLD;do
58 command="cpufreq-bench_plot.sh -o \"sampling_rate_${SAMPLING_RATE}_up_threshold_${up_threshold}\" -t \"Ondemand sampling_rate: ${SAMPLING_RATE} comparison - Up_threshold: $up_threshold %\""
59 for sampling_rate
in $SAMPLING_RATE;do
60 command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"sampling_rate = $sampling_rate\""
67 for sampling_rate
in $SAMPLING_RATE;do
68 command="cpufreq-bench_plot.sh -o \"up_threshold_${UP_THRESHOLD}_sampling_rate_${sampling_rate}\" -t \"Ondemand up_threshold: ${UP_THRESHOLD} % comparison - sampling_rate: $sampling_rate\""
69 for up_threshold
in $UP_THRESHOLD;do
70 command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"up_threshold = $up_threshold\""
77 command="cpufreq-bench_plot.sh -o \"up_threshold_${UP_THRESHOLD}_sampling_rate_${SAMPLING_RATE}\" -t \"Ondemand up_threshold: ${UP_THRESHOLD} and sampling_rate ${SAMPLING_RATE} comparison\""
78 for sampling_rate
in $SAMPLING_RATE;do
79 for up_threshold
in $UP_THRESHOLD;do
80 command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"up_threshold = $up_threshold - sampling_rate = $sampling_rate\""