Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there a way to retrieve the current watt usage info on OS X Snow Leopard? I'm using mid-2010 iMac, so I'm not looking for just battery-related apps.

Does OS X even monitor power usage? Do I need to use an external reader between the power cord and the outlet?

I'm most interested in command-line/applescript based solutions for more convenient logging & stats, but I'm open for alternatives.


Both (@bmike's & @michaelmichael's) answers are undoubtedly correct. The meta–question in here was that is there any sensors/readers already on the PSU, that would work kind of like the way "kill-a-watt" works. I sense the answer for that is "no".

I know, it probably is just a wet dream, but a watt meter on board would be ideal for the computer to shout: "Look how eco-friendly I am; using just these watts!"


Ah!

@Kerri Shotts' suggested iStat Menus 3 do get the wattage readings from some sensor, along with volt and amp stats. So the meters are there, but how I could access them programmatically?


Bounty! Will be given for solid command-line sensor reading solution or for recommending exceptionally good 3rd party software (like one with statistical and historical data tools at minimum).

Just to inform: the aforementioned iStat Menus 3 lists the following power related sensors:

  • Voltage Sensors (Volts)
    • AC/DC
    • AC/DC
    • AC/DC Shunt
    • CPU
    • CPU 1.8V S0
    • CPU CTT
    • Graphics Module
    • Memory
  • Current Sensors (Amps)
    • AC/DC
    • CPU
    • CPU VTT
    • Graphics Module
  • Power Sensors (Watts)
    • AC/DC
    • CPU
    • Graphics Module

It does state "sensors", but they might be calculated as @msanford commented. How can I get my hands on that data programmatically?

share|improve this question
    
Macs are very eco friendly and the testing of a unit is done by Apple as well as labs with calibrated test rigs. Luckily we can use the settings to maximize the macs we have while they come up with more efficient models tomorrow. –  bmike Jun 18 '11 at 1:00
1  
Does the PSU not report its current load (as I'm fairly sure it reports its voltage)? If so, P = IV, or Watts = Current (in amperes) • Voltage (in volts). Wattage isn't something that's directly measured but calculated from current and voltage, so I wouldn't expect a sensor to report watts if there are already reports on voltage and current. If that helps… –  msanford Jun 19 '11 at 18:02
    
@msanford it might help—if someone tells us how to read the readings from the PSU. –  koiyu Jun 20 '11 at 12:21
add comment

8 Answers

IANAEE (I am not an Electrical Engineer), but as I understand it's not possible to accurately measure a computer's power consumption via software. The best solution is to connect your Mac to a device like a Kill-a-Watt

If you're looking for a scriptable solution - and an interesting project - here are instructions on creating a wireless wattage monitoring system, or a "Tweet-a-Watt".

share|improve this answer
add comment

This doesn't satisfy the command-line requirements, but give a try to iStat Menus 3. It gives you readings on just about every sensor in your machine (which for me includes AC/DC Watts, CPU Watts, and GPU Watts). I'm sure it isn't 100% accurate, but it was more than accurate enough in tuning my machine to work within the limited constraints of my APC battery.

All that said, my machine is a 2010 iMac, so depending on your machine, it may or may not work. In addition, I don't see power readings specifically for the HDD (which should be minimal), or anything specific to the display (that said, reducing LCD brightness reduces the wattage quite a bit, so it is counted in total).

Worth a try at least. IIRC there is a free version, but it was so worth it that I went ahead and paid for it. I'm a bit of a control freak, so I have memory, temperature, disk activity, network activity, etc., in my menubar and love it. :-)

share|improve this answer
1  
Par excellence! Now the question is: how do iStat Menus get the sensor readings… –  koiyu Jun 18 '11 at 14:24
add comment

There is a paid application called Hardware Monitor that provides access to pretty much every sensor available on a mac including voltage, current and wattage which I believe you are looking for. It does include a command line utility to read this information.

I used this to track down a faulty logicboard in an iMac last year and found it worth the €7. It includes the ability to output the sensor values to a CSV which can be helpful for logging and visual display of the data. I'm not sure if it does PSU readings (as I don't have the app on the machine I'm on atm) but it hits pci, slots, cpu and lots of other.

You can find the software here : http://www.bresink.com/osx/HardwareMonitor.html

I'm not associated with this company at all, just found the tool to be very useful in my diagnostics arsenal.

share|improve this answer
    
Lyken wins the prize with this answer. What an amazing piece of software. Command line tool, menu bar, and full app. Unless the power supply itself is monitored in new macs, it won't give a total power rating, but this sure does a great job accessing all the data that is available. –  bmike Jun 21 '11 at 20:34
    
Sorry for the late update, but, @Lyken, your +100 is well deserved: I hesitated on giving the full +200 as Hardware Monitor seemingly won't give the PSU wattage like iStat Menus 3 does; for some reason the HWM lists power sensors only for CPU A, 4 CPU High Sides and MXM Graphics Module. Great app nevertheless and I would had awarded your answer in a breeze if some other bounty answer would've met the automatic half-bounty-award rules. Like I said, +100 well deserved. –  koiyu Jun 29 '11 at 9:39
    
Yes, I do believe that HWM reads the sensors on a per model basis so it depends on what is available on your version. Did iStat Menu 3 read the PSU wattage on your model also? –  Digitalchild Jun 29 '11 at 23:55
add comment

No metered sensors are present in the power supply.

The logic board measures temperature in several places to control the blowers and the CPU monitors temp to reduce clock rate when it becomes warmer than the blowers can cool it.

I suppose some PHD thesis might be done on integrating the fan speed and various temperature sensors to calculate an expected power consumption. It's possible to get a calculation and with some calibration, it might even be pretty accurate.

In reality since that data isn't exposed or recorded, you might have to measure externally. Decent home energy counters are between $150 and $300 w

You could rent or buy a unit that measures the power through the outlet and then run some test to see how much power the mac takes over an hour in certain conditions.

  • Off
  • Sleep
  • Idle
  • Various CPU loads
  • Maximum CPU, everything going

Then you could correlate these with CPU usage monitoring that is trivial over time using top and be able to add things up.

It all depends on what you really want to do with the data other than learn how the hardware works and have some cool graphs.

share|improve this answer
2  
+ you need to add ad infinitum more things to the list. Probably by the time I'd had all conditions calibrated I would need to replace the current iMac :-D Maybe just some external basic W & kWh meters would do the trick, if there are no meters onboard. –  koiyu Jun 17 '11 at 18:24
1  
:-) Glad you got the humor. My experience is that the macs draw 20 to 25% less than the specifications published by Apple even under rigorous tests to get everything drawing at max power. –  bmike Jun 18 '11 at 0:58
    
