Change the value for CO2e calculations in Firefox Profiler
Published:
Table of Contents
This is cool. So earlier this year, through my role with the Green Web Foundation, we did some work to add carbon emissions estimates to the Firefox Profiler. You can read more about that over on my blog.
When we rolled it out this feature, we used the global average grid intensity to convert the amount of energy used into an estimated CO2e value. Recently, the Firefox team have made a further update to this feature which greatly improves on this! Now, if you want to use a different grid intensity value (in grams CO2e per kilowatt-hour) then you can change that, and have that change persist when you share the Profile.
How to change the grid intensity value
Section titled How to change the grid intensity valueTake this Power Profile I took recently for my article on the power consumption of different image formats. In the screenshot below, you can see a CO2e value of 0.16 mg for the entire recorded range. If you open the profile, you can see this yourself by hovering your mouse of the power track.

This value is calculated using the global average grid intensity (about 436 gCO2e/kWh at the time of writing). If I want to use a different grid intensity value instead, then I can do this via the console in my browser. Opening the console, and typing window.profile.meta.gramsOfCO2ePerKWh = 1000 will set the grid intensity used in the calculation to 1000 gCO2e/kWh. And you can see in the screenshot below, we now see a different (higher) value of 0.37 mg for the entire recorded range. I've zoomed in on this screenshot to make it clearer.

What's even better is that now, if I re-upload the profile, the new CO2e value will remain. You can see that for yourself here: https://share.firefox.dev/3ZgO8wR