1
0
Fork 0
tuned/tuningplugins/cpu.py
Jaroslav Škarvada 9f490b6cb1 cpu plugin: add EEEPC dynamic FSB reclocking
The Asus FSB reclocking feature is also known as Super Hybrid Engine (SHE).
The feature can be enabled in tuned.conf by setting the eeefsb to True.
It is enabled by default in the laptop-battery-powersave profile.

Signed-off-by: Jan Vcelak <jvcelak@redhat.com>
2011-03-14 19:29:30 +01:00

83 lines
2.4 KiB
Python

# Copyright (C) 2009 Red Hat, Inc.
# Authors: Phil Knirsch
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
import os
import logging, tuned_logging
log = logging.getLogger("tuned.cputuning")
class CPUTuning:
config_section = "CPUTuning"
eeefsb_control = "/sys/devices/platform/eeepc/cpufv"
def __init__(self):
self.latency = 100
self.enabled = True
self.eeefsb = False
self.fsbreduced = False
def init(self, config):
log.debug("Init")
self.config = config
if self.config.has_option(self.config_section, "enabled"):
self.enabled = (self.config.get(self.config_section, "enabled") == "True")
try:
open("/dev/cpu_dma_latency", "w")
except:
self.enabled = False
if self.config.has_option(self.config_section, "eeefsb"):
self.eeefsb = (self.config.get(self.config_section, "eeefsb") == "True")
try:
open(self.eeefsb_control, "w")
except:
self.eeefsb = False
log.info("Module is %s" % ("enabled" if self.enabled else "disabled"))
def cleanup(self):
log.debug("Cleanup")
if not self.enabled:
return
open("/dev/cpu_dma_latency", "w").write("100\n")
def setTuning(self, load):
if not self.enabled:
return
loadavg = load.setdefault("CPU", 0.0)
if self.latency == 100 and loadavg < 0.2:
log.debug("Setting latency to 999")
self.latency = 999
open("/dev/cpu_dma_latency", "w").write("999\n")
if self.latency == 999 and loadavg > 0.2:
log.debug("Setting latency to 100")
self.latency = 100
open("/dev/cpu_dma_latency", "w").write("100\n")
if self.eeefsb:
if not self.fsbreduced and loadavg < 0.4:
open(self.eeefsb_control, "w").write("2\n")
self.fsbreduced = True
if self.fsbreduced and loadavg > 0.5:
open(self.eeefsb_control, "w").write("1\n")
self.fsbreduced = False
_plugin = CPUTuning()