[power benchmarks] Handle gracefully when CPU time at QoS decreases.
We observed on multiple machines that the CPU time at QoS reported by the resource coalition API can decrease over time. With this CL, GetCoalitionResourceUsageDifference() reports no CPU time at QoS when this happens, instead of DCHECKing. Bug: 1395675 Change-Id: I5930b1b4711327347741c129ae3103b535651535 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4075472 Reviewed-by: Olivier Li <olivierli@chromium.org> Commit-Queue: Olivier Li <olivierli@chromium.org> Auto-Submit: Francois Pierre Doray <fdoray@chromium.org> Cr-Commit-Position: refs/heads/main@{#1079406}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
58ad785af9
commit
665589e0ee
@ -123,8 +123,13 @@ coalition_resource_usage GetCoalitionResourceUsageDifference(
|
||||
|
||||
ret.cpu_time_eqos_len = left.cpu_time_eqos_len;
|
||||
for (int i = 0; i < COALITION_NUM_THREAD_QOS_TYPES; ++i) {
|
||||
DCHECK_GE(left.cpu_time_eqos[i], right.cpu_time_eqos[i]);
|
||||
ret.cpu_time_eqos[i] = left.cpu_time_eqos[i] - right.cpu_time_eqos[i];
|
||||
if (right.cpu_time_eqos[i] > left.cpu_time_eqos[i]) {
|
||||
// TODO(fdoray): Investigate why this happens. In the meantime, pretend
|
||||
// that there was no CPU time at this QoS.
|
||||
ret.cpu_time_eqos[i] = 0;
|
||||
} else {
|
||||
ret.cpu_time_eqos[i] = left.cpu_time_eqos[i] - right.cpu_time_eqos[i];
|
||||
}
|
||||
}
|
||||
|
||||
ret.cpu_instructions = left.cpu_instructions - right.cpu_instructions;
|
||||
|
Reference in New Issue
Block a user