~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/cpufreq/cpu.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/cpufreq/cpu.sh (Architecture alpha) and /tools/testing/selftests/cpufreq/cpu.sh (Architecture sparc64)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 #                                                   3 #
  4 # CPU helpers                                       4 # CPU helpers
  5                                                     5 
  6 # protect against multiple inclusion                6 # protect against multiple inclusion
  7 if [ $FILE_CPU ]; then                              7 if [ $FILE_CPU ]; then
  8         return 0                                    8         return 0
  9 else                                                9 else
 10         FILE_CPU=DONE                              10         FILE_CPU=DONE
 11 fi                                                 11 fi
 12                                                    12 
 13 source cpufreq.sh                                  13 source cpufreq.sh
 14                                                    14 
 15 for_each_cpu()                                     15 for_each_cpu()
 16 {                                                  16 {
 17         cpus=$(ls $CPUROOT | grep "cpu[0-9].*"     17         cpus=$(ls $CPUROOT | grep "cpu[0-9].*")
 18         for cpu in $cpus; do                       18         for cpu in $cpus; do
 19                 $@ $cpu                            19                 $@ $cpu
 20         done                                       20         done
 21 }                                                  21 }
 22                                                    22 
 23 for_each_non_boot_cpu()                            23 for_each_non_boot_cpu()
 24 {                                                  24 {
 25         cpus=$(ls $CPUROOT | grep "cpu[1-9].*"     25         cpus=$(ls $CPUROOT | grep "cpu[1-9].*")
 26         for cpu in $cpus; do                       26         for cpu in $cpus; do
 27                 $@ $cpu                            27                 $@ $cpu
 28         done                                       28         done
 29 }                                                  29 }
 30                                                    30 
 31 #$1: cpu                                           31 #$1: cpu
 32 offline_cpu()                                      32 offline_cpu()
 33 {                                                  33 {
 34         printf "Offline $1\n"                      34         printf "Offline $1\n"
 35         echo 0 > $CPUROOT/$1/online                35         echo 0 > $CPUROOT/$1/online
 36 }                                                  36 }
 37                                                    37 
 38 #$1: cpu                                           38 #$1: cpu
 39 online_cpu()                                       39 online_cpu()
 40 {                                                  40 {
 41         printf "Online $1\n"                       41         printf "Online $1\n"
 42         echo 1 > $CPUROOT/$1/online                42         echo 1 > $CPUROOT/$1/online
 43 }                                                  43 }
 44                                                    44 
 45 #$1: cpu                                           45 #$1: cpu
 46 reboot_cpu()                                       46 reboot_cpu()
 47 {                                                  47 {
 48         offline_cpu $1                             48         offline_cpu $1
 49         online_cpu $1                              49         online_cpu $1
 50 }                                                  50 }
 51                                                    51 
 52 # Reboot CPUs                                      52 # Reboot CPUs
 53 # param: number of times we want to run the lo     53 # param: number of times we want to run the loop
 54 reboot_cpus()                                      54 reboot_cpus()
 55 {                                                  55 {
 56         printf "** Test: Running ${FUNCNAME[0]     56         printf "** Test: Running ${FUNCNAME[0]} for $1 loops **\n\n"
 57                                                    57 
 58         for i in `seq 1 $1`; do                    58         for i in `seq 1 $1`; do
 59                 for_each_non_boot_cpu offline_     59                 for_each_non_boot_cpu offline_cpu
 60                 for_each_non_boot_cpu online_c     60                 for_each_non_boot_cpu online_cpu
 61                 printf "\n"                        61                 printf "\n"
 62         done                                       62         done
 63                                                    63 
 64         printf "\n%s\n\n" "-------------------     64         printf "\n%s\n\n" "------------------------------------------------"
 65 }                                                  65 }
 66                                                    66 
 67 # Prints warning for all CPUs with missing cpu     67 # Prints warning for all CPUs with missing cpufreq directory
 68 print_unmanaged_cpus()                             68 print_unmanaged_cpus()
 69 {                                                  69 {
 70         for_each_cpu cpu_should_have_cpufreq_d     70         for_each_cpu cpu_should_have_cpufreq_directory
 71 }                                                  71 }
 72                                                    72 
 73 # Counts CPUs with cpufreq directories             73 # Counts CPUs with cpufreq directories
 74 count_cpufreq_managed_cpus()                       74 count_cpufreq_managed_cpus()
 75 {                                                  75 {
 76         count=0;                                   76         count=0;
 77                                                    77 
 78         for cpu in `ls $CPUROOT | grep "cpu[0-     78         for cpu in `ls $CPUROOT | grep "cpu[0-9].*"`; do
 79                 if [ -d $CPUROOT/$cpu/cpufreq      79                 if [ -d $CPUROOT/$cpu/cpufreq ]; then
 80                         let count=count+1;         80                         let count=count+1;
 81                 fi                                 81                 fi
 82         done                                       82         done
 83                                                    83 
 84         echo $count;                               84         echo $count;
 85 }                                                  85 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php