OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 CPUPATH=/sys/devices/system/cpu | 6 CPUPATH=/sys/devices/system/cpu |
7 | 7 |
8 MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}') | 8 MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}') |
9 | 9 |
10 set_governor() { | 10 set_governor() { |
(...skipping 13 matching lines...) Expand all Loading... |
24 single_core() { | 24 single_core() { |
25 echo "Switching to single-core mode" | 25 echo "Switching to single-core mode" |
26 for (( i=1; i<=$MAXID; i++ )); do | 26 for (( i=1; i<=$MAXID; i++ )); do |
27 echo 0 > $CPUPATH/cpu$i/online | 27 echo 0 > $CPUPATH/cpu$i/online |
28 done | 28 done |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 all_cores() { | 32 all_cores() { |
33 echo "Reactivating all CPU cores" | 33 echo "Reactivating all CPU cores" |
34 for (( i=2; i<=$MAXID; i++ )); do | 34 for (( i=1; i<=$MAXID; i++ )); do |
35 echo 1 > $CPUPATH/cpu$i/online | 35 echo 1 > $CPUPATH/cpu$i/online |
36 done | 36 done |
37 } | 37 } |
38 | 38 |
39 case "$1" in | 39 case "$1" in |
40 fast | performance) | 40 fast | performance) |
41 set_governor "performance" | 41 set_governor "performance" |
42 ;; | 42 ;; |
43 slow | powersave) | 43 slow | powersave) |
44 set_governor "powersave" | 44 set_governor "powersave" |
45 ;; | 45 ;; |
46 default | ondemand) | 46 default | ondemand) |
47 set_governor "ondemand" | 47 set_governor "ondemand" |
48 ;; | 48 ;; |
49 dualcore | dual) | 49 dualcore | dual) |
50 dual_core | 50 dual_core |
51 ;; | 51 ;; |
52 singlecore | single) | 52 singlecore | single) |
53 single_core | 53 single_core |
54 ;; | 54 ;; |
55 allcores | all) | 55 allcores | all) |
56 all_cores | 56 all_cores |
57 ;; | 57 ;; |
58 *) | 58 *) |
59 echo "Usage: $0 fast|slow|default|singlecore|dualcore|all" | 59 echo "Usage: $0 fast|slow|default|singlecore|dualcore|all" |
60 exit 1 | 60 exit 1 |
61 ;; | 61 ;; |
62 esac | 62 esac |
OLD | NEW |