PROFILING POWER CONSUMPTION IN LAPTOPS

Laptops, notebooks or netbooks generally use less power than desktop computers, because they are designed to run on a battery and to be more power efficient. Furthermore laptops rarely have a powerful video card and often use integrated graphics instead, which requires less electricity. The power consumption of a laptop depends on the screen size, typically you will find power consumption as low as 20 watts and up to 100 watts when running off the battery.

Energy is a critical resource for mobile computers. In spite of many improvements in low-power hardware design and battery life, there is now growing awareness that a strategically viable approach to energy management must include higher levels of the system.

Some of the popular energy profilers are Ibam, powertop, powerstat etc.

In this page, we describe the design and implementation of such a tool for profiling energy usage by laptops, namely PowerTOP.

Motivation

Factors mentioned above causes a very quick power-drain in laptops, thus making them less power-effecient and also reduces battery life. In most cases, power management settings are quite less power-efficient making power-drain and wearing off of batteries. Sometimes also the reported time remaining is very large than the actual time left. Therefore we, in this project are going to analyse vaious power management tools and their working.

Need for profiling power consumption

Energy consumption is a factor which various companies kept in mind while designing laptops. because it determines the duration your laptop runs on a battery. But still we can make suitable settings for certain features which can make our laptop power efficient.
Major factors which affect power consumption in laptops are:
Fragmentation: Mainly it happens to a volume over time as you save, change, or delete files. The changes that you save to a file are often stored in a different place on the volume than the original file. Fragmentation makes your hard disk do extra work that can slow down your computer, therefore consuming more battery than required.

  • Screen brightness: Dimming the display on your laptops ofcourse, will be going to make less power consumption.
  • Programs running in background: All the unnecessary programs running in backround make more load on cpu, hence making cpu to consume more battery.
  • Low RAM: Shortage of RAM makes your laptop rely on virtual memory, thus making more use of hard drive, which is much less power efficient.
  • Take care of battery: Leaving a charged battery dormant for long periods of time is very less power-effecient and also reduces battery life.
  • Using more power-consuming tools: Passive activities like email and word processing consume much less power than gaming or playing a DVD resulting in more power-consumption.

Popular open source applications for ubuntu

  • Powertop: It is the most advancesd power monitor, which monitors power consumption of every task running and gives the most accurate readings.
  • Powerstat: It generally measures power consumpion of mobile laptops and shows power consumption statistics. It also calculates average, standard deviation and minimum/maximum of the data.
  • IBAM: Ibam is an advanced battery monitor for laptops, it provides estimations of minutes of battery left or of the time needed until full recharge. This software relies on either APM, ACPI, SYSFS or PMU kernel support to access the battery status.
  • Battery statistics: In Ubuntu, there is a new power statistics history window.

POWERTOP: Intelligent battery monitor

PowerTop is an advanced battery monitor for laptops, which uses statistical and adaptive linear methods to measure, explain and minimise a computer's electrical power consumption. It is a Linux tool to diagnose issues.

Working

  • powertop start

powertop%201.png

  • overview:gives information like discharge rate, estimated time remaining, cpu usage

powertop2.png

  • Idle stat:provides usage data of different cores of cpu

powerstat3.png

  • Frequency stat:provide the frequency data at which different cores are running

powertop4.png

  • Device stat:

gives discharge rate and usage of hardware components like display, network interface and PCI devices
powertop5.png

  • tunables:

states condition(good/bad) of PCI devices
powertop6.png

  • more overview:

powertop7.png

Source code

W have read source code from https://01.org/powertop

POWERTOP.c

  • push_line(): pushes a line
  • push line_pid(): pushes line pid(unique id for an application)
  • clear_lines(): clear the lines stack.
  • count_lines(): count the number of lines
  • update_irq(): update the irq. IRQ: An interrupt request (or IRQ) is a hardware signal sent to the processor that temporarily stops a running program and allows a special program, an interrupt handler, to run instead.
  • do_proc_irq(): It sets IRQ to CPU affinity, which allows the system to connect a particular IRQ to only one CPU.
  • read_dat_acpi(): Its connects the interface to the computer to retrieve information. ACPI: Advanced Configuration and Power Interface (ACPI) specification provides an open standard for device configuration and power management by the operating system.
  • read_data_cpuidle(): It retrieves information from the cpu when in an idle state.
  • read_data(): It check for CPU idle, perform residency calculations based on used secs and checks for ACPI and then perform residency calculations based on ACPI timer.
  • stop_timerstats(): stops timer.
  • start_timerstats(): starts timer.
  • print_battery_proc_acpi():this function uses “/proc/acpi/battery/%s/state" file to show information on charging state, present voltage, remaining capacity and present rate at which power is being drawn.
  • print_battery_proc_pmu(): prints the number of batteries, charge(mAh) and voltage(mV) in a battery using “/proc/pmu/info” file which contains the information for the same.
  • print_battery_sysfs(): print battery information like voltage, ampere drawn, watts drawn etc.
  • usage(): shows different options that can be used in shell commands.
  • version(): shows software version

