From b596ac9f1f30fd81d687ba97b52cff3c21344cf0 Mon Sep 17 00:00:00 2001 From: Philip Knirsch Date: Tue, 18 Aug 2009 18:00:39 +0200 Subject: [PATCH] - Updated documentation - Few more fixes for tuned-adm --- Makefile | 7 +- commands/cmd_default_mode.py | 32 --------- commands/cmd_list.py | 2 +- commands/cmd_off_mode.py | 4 -- commands/{cmd_modes.py => cmd_profile.py} | 11 ++- doc/tuned-adm.1 | 83 +++++++++++++++++++++++ man/tuned-adm.1 | 55 --------------- tuned.spec | 7 +- 8 files changed, 102 insertions(+), 99 deletions(-) delete mode 100644 commands/cmd_default_mode.py rename commands/{cmd_modes.py => cmd_profile.py} (86%) create mode 100644 doc/tuned-adm.1 delete mode 100644 man/tuned-adm.1 diff --git a/Makefile b/Makefile index 66125c6..d730e6b 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,12 @@ GITTAG = v$(VERSION) DIRS = doc contrib tuningplugins monitorplugins ktune commands FILES = tuned tuned.spec Makefile tuned.py tuned.initscript tuned.conf tuned-adm -FILES_doc = doc/DESIGN.txt doc/README.utils doc/TIPS.txt doc/tuned.8 doc/tuned.conf.5 doc/README.scomes +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 FILES_monitorplugins = monitorplugins/cpu.py monitorplugins/disk.py monitorplugins/net.py monitorplugins/__init__.py FILES_ktune = ktune/ktune.init ktune/ktune.sysconfig ktune/sysctl.ktune ktune/README.ktune -FILES_commands = commands/cmd_default_mode.py commands/cmd_off_mode.py commands/cmd_list.py \ - commands/cmd_modes.py commands/__init__.py +FILES_commands = commands/cmd_off_mode.py commands/cmd_list.py commands/cmd_profile.py commands/__init__.py DOCS = AUTHORS ChangeLog COPYING INSTALL NEWS README distarchive: tag archive @@ -96,6 +95,8 @@ install: install -m 0644 doc/tuned.8 $(DESTDIR)/usr/share/man/man8 mkdir -p $(DESTDIR)/usr/share/man/man5 install -m 0644 doc/tuned.conf.5 $(DESTDIR)/usr/share/man/man5 + mkdir -p $(DESTDIR)/usr/share/man/man1 + install -m 0644 doc/tuned-adm.1 $(DESTDIR)/usr/share/man/man1 # Install ktune install -m 755 -d $(DESTDIR)/etc diff --git a/commands/cmd_default_mode.py b/commands/cmd_default_mode.py deleted file mode 100644 index 539a451..0000000 --- a/commands/cmd_default_mode.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -import glob -import kobo.shortcuts -from kobo.cli import Command - -class Default(Command): - """star ktune and tuned with default settings""" - enabled = True - - def options(self): - self.parser.usage = "%%prog %s" % self.normalized_name - - self.parser.add_option( - "--show-disabled", - default=False, - action="store_true", - help="show disabled workers" - ) - - - def run(self, *args, **kwargs): - os.system('service ktune start') - os.system('chkconfig --add ktune && chkconfig --level 345 ktune on') - os.system('service tuned start') - os.system('chkconfig --add tuned && chkconfig --level 345 tuned on') - -# usb_devices = glob.glob('/sys/bus/usb/devices/?-?/') -# for i in usb_devices: -# retcode, output = kobo.shortcuts.run('echo 2 > %spower/autosuspend' % i) -# retcode, output = kobo.shortcuts.run('echo auto > %spower/level' % i) \ No newline at end of file diff --git a/commands/cmd_list.py b/commands/cmd_list.py index e939dff..2f71a1f 100644 --- a/commands/cmd_list.py +++ b/commands/cmd_list.py @@ -7,7 +7,7 @@ import kobo.shortcuts from kobo.cli import Command class List(Command): - """list of modes""" + """list all available profiles""" enabled = True def options(self): diff --git a/commands/cmd_off_mode.py b/commands/cmd_off_mode.py index d9b8e5f..779ac50 100644 --- a/commands/cmd_off_mode.py +++ b/commands/cmd_off_mode.py @@ -31,7 +31,3 @@ class Off(Command): os.system('service tuned stop') os.system('chkconfig --del ktune') os.system('chkconfig --del tuned') - usb_devices = glob.glob('/sys/bus/usb/devices/?-?/') - # test whether usb suspend is on - for i in usb_devices: - retcode, output = kobo.shortcuts.run('echo on > %spower/level' % i) diff --git a/commands/cmd_modes.py b/commands/cmd_profile.py similarity index 86% rename from commands/cmd_modes.py rename to commands/cmd_profile.py index eacf9f8..96cc0f5 100644 --- a/commands/cmd_modes.py +++ b/commands/cmd_profile.py @@ -6,8 +6,8 @@ import glob import kobo.shortcuts from kobo.cli import Command -class Modes(Command): - """set mode""" +class Profile(Command): + """ switch to given profile""" enabled = True def options(self): @@ -26,6 +26,11 @@ class Modes(Command): enablektune = False enabletuned = False if len(args) == 0: + print "No profile given. To list all available profiles please run:" + print "tuned-adm list" + return + if not os.path.exists("/etc/tune-profiles/"+args[0]): + print "No profile with name %s found." % args[0] return if os.path.exists("/etc/tune-profiles/"): os.system('service ktune stop') @@ -34,7 +39,7 @@ class Modes(Command): os.system('chkconfig --add tuned && chkconfig --level 345 tuned off') modes = os.listdir("/etc/tune-profiles") if modes > 0: - print 'Mode %s' % args[0] + print 'Switching to profile %s' % 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'): diff --git a/doc/tuned-adm.1 b/doc/tuned-adm.1 new file mode 100644 index 0000000..2c902df --- /dev/null +++ b/doc/tuned-adm.1 @@ -0,0 +1,83 @@ +.\"/* +.\" * All rights reserved +.\" * Copyright (C) 2009 Red Hat, Inc. +.\" * Authors: Marcela Mašláňová, 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. +.\" */ +.\" +.TH TUNED_ADM "1" "9 Jul 2009" "Linux Programmer's Manual" +.SH NAME +tuned-adm \- commandline tool for switching between different tuning profiles +.SH SYNOPSIS +.B tuned-adm +.B +.BR [ " help ", " list ", " 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. +.SH "OPTIONS" + +.SS +.TP +.B help +Print out the list of commands. It's also the default if you start tuned-adm without any commands. + +.TP +.B list +List all available profiles. + +.TP +.B profile +Switches to the given profilename. If none is given or no valid one is given the command gracefully exits without performing any operation. + +.TP +.B off +Switch off all ktune and tuned settings and remove them from services. The configuration file are +set to previous settings. + +.SH PREDEFINED PROFILES +At the moment we're providing the following pre defined profiles: + +.TP +.BI "desktop-powersave" +Very light powersaving profile directed at desktop systems. + +.TP +.BI server-powersave +Very light powersaving profile directed at server systems. + +.TP +.BI laptop-ac-powersave +Medium powersaving profile directed at laptops running on AC. + +.TP +.BI laptop-battery-powersave +Strong powersaving profile directed at laptops running on battery. This profile will affect the overall performance of the system as a tradeoff for typically longer running time on battery power. + +.TP +.BI throughput-performance +Sever profile for typical througput performance tuning. + +.TP +.BI latency-performance +Sever profile for typical latency performance tuning. + +.SH "SEE ALSO" +.BR tuned (8) +.SH AUTHOR +.nf +Marcela Mašláňová +Phil Knirsch diff --git a/man/tuned-adm.1 b/man/tuned-adm.1 deleted file mode 100644 index 2540021..0000000 --- a/man/tuned-adm.1 +++ /dev/null @@ -1,55 +0,0 @@ -.\"/* -.\" * All rights reserved -.\" * Copyright (C) 2009 Red Hat, Inc. -.\" * Authors: Marcela Mašláňová -.\" * -.\" * 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. -.\" */ -.\" -.TH TUNED_ADM "1" "9 Jul 2009" "Linux Programmer's Manual" -.SH NAME -tuned-adm \- commandline tool for setting the power-save options -.SH SYNOPSIS -.B tuned-adm -.B -.BR help ", " laptop ", " server ", " default ", " off " -.br -.SH DESCRIPTION -This command line utility allows user to set profile for server or laptop. -.SH "OPTIONS" - -.SS -.TP -.B help -Print out the list of commands. - -.TP -.B laptop - -.TP -.B server -These settings are calling ktune which set up different values for better resource consumption. -It also switch on tuned daemon and add ktune and tuned into chkconfig. Usbsuspend is set. - -.TP -.B off -Switch off all ktune and tuned settings and remove them from services. The configuration file are -set to previous settings. - -.SH "SEE ALSO" -.BR tuned (8) -.SH AUTHOR -.nf -Marcela Mašláňová diff --git a/tuned.spec b/tuned.spec index b965ef6..69d8d42 100644 --- a/tuned.spec +++ b/tuned.spec @@ -1,6 +1,6 @@ Summary: A dynamic adaptive system tuning daemon Name: tuned -Version: 0.2.2 +Version: 0.2.3 Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons @@ -78,6 +78,7 @@ fi %{_sbindir}/tuned-adm %{_sysconfdir}/tune-profiles %{_datadir}/tuned +%{_mandir}/man1/* %{_mandir}/man5/* %{_mandir}/man8/* %attr(0755,root,root) %{_initddir}/ktune @@ -96,6 +97,10 @@ fi %changelog +* Tue Aug 18 2009 Phil Knirsch 0.2.3-1 +- Updated documentation +- Few more fixes for tuned-adm + * Fri Aug 14 2009 Phil Knirsch 0.2.2-1 - Updates to the ktune scripts - Added support for start/stop of the ktune scripts and ktune initscript