PowerTOP for OpenSolaris
Overview
PowerTOP is an observability tool that shows how effectively your system is taking advantage of the CPU's power management features. By running the tool on an otherwise idle system, you can see how much time the CPUs are spending running in lower power states. Ideally, an unutilized (idle) system will spend 100% of its time running at the lowest power CPU states, but because of background user and kernel activity (random software periodically waking to poll status), idle systems typically consume more power than they should.
PowerTOP shows you which software (user and kernel) is waking up, and how often. By fixing, filing bugs against, (or just not running) power inefficient software you can help improve your system's power efficiency.
More information about the Linux version of PowerTOP can be found here.
Download
Version 1.1 is available through SVR4 packages and require Solaris Nevada build 82 or better.
Use tar(1) to uncompress, then pgkadd(1M) to install. Use pkgrm(1M) to uninstall.
Please report bugs and feedback to the development team alias, tesla-dev@opensolaris.org.
Status
- PowerTOP has been integrated into snv_100 on September 23rd, 2008. It will be part of OpenSolaris 2008.11 to be released later this year.
- PowerTOP v1.1 has been released on July 21st, 2008. The new version features new options, increased functionalities and several bug fixes. Among the new features are:
- Cross calls have been added to the event report
- PowerTOP will display all of the available processor states, resizing its subwindows accordingly
- New option for dumping the analysis to the screen for a specified number of times
- PowerTOP runs on xVM Server as of Solaris Nevada build 94

Changelog for 1.1 (indexed by the repository's revision/changeset number):
5961:1c1174047c7a : PowerTOP's windows flicker on some systems 5960:cd8dc39ce8cb : 2586 residency and average values overflowing 5959:758269452891 : Fix #define print(), no battery snapshot if no kstat module and version 1.1 5958:d9e4d5d57a4e : 2394 PowerTOP segfaults on libcurses.so.1`getmaxy+4() 5957:9ed270691352 : 2540 PowerTOP doesn't show battery information when fully charged and plugged in 5956:f3359ae782d5 : Return values, header cleanup 5955:9b1c31702fc2 : Clear lint, passes one and two 5954:339748282add : Fix cstyle, sccs keywords 5953:6a2cca9e6186 : 2431 PowerTOP shpuld use wnoutrefresh() and doupdate() 5952:47ca80460eea : Non numerical values when the system doesn't transition state 5951:e9ab1d5fa6e0 : fix powertop p-state number limitation 5950:8f3616a1fdc0 : cpupm suggestion shouldn't appear if p-state transition is not supported 5949:5ff89cae3d23 : Move idle-state-transition from mach_cpu_idle() to cpu_idle() to include xVM 5948:222c995fda61 : Add dump [count] option 5947:271245b140c4 : Filter invalid intervals and fix initial message 5946:6459cc573263 : Add kstat battery module lookup 5945:abffa8abed71 : Follow 6682365 and update kstat's battery module to acpi_drv 5944:45d1819fddf9 : PowerTOP dumps core when -d option is followed by keystrokes 5943:81cccedbddca : Fixes to interval and avg residency calculation 5942:abfd51222b22 : Fix usage, exit status, command line option 5941:6ad26c71e18a : Too many blank lines between states and wakeups report 5940:acd5524b920a : Adding xcalls to event report
- PowerTOP v1.0 has been released on May 14th, 2008. The PowerTOP command consumes several DTrace probes that were integrated into Nevada build 82. Therefore, for complete functionality the PowerTOP command should be run on a system based on Nevada build 82 (or better), or BFUed with archives constructed from the PowerTOP source respository.
Development
- Building PowerTOP: After cloning the repository (see below), modify the opensolaris.sh file (under usr/src/tools/env/) according to your configuration. Run 'bldenv opensolaris.sh' to set up your environment variables and 'dmake' on usr/src/cmd/powertop to build the tool. The binary will be created under the architecture specific directory.
- LINT: PowerTOP is LINT free for both passes one and two. When changing the code, make sure to run 'dmake lint' and that the output has no erros or warnings.
- Style checks: PowerTOP follows the same cstyle rules as the WOS. Make sure to run 'hg pbchk' prior to integrating changes to the repo.
- Bug report: we track changes to the source code with defect.opensolaris.org, so if you're working on a bug or feature, make sure that:
a. There's a CR filed for that particular change
b. Assign yourself to that CR
c. Add a comment explaining the bug/feature, including platform details if applied
d. Add a comment explaining the fix (with a link to the thread if applied)
e. Change to closed with resolution to fixed after integrating - Integrating: we follow similar rules to that of the ON consolidation. Every changeset must be reviewed by at least one more senior project member. We encourage that review to take place in the open, you should upload the suggested changes to cr.opensolaris.org and send the link to the tesla-dev alias, requesting a code review. After the reviewer(s) okay your changes, push the changeset as soon as possible. The comments should be the CR number (in defect.opensolaris.org) followed by its title.
- Please consult the OpenSolaris Developer's Reference if you have any questions - or drop us a line over at tesla-dev@opensolaris.org.
PowerTOP OpenSolaris Source Repository
- powertop: Anonymous pull is allowed. You must either be a leader of this project (or a committer for the ptop-core or ptop-full repositories) to push. Please read these instructions on how to use Mercurial repositories.
To bringover from the PowerTOP repository
$ hg clone ssh://your-login@hg.opensolaris.org/hg/tesla/ptop-core
The ptop-core repository only contains the source code for PowerTOP, and is the one used for development. We also keep a complete repository of the ON tree (which includes PowerTOP) at
$ hg clone ssh://your-login@hg.opensolaris.org/hg/tesla/ptop-full
which we maintain in case changes require modifications in other parts of ON. ptop-full is synced against snv_113.
To build PowerTOP with a clone of ptop-core, follow these steps:
/sandbox/powertop/ptop-core$ bldenv opensolaris.sh
/sandbox/powertop/ptop-core$ cd powertop
/sandbox/powertop/ptop-core$ dmake