Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an optional gramsOfCO2ePerKWh field to the meta data of processed profiles #4672

Merged
merged 1 commit into from Jun 20, 2023

Conversation

fqueze
Copy link
Contributor

@fqueze fqueze commented Jun 19, 2023

I see this as a first step towards fixing #4479:

  • if someone is power profiling Firefox and knows the carbon intensity of the electricity they used, it's possible to set the meta field from the devtools console before uploading (or reuploading) the profile.
  • for profiles generated by sources other than the GeckoProfiler, it's possible to specify the carbon intensity explicitly in the profile JSON. (I have a use case where I am power profiling various appliances running in my house.)

If we want to go one step further towards fixing #4479, I think the next step would be to have a preference in Firefox that could be set using about:config to customize the carbon intensity in Firefox, and have it included in all captured power profiles.

And a last step could be to allow setting this preference from an input field in about:profiling. I think each of these steps provides an incremental improvement and they could be done separately.

… profile to enable customizing the carbon intensity of power tracks.
@fqueze fqueze requested a review from julienw June 19, 2023 17:32
@codecov
Copy link

codecov bot commented Jun 19, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (8a43076) 88.47% compared to head (6202f1f) 88.47%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4672   +/-   ##
=======================================
  Coverage   88.47%   88.47%           
=======================================
  Files         295      295           
  Lines       26299    26299           
  Branches     7099     7100    +1     
=======================================
  Hits        23269    23269           
  Misses       2818     2818           
  Partials      212      212           
Impacted Files Coverage Δ
src/components/tooltip/TrackPower.js 94.33% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if someone is power profiling Firefox and knows the carbon intensity of the electricity they used, it's possible to set the meta field from the devtools console before uploading (or reuploading) the profile.

I wonder where we could document this. Maybe it's about time to have a dedicated page about this in our docs, what do you think?

const { WORLD } = averageIntensity.data;
return energy * WORLD;
const intensity =
this.props.meta.gramsOfCO2ePerKWh || averageIntensity.data.WORLD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use ?? instead of || so that we test for its absence rather than it being falsy. Indeed I guess it's theorically possible to have it set to 0 in case of 100% renewable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 doesn't make sense, even for renewable. As an example, my renewable electricity provider estimates the carbon intensity of its electricity at 18.5g per kWh for production plus 5.15g per kWh for distribution. Using solar panels on my roof would have about the same footprint. If we wanted to support the 0 value, I would expect its meaning to be "hide everything in the UI that talks about CO2eq".

@fqueze
Copy link
Contributor Author

fqueze commented Jun 20, 2023

if someone is power profiling Firefox and knows the carbon intensity of the electricity they used, it's possible to set the meta field from the devtools console before uploading (or reuploading) the profile.

I wonder where we could document this. Maybe it's about time to have a dedicated page about this in our docs, what do you think?

I agree, I opened #4673.

@fqueze fqueze merged commit c2edadc into firefox-devtools:main Jun 20, 2023
16 checks passed
@canova canova mentioned this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants