3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2, or (at your option)
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc.
20 # Ondemand up_threshold and sampling rate test script for cpufreq-bench
22 # Modify the general variables at the top or extend or copy out parts
23 # if you want to test other things
26 # Default with latest kernels is 95, before micro account patches
27 # it was 80, cmp. with git commit 808009131046b62ac434dbc796
28 UP_THRESHOLD
="60 80 95"
29 # Depending on the kernel and the HW sampling rate could be restricted
30 # and cannot be set that low...
31 # E.g. before git commit cef9615a853ebc4972084f7 one could only set
32 # min sampling rate of 80000 if CONFIG_HZ=250
33 SAMPLING_RATE
="20000 80000"
37 local -i up_threshold_set
38 local -i sampling_rate_set
40 for up_threshold
in $UP_THRESHOLD;do
41 for sampling_rate
in $SAMPLING_RATE;do
43 echo $up_threshold >/sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/up_threshold
44 echo $sampling_rate >/sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/sampling_rate
45 up_threshold_set
=$
(cat /sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/up_threshold
)
46 sampling_rate_set
=$
(cat /sys
/devices
/system
/cpu
/cpu
0/cpufreq
/ondemand
/sampling_rate
)
48 # Verify set values in sysfs
49 if [ ${up_threshold_set} -eq ${up_threshold} ];then
50 echo "up_threshold: $up_threshold, set in sysfs: ${up_threshold_set}"
52 echo "WARNING: Tried to set up_threshold: $up_threshold, set in sysfs: ${up_threshold_set}"
54 if [ ${sampling_rate_set} -eq ${sampling_rate} ];then
55 echo "sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}"
57 echo "WARNING: Tried to set sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}"
61 cpufreq-bench
-o /var
/log
/cpufreq-bench
/up_threshold_
${up_threshold}_sampling_rate_
${sampling_rate}
66 function create_plots
()
70 for up_threshold
in $UP_THRESHOLD;do
71 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 %\""
72 for sampling_rate
in $SAMPLING_RATE;do
73 command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"sampling_rate = $sampling_rate\""
80 for sampling_rate
in $SAMPLING_RATE;do
81 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\""
82 for up_threshold
in $UP_THRESHOLD;do
83 command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"up_threshold = $up_threshold\""
90 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\""
91 for sampling_rate
in $SAMPLING_RATE;do
92 for up_threshold
in $UP_THRESHOLD;do
93 command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"up_threshold = $up_threshold - sampling_rate = $sampling_rate\""