How to Install and Use Powertop on Ubuntu 16.04/20.04

Channel: Linux
Abstract: $ sudo apt-get install powertop This installation provides you with a command-line tool called powertop which is used to check and monitor power usage

Powertop is a tool that was developed by Intel to enable various power-saving modes in kernel, userspace, and hardware. Powertop helps you monitor processes and get each process CPU utilization and wake it from its Idle-States. This allows you to identify applications that have high power demands and kill their processes if not necessary.

PowerTOP Linux utility can monitor and display a system's electrical power usage. This makes it a very useful hardware monitoring and diagnostic tool. It is among the most powerful battery stretching utilities for notebook computers. This tool is supported by Intel, AMD, ARM, and UltraSparc processors.

Installing Powertop on Ubuntu 16.04/20.04

Powertop package is available on upstream Ubuntu 16.04/20.04 repositories.  Easily install it from apt-get package management tool.

$ sudo apt-get update
$ sudo apt-get install powertop

This installation provides you with a command-line tool called powertop which is used to check and monitor power usage.

Accessing PowerTOP Tunables

Let's cover some few examples on how to use Powertop. Before you start making any changes, it is a good idea to first get a baseline for what your current power consumption is. It needs superuser privileges hence sudo command must be used.

$ sudo powertop

This is the default mode to execute PowerTOP. It will open an n-curses interface that hosts Powertop’s interactive mode. Note that you must be running on battery power for Powertop to get the machine's current watt usage. Once the application is launched, you may tab over to the Tunables section to adjust the power management setting for each item in the list.

From the layout, under Tunables tab is a list of the devices that are present on the system. Devices that are not tuned for power management have the 「Bad」 label associated. Otherwise, the label reads 「Good」.

Navigating Powertop n-curses interface

To navigate, use the tab key to visit the different menu items. Use the arrow keys to navigate vertically on a page and the enter key to change the configuration of the items under Tunables.

Powertop operation modes

There are other modes you can start Powertop in apart from interactive one. Namely

HTML mode

This feature executes PowerTOP and stores the result in the powertop.html file:

$ sudo powertop --html[=FILENAME]
CSV mode

In this mode, the output is given in CSV format with the default name of  powertop.csv if no name is given:

$ sudo powertop --csv[=FILENAME]
Calibrate mode

Calibrate mode measures power for a set of runs using different idle settings for USB devices, radios, backlight, wifi, disk, and the CPU.

$ sudo powertop --calibrate
Auto-Tune mode

This feature sets all tunable options to their GOOD setting without additional user intervention.

$ sudo powertop --auto-tune
Workload mode

Good for benchmarks. It executes a workload and identifies the power consumption of the system during the execution of the workload.

$ sudo powertop --workload[=WORKLOAD]
Uninstalling Powertop on Ubuntu 16.04

If you no longer need this tool and feel like uninstalling it, without touching any configuration file, run:

$ sudo apt-get remove powertop

To remove powertop package and its dependencies, you'll need to run:

$ sudo apt-get remove --auto-remove powertop

If you had to remove  the powertop package only and now need to clear its configuration files and data, use:

$ sudo apt-get purge --auto-remove powertop
Wrapping Up

Powertop is a nice tool for Laptop users keen at maximum power efficiency. By filtering applications which are more power intensive, it becomes easy to retain only useful and productive apps. If you're a developer, you can as well extend its functionalities to achieve more.

Ref From: linoxide
Channels:

Related articles