In an upcoming CL, ProcessMonitor will no longer be involved in sampling
coalition resource usage. In preparation for that change, the code that
computes resource usage rate from 2 coalition resource usage samples is
moved out of //chrome/browser/performance_monitor/ to
//components/power_metrics/. Moving the code to a standalone function
also facilitates testing.
This CL does not change behavior, except that it use an optional field
for "energy impact" to make it possible not to report the value if it
couldn't be evaluated (previously, "0" was reported). This new behavior
is tested by
PowerMetricsReporterUnitTest.ReportResourceCoalitionHistograms_NoEnergyImpact.
Bug: 1293465
Change-Id: Ib478603a82d8c23e526336b3c44add66e2faeab3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3433768
Reviewed-by: Patrick Monette <pmonette@chromium.org>
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#966959}