@bmike I wouldn't be so sure about that, the rMBP is known to drain battery when sufficiently loaded on the CPU+GPU due to the 85W adapter providing insufficient current. –  Steven Lu Jun 6 '13 at 3:41
    
@stevenlu I wouldn't be surprised if the latest 2013 era hardware pushes harder than the mid 2010 era tech that's being discussed here. Similarly, power management on 10.8 is more sophisticated than 10.6 was. –  bmike Jun 6 '13 at 9:24
add comment

system_profiler SPPowerDataType seems to provide the most relevant information. On laptops it reports voltage and amperage which can give you the power consumption (mVolts × mAmperes × 10^-6 = Watts). It also reports Wattage, but that's actually a piece of metadata reported by Apple's power adapter, third-party power adapters can show blanks here. Since desktops do not have rechargeable batteries, there's no way to calculate power consumption by measuring charging and discharging of battery.

But wait, there's still hope! Apple publishes a lot of source code, and googling for Wattage or Power+mV hints that certain kernel extensions can be queried about power consumption. Unfortunately, I cannot come up with a working script right now, but it seems possible.

share|improve this answer
    
I see it is the command-line interface for the System Profiler.app. Sadly, on desktops, it just shows the settings from EnergySaver.prefpane and if an UPS is installed. –  koiyu Jun 26 '11 at 8:49
add comment

All of the data in iStat is just from keys in the ioregistry. You can pull a dump of it from the command line using ioreg:

ioreg -w 0 -l

That is going to be a lot of data to look through, you can carve it up in various ways. I do not believe the actual data you want is provided on iMac, the system monitors temperature in a number of places, but since it does not run on a battery it is less important to know the instantaneous current being pulled by the system, and thus probably not worth the cost of a sensor.

share|improve this answer
add comment

I think that for 10.7 this should work from the terminal:

ioreg -l | grep LegacyBatteryInfo | cut -d '{' -f 2 | tr -d \} | tr ',' '=' | awk -F'=' '{print ($2*$10/10^22)}'

share|improve this answer
2  
ioreg -l | grep LegacyBatteryInfo returns nothing for me on iMac. –  koiyu Mar 23 '12 at 5:56
add comment

I am on a MacBook 10.6.8 and ioreg -l | grep LegacyBatteryInfo worked for me.

I previously tried

ioreg -l | grep LegacyBatteryInfo | \
    cut -d '{' -f 2 | tr -d \} | tr ',' '=' | \
    awk -F'=' '{print ($2*$10/10^22)}' 

and it returned 0.

Is there a solution from Apple's Dev library?

Why not look outside on the power meter? Record your readings and then correlate to a constant and common %CPU usage. Then you can get a approximation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.