Bluetooth.c

  • turn_bluetooth off(): turns bluetooth off using these system calls: system("/usr/sbin/hciconfig hci0 down &> /dev/null") and system("/sbin/rmmod hci_usb &> /dev/null"). HCI(Host Controller Interface): It provides a standardised communication between the host stack (e.g., a PC or mobile phone OS) and the controller (the Bluetooth IC). This standard allows the host stack or controller IC to be swapped with minimal adaptation.
  • suggest_bluetooth_off(): It first check if /sys/modules/bluetooth exists, if not, don't probe bluetooth because it would trigger an autoload. It also check for active connections by opening this file “/usr/bin/hcitool con 2> /dev/null”

Cpufreq.c

  • suggest_ondemand_governor(): it opens “/sys/devices/system/cpu” and provide cpu frequency stats.

Display.c:

  • This has been used to create an interactive page on shell that divides a page into different columns, it looks like a spreadsheet.

Ethernet.c

  • void activate_WOL_suggestion(): check if interface is up.

Intelcstates.c

  • print_intel_cstates(): It prints cpu core power states requested by the Operating System Directed Power Management (OSPM) infrastructure that define the degree to which the processor is "sleeping".

Process.c

  • do_kill(): opens file “ps -A -o pid,command” to kill certain tasks.

Sata.c

  • ALPM:Aggressive Link Power Management (ALPM) is a power management protocol for Advanced Host Controller Interface-compliant (AHCI) Serial ATA (SATA) devices, such as hard disk drives and solid-state drives.

suggest_sata_alpm()

  • This function gives information of sata drive, like rotation RPM.

Urbnum.c

  • count_usb_urbsI(): it returns the nuber of USB ports in a computer
  • display_usb_activity(): this function provides usb activity data like recent usb suspended stastics, active usb name.

usb.c

  • activate_usb_autosuspend():it opens the directory “"/sys/bus/usb/devices". This is used to switch on/off the power supply to the connected devices from usb ports.

wireless.c

  • It deals with the WLAN(wireless LAN) card.
  • It helps to Enable wireless power saving mode by executing the certain command.
  • It also helps to disable the unused WIFI radio by executing the certain command.

xrandr.c

  • xrandr is an official configuration utility to the RandR X Window System extension. It can be used to set the size, orientation or reflection of the outputs for a screen.
  • activate_noTV():it is used to disable TV out.

Features

Features provided by PowerTOP are:

  • —calibrate

runs powertop in calibration mode. When running on battery, PowerTOP can track power consumption as well as system activity. When there are enough measurements, powertop can start to report power estimates. One can get more accurate estimates by using this option to enable a calibration cycle. This will cycle
through various display levels and USB device activities and workloads.

  • —csv[=FILENAME]

generate a CSV report. If a filename is not specified then the default name "powertop.csv" is used. The CSV report can be used for reporting and data analysis.

  • —debug

run in "debug" mode.

  • —extech=devnode

use the Extech Power Analyzer for measurements. This allows one to specify the serial device node of the serial to USB adaptor connecting to the Extech Power Analyzer, for example /dev/ttyUSB0.

  • —help

show the help message.

  • —html[=FILENAME]

generate an HTML report. If a filename is not specified then the default name "powertop.html" is used. The HTML report can be sent to others to help diagnose power issues.

  • —iteration[=iterations]

number of times to run each test.

  • —quiet

supress stderr output.

  • —time[=seconds]

generate a report for a specified number of seconds.

  • —version

print version information and exit

MAN PAGE:

  • 8.png
  • 9.png

Conclusion

Yes, non-effecient energy consumption by laptops is a major problem and obviously PowerTOP helps in that but still PowerTOP is not a cure at all. However, if you want to save power, you should switch off any devices and interfaces you don’t use and move to more energy-efficient hardware. PowerTOP only tells where the major part of battery get consumes and help you to change your hardware and system settings accordingly.

References

http://en.wikipedia.org/wiki/PowerTOP
http://www.makeuseof.com/tag/powertop-will-maximize-your-linux-laptops-battery-life/
https://wiki.manjaro.org/index.php/PowerTOP_to_Optimise_Laptop_Power_Consumption

Created by

Rohan Juneja(2014156)
Siddharth Singh(2014105)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License