Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve how we compute the power consumption numbers from the Firefox…
… Profiler output (#2220) * Add power consumption of all the processes while calculating the total power consumption Gecko profile json includes child processes inside it's `profile.processes` array. It's recursive data type that has the same properties. Previously we were only calculating the power consumption of the parent process. With this change, we should be able to add the consumption of all the processes, including the content process (which has the most impact), utility processes, webextension process etc. * Fix a typo * Do not add the individual cpu component power values since 'CPU Package' will include them For Linux and Windows power values there is always a counter called 'CPU Package', this is the one we usually want. And besides this one, we might have individual CPU components, like DRAM, iGPU, individual CPU cores etc. These values are coming from individual components, but they are already included inside the 'CPU Package' metrics. So this means that in these platforms, if these individual components are captured, we are counting the power usage values twice. The values could look higher than it should. See the available tracks here: Linux: https://searchfox.org/mozilla-central/rev/5ad94327fc03d0e5bc6aa81c0d7d113c2dccf947/tools/profiler/core/PowerCounters-linux.cpp#48-70 Windows: https://searchfox.org/mozilla-central/rev/5ad94327fc03d0e5bc6aa81c0d7d113c2dccf947/tools/profiler/core/PowerCounters-win.cpp#32-55 So we shouldn't add them on top of the whole CPU package number, otherwise it might look like we consume double the power that CPU normally consumes. * Ignore the first counter value as it might be incorrect or unreliable This is already done in the profiler frontend here: https://github.com/firefox-devtools/profiler/blob/6a683fa6ae2733dae49ff460edf6ee98ca626f09/src/profile-logic/profile-data.js#L1740-L1743 Some platforms sometimes provide incorrect or unrealistic values. We should remove these values so it doesn't generate an incorrect value. Since this is only one value in a profile, we are not really concerned in case it's a correct number. It's a very small difference in a big array, removing this value is always safer.
- Loading branch information