profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Automating the process of evaluating energy consumption

Open mgifford opened this issue 1 year ago • 0 comments

I'd like to evaluate how much energy it takes to load a bunch of web pages. I really can't do this manually in order to provide any useful information.

I want to be able to set up a simple script to load a random site in a new instance: open -a Firefox 'http://www.whitehouse.gov'

I'm on a Mac, so maybe it would be best to run powermetrics with something like: sudo powermetrics –samplers tasks –show-process-coalition –show-process-gpu -n 1 -i 5000

Then maybe I need to run an AppleScript with something like this:

activate application "Firefox"
tell application "System Events" to keystroke "r" using command down

Then pull out the combined power from the results of the powermetrics script, which I think looks like Combined Power (CPU + GPU + ANE): 633 mW.

This is what I'm gathering from https://firefox-source-docs.mozilla.org/performance/power_profiling_overview.html

Although I don't know if that would leverage the https://profiler.firefox.com

Maybe this whole thing needs to open in AppleScript so I also tell Firefox to quit. I think this might work.

Ideally I'd like to just open up a site with dev-tools running, wait until the page loads, and then dumps a summary of the results to the command line. This isn't right, but something like this would be nice: open -a Firefox -devtools -energy 'http://www.whitehouse.gov'

Is this possible, or is the only way to determine energy consumption via the profiler to actually look at the timeline and pick out points where there are higher points of consumption. I'm not interested in the consumption over time, but the difference from one load to the next.

Any suggestions?

┆Issue is synchronized with this Jira Task

mgifford avatar Apr 29 '23 17:04 mgifford