mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-18 21:46:35 +01:00
gnu: Add powertop-service-type.
* gnu/services/pm.scm (powertop-shepherd-service) (powertop-service-type, powertop-configuration): New variables. * doc/guix.texi (Power Management Services): Document powertop-service-type. Change-Id: I1c5ef855526458ad54f62ca6e755da82acce1c4a Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
2b8d612f4e
commit
ea5ee89274
2 changed files with 67 additions and 1 deletions
|
@ -35800,6 +35800,32 @@ Ignore cpuid check for supported CPU models.
|
||||||
@item @code{thermald} (default: @var{thermald})
|
@item @code{thermald} (default: @var{thermald})
|
||||||
Package object of thermald.
|
Package object of thermald.
|
||||||
|
|
||||||
|
@cindex PowerTOP
|
||||||
|
@cindex power consumption tuning with PowerTOP
|
||||||
|
@subsubheading PowerTOP
|
||||||
|
|
||||||
|
The @code{(gnu services pm)} module also provides a service definition
|
||||||
|
for @uref{https://01.org/powertop/, PowerTOP}, a power consumption
|
||||||
|
analysis and tuning tool. When started, it tunes Linux kernel settings
|
||||||
|
to reduce power consumption.
|
||||||
|
|
||||||
|
@defvar powertop-service-type
|
||||||
|
The service type for PowerTOP. No configuration is necessary. When the
|
||||||
|
service starts, it executes @code{powertop --auto-tune}.
|
||||||
|
|
||||||
|
@lisp
|
||||||
|
(service powertop-service-type)
|
||||||
|
@end lisp
|
||||||
|
@end defvar
|
||||||
|
|
||||||
|
Available @code{powertop-configuration} fields are:
|
||||||
|
|
||||||
|
@deftypevr {@code{powertop-configuration} parameter} package powertop
|
||||||
|
The PowerTOP package. Defaults to @code{powertop} in the @code{(gnu
|
||||||
|
packages linux)} module
|
||||||
|
|
||||||
|
@end deftypevr
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2024 Dariqq <dariqq@posteo.net>
|
;;; Copyright © 2024 Dariqq <dariqq@posteo.net>
|
||||||
|
;;; Copyright © 2024 Ian Eure <ian@retrospec.tv>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -18,6 +19,8 @@
|
||||||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(define-module (gnu services pm)
|
(define-module (gnu services pm)
|
||||||
|
#:use-module (srfi srfi-1)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
|
@ -37,7 +40,10 @@ (define-module (gnu services pm)
|
||||||
tlp-configuration
|
tlp-configuration
|
||||||
|
|
||||||
thermald-configuration
|
thermald-configuration
|
||||||
thermald-service-type))
|
thermald-service-type
|
||||||
|
|
||||||
|
powertop-configuration
|
||||||
|
powertop-service-type))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; power-profiles-daemon
|
;;; power-profiles-daemon
|
||||||
|
@ -525,3 +531,37 @@ (define thermald-service-type
|
||||||
(default-value (thermald-configuration))
|
(default-value (thermald-configuration))
|
||||||
(description "Run thermald, a CPU frequency scaling service that helps
|
(description "Run thermald, a CPU frequency scaling service that helps
|
||||||
prevent overheating.")))
|
prevent overheating.")))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;;
|
||||||
|
;;; powertop
|
||||||
|
;;;
|
||||||
|
;;; Calls `powertop --auto-tune' to reduce energy consumption.
|
||||||
|
|
||||||
|
(define-configuration powertop-configuration
|
||||||
|
(powertop (package powertop) "PowerTOP package to use."))
|
||||||
|
|
||||||
|
(define powertop-shepherd-service
|
||||||
|
(match-lambda
|
||||||
|
(($ <powertop-configuration> powertop)
|
||||||
|
(shepherd-service
|
||||||
|
(documentation "Tune kernel power settings at boot.")
|
||||||
|
(provision '(powertop powertop-auto-tune))
|
||||||
|
(requirement '(user-processes))
|
||||||
|
(one-shot? #t)
|
||||||
|
(start #~(lambda _
|
||||||
|
(zero? (system* #$(file-append powertop "/sbin/powertop")
|
||||||
|
"--auto-tune"))))))))
|
||||||
|
|
||||||
|
(define powertop-service-type
|
||||||
|
(service-type
|
||||||
|
(name 'powertop)
|
||||||
|
(extensions
|
||||||
|
(list
|
||||||
|
(service-extension shepherd-root-service-type
|
||||||
|
(compose list powertop-shepherd-service))))
|
||||||
|
(compose concatenate)
|
||||||
|
(default-value (powertop-configuration))
|
||||||
|
(description "Tune power-related kernel parameters to reduce energy
|
||||||
|
consumption.")))
|
||||||
|
|
Loading…
Reference in a new issue