Closed Bug 1204787 Opened 9 years ago Closed 9 years ago

Add |mach power|

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

(Whiteboard: [Power])

Attachments

(1 file, 1 obsolete file)

I have a shell script that runs tools/power/rapl and powermetrics and extracts the most useful stat from them for Firefox, Safari and Chrome. It has become my starting point for evaluating power consumption on any new website. Example output can be seen in bug 1190719 comment 17.

I want to get this in the tree so other people can use it.
Attached patch Add |mach power| (obsolete) — Splinter Review
There is a "njn" comment in there for something I didn't know how to do --
check if we're running on Mac OS X 10.10 or later.
Attachment #8661088 - Flags: review?(mh+mozilla)
Comment on attachment 8661088 [details] [diff] [review]
Add |mach power|

Review of attachment 8661088 [details] [diff] [review]:
-----------------------------------------------------------------

::: tools/power/mach_commands.py
@@ +23,5 @@
> +        MachCommandBase.__init__(self, context)
> +
> +    @Command('power', category='misc',
> +        # njn: want to check for Mac 10.10 or above here...
> +        #conditions=[...],

You want to give a function that checks StrictVersion(platform.mac_ver()[0]) >= StrictVersion('10.10'), where StrictVersion is imported from distutils.version.

@@ +102,5 @@
> +        # could do this by properly parsing powermetrics output, but it's
> +        # simpler and more robust to just grep for a handful of identifying
> +        # strings.
> +
> +        print()

Why the empty line?
Attachment #8661088 - Flags: review?(mh+mozilla) → feedback+
> > +        print()
> 
> Why the empty line?

So there's a blank line between the rapl output and the powermetrics output. I'll add a comment.
Attached patch Add |mach power|Splinter Review
Now with a proper "OS X 10.10 or greater" condition.
Attachment #8662153 - Flags: review?(mh+mozilla)
Attachment #8661088 - Attachment is obsolete: true
Comment on attachment 8662153 [details] [diff] [review]
Add |mach power|

Review of attachment 8662153 [details] [diff] [review]:
-----------------------------------------------------------------

::: tools/power/mach_commands.py
@@ +18,5 @@
> +
> +
> +def is_osx_10_10_or_greater(cls):
> +    import platform
> +    mac_ver0 = platform.mac_ver()[0]

release would be a more explicit name than mac_ver0, and matches the definition of what mac_ver() returns.

@@ +110,5 @@
> +        # could do this by properly parsing powermetrics output, but it's
> +        # simpler and more robust to just grep for a handful of identifying
> +        # strings.
> +
> +        print()

You forgot comment 3.
Attachment #8662153 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/c7cc8e32b62f
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: