How to get apps using significant energy programatically like battery icon from MacBook

Viewed 245

I am trying to get a significant energy consuming app list as it shows in the battery icon in MacBook programmatically.

![enter image description here][1]

Like Below... [1]: https://i.stack.imgur.com/bapoI.png

Any help would be appreciated.

I tried to use the following top command in a code but it's not working.

top  -stats -l 1 -O pid,command,cpu,idlew,power -o power -d
2 Answers

Try using -

top -stats pid,command,cpu,idlew,power -o power -d
Related