1
0
Fork 0

- Added support for display of currently active profile

- Fix missing help command
This commit is contained in:
Philip Knirsch 2010-03-22 19:14:34 +01:00
parent 16cad923e0
commit cad3726c32
6 changed files with 48 additions and 5 deletions

View file

@ -8,7 +8,7 @@ MANDIR = /usr/share/man/
GITTAG = v$(VERSION)
DIRS = doc contrib tuningplugins monitorplugins ktune
FILES = tuned tuned.spec Makefile tuned.py tuned.initscript tuned.conf tuned-adm tuned_adm.py tuned-adm.pam tuned-adm.consolehelper tuned_nettool.py tuned_logging.py
FILES = tuned tuned.spec Makefile tuned.py tuned.initscript tuned.conf tuned-adm tuned_adm.py tuned-adm.pam tuned-adm.consolehelper tuned-adm.conf tuned_nettool.py tuned_logging.py
FILES_doc = doc/DESIGN.txt doc/README.utils doc/TIPS.txt doc/tuned.8 doc/tuned.conf.5 doc/tuned-adm.1 doc/README.scomes
FILES_contrib = contrib/diskdevstat contrib/netdevstat contrib/scomes contrib/varnetload
FILES_tuningplugins = tuningplugins/cpu.py tuningplugins/disk.py tuningplugins/net.py tuningplugins/__init__.py
@ -115,6 +115,7 @@ install:
# Install tune-profiles
install -m 755 -d $(DESTDIR)/etc/tune-profiles
cp -a tune-profiles/* $(DESTDIR)/etc/tune-profiles
install -m 0644 tuned-adm.conf $(DESTDIR)//etc/tune-profiles/active-profile
# Create log directory
mkdir -p $(DESTDIR)/var/log/tuned

View file

@ -24,7 +24,7 @@ tuned-adm \- commandline tool for switching between different tuning profiles
.SH SYNOPSIS
.B tuned-adm
.B
.BR [ " help ", " list ", " profile <profile> ", " off " ]
.BR [ " help ", " list ", " active ", " profile <profile> ", " off " ]
.br
.SH DESCRIPTION
This command line utility allows user to switch between user definable tuning profiles. Several predefined profiles are already included for some of the more common cases. Although the profiles typically refer to a common use case you can of course switch to any profile on any system. So switching to the laptop-battery-powersave profile on a server will activate this profile on it. This way, depending on your requirements you can select any of the profiles that fits your needs. You can even create your own profile, either based on one of the existing ones by copying it or make a completely new one. The profiles are stored in subdirectories below /etc/tune-profiles.
@ -42,6 +42,10 @@ Print out the list of commands. It's also the default if you start tuned-adm wit
.B list
List all available profiles.
.TP
.B active
Show current active profile.
.TP
.B profile <profile>
Switches to the given profilename. If none is given or no valid one is given the command gracefully exits without performing any operation.
@ -54,6 +58,10 @@ set to previous settings.
.SH PREDEFINED PROFILES
At the moment we're providing the following pre defined profiles:
.TP
.BI "default"
This is the default powersaving profile. It is the lowest of the available profiles in regard to powersaving and only enables CPU and disk plugins of tuned.
.TP
.BI "desktop-powersave"
A powersaving profile directed at desktop systems. Enables ALPM powersaving for SATA host adapters as well as the CPU, ethernet and disk plugins of tuned.

View file

@ -11,6 +11,11 @@ periodically. This information is then used by tuning plugins to change system
settings to lower or higher power saving modes in order to adapt to the current
usage. Currently monitoring and tuning plugins for CPU, ethernet network and ATA
harddisk devices are implemented.
In order to make it easier to switch between settings for different setups or
locations we now have an additional tool to switch between profiles.
Several pre defined profiles have already been included, but new ones can easily
be added or existing ones modified. For more details look at tuned-adm(1).
.SH OPTIONS
.TP 12
.BI \-d "\fR, \fP" \--daemon

View file

@ -34,7 +34,9 @@ Options:
-h, --help show this help message and exit
commands:
list list all available profiles
help show this help message and exit
list list all available and active profiles
active show current active profile
off switch off all tunning
profile <profile> switch to given profile
"""
@ -62,6 +64,10 @@ if __name__ == "__main__":
usage()
sys.exit(1)
if args[0] == "help":
usage()
sys.exit(0)
TUNEDDIR="/usr/share/tuned"
if TUNEDDIR not in sys.path:
sys.path.insert(0, TUNEDDIR)

View file

@ -1,6 +1,6 @@
Summary: A dynamic adaptive system tuning daemon
Name: tuned
Version: 0.2.10
Version: 0.2.11
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Daemons
@ -81,6 +81,7 @@ fi
%{_sbindir}/tuned-adm
# consolehelper hard link
%{_bindir}/tuned-adm
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/tune-profiles/active-profile
%{_sysconfdir}/tune-profiles
%{_datadir}/tuned
%{_mandir}/man1/*
@ -103,6 +104,18 @@ fi
%changelog
* Mon Mar 22 2010 Phil Knirsch <pknirsch@redhat.com> 0.2.11-1
- Added support for display of currently active profile
- Fix missing help command
* Fri Mar 19 2010 Phil Knirsch <pknirsch@redhat.com> 0.2.11-1
- Large update to documentation and manpages
- Updated several of the profiles
* Thu Mar 18 2010 Phil Knirsch <pknirsch@redhat.com> 0.2.11-1
- Updated ALPM powersave code in the various powersave profiles
- Disabled USB autosuspend in laptop-battery-powersave for now
* Wed Feb 03 2010 Jan Vcelak <jvcelak@redhat.com> 0.2.10-1
- Log file moved to separate directory.

View file

@ -30,6 +30,8 @@ class Tuned_adm:
def run(self, args):
if args[0] == "list":
self.list()
elif args[0] == "active":
self.active()
elif args[0] == "off":
if not os.getuid()==0:
print >>sys.stderr, "Only root can run this script";
@ -51,11 +53,18 @@ class Tuned_adm:
if len(modes) > 0:
print "Modes: "
for i in range(len(modes)):
print modes[i]
if modes[i] != "active-profile":
print modes[i]
else:
print "No profiles defined."
self.active()
def active(self):
profile = open(self.profile_dir+"/active-profile", "r").read()
print "Current active profile: %s" % profile
def off(self):
open(self.profile_dir+"/active-profile", "w").write("off")
os.system("rm -rf /etc/ktune.d/*.conf")
os.system("rm -rf /etc/ktune.d/*.sh")
if os.path.exists("/etc/sysconfig/ktune.bckp"):
@ -86,6 +95,7 @@ class Tuned_adm:
modes = os.listdir(self.profile_dir)
if modes > 0:
print 'Switching to profile %s' % args[0]
open(self.profile_dir+"/active-profile", "w").write(args[0])
if os.path.exists('/etc/ktune.d/tunedadm.sh'):
os.remove('/etc/ktune.d/tunedadm.sh')
if os.path.exists('/etc/ktune.d/tunedadm.conf'):