Menet közbeni CPU frekvencia-váltó script a 2.6-kernelekhez.

Kezdőlap Fórumok Van egy ötletem… Menet közbeni CPU frekvencia-váltó script a 2.6-kernelekhez.

1 / 1 bejegyzés megtekintése
  • Szerző
    Bejegyzés
  • #1871291
    Gege
    Felhasználó

      Hali!

      Nemrég áttértem a 2.6-os kernelre, és elcsodálkoztam azon, hogy lehet a proci teljesítményét állítani menet közben. Ha leveszi az ember, kevésbé melegszik, nem fogyaszt annyi áramot stb…

      Szóval itt a kis scriptem. Eléggé kezdetleges, de még csak most tanulok shell-scriptet…

      #!/bin/bash
      # CPU-frequency changer v1.0
      #
      # Copy this file to /bin so you can execute it with the “cpu” -command. It also needs a parameter: min/max.
      # Set the rights carefully, because it can be a security measure if some ordinary user sets the frequency of the CPU…
      #
      # This is entirely written by Gege, it uses the 2.6 Linux kernel’s on-the-fly frequency scaling abilities.
      # Feel free to distribute and modify it anyway you want.
      # I take NO responsibility if you do something damage with this, but that has no chance to happen. The
      # frequencies are automatically picked from the cpu-freq-scaling program, which detects them automatically.
      # You HAVE to run a 2.6 kernel with cpu-freq scaling compiled in it. You also have to have /sys -filesystem
      # support, and have to mount it to /sys.
      # You have to run this script as r00t…

      if [ “$1” = “” ]
      then
      echo “You must specify a parameter (max/min)”
      exit
      fi

      echo
      echo “Setting CPU to $1 freq.”
      cd /sys/devices/system/cpu/cpu0/cpufreq

      if [ “$1” = “max” ]
      then
      cat cpuinfo_max_freq ] scaling_setspeed
      fi

      if [ “$1” = “min” ]
      then
      cat cpuinfo_min_freq ] scaling_setspeed
      fi

      echo
      echo “The CPU frequency is set to the “$1″imum!”
      echo “This frequency is:”
      cat scaling_setspeed
      echo

      Csak másoljátok be a /bin-be, állítsátok be a jogokat(rwxr–r–).

    1 / 1 bejegyzés megtekintése
    • Be kell jelentkezni a hozzászóláshoz.