btrfs: use device_list_mutex when removing stale devices
[linux/fpc-iii.git] / tools / power / cpupower / bench / cpufreq-bench_script.sh
blobde20d2a06879b0fa6630e441abcc18fe68d9e4f0
1 #!/bin/bash
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)
6 # any later version.
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
16 # 02110-1301, USA.
18 # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc.
20 # Ondemand up_threshold and sampling rate test script for cpufreq-bench
21 # mircobenchmark.
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"
35 function measure()
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
42 # Set values in sysfs
43 echo $up_threshold >/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
44 echo $sampling_rate >/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
45 up_threshold_set=$(cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold)
46 sampling_rate_set=$(cat /sys/devices/system/cpu/cpu0/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}"
51 else
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}"
56 else
57 echo "WARNING: Tried to set sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}"
60 # Benchmark
61 cpufreq-bench -o /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}
62 done
63 done
66 function create_plots()
68 local command
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\""
74 done
75 echo $command
76 eval "$command"
77 echo
78 done
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\""
84 done
85 echo $command
86 eval "$command"
87 echo
88 done
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\""
94 done
95 done
96 echo "$command"
97 eval "$command"
100 measure
101 create_plots