Skip to content

Commit

Permalink
Convert failing CHECK in CpuMeasurementMonitor to DumpWithoutCrash
Browse files Browse the repository at this point in the history
R=olivierli

Bug: 340226030
Change-Id: I12185b524a71a6e2fcc46774c17c35390d7e92c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642920
Reviewed-by: Olivier Li <[email protected]>
Commit-Queue: Olivier Li <[email protected]>
Auto-Submit: Joe Mason <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1317553}
  • Loading branch information
JoeNotCharlesGoogle authored and win32ss committed Jan 5, 2025
1 parent 81a69ad commit 81d95d6
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/overloaded.h"
Expand Down Expand Up @@ -945,7 +947,17 @@ void CPUMeasurementMonitor::CPUMeasurement::MeasureAndDistributeCPUUsage(
// No time has passed to measure.
return;
}
CHECK_LT(measurement_interval_start, measurement_interval_end);
// TODO(crbug.com/340226030): Replace with a CHECK.
if (measurement_interval_start > measurement_interval_end) {
SCOPED_CRASH_KEY_NUMBER(
"cpu_measurement", "start",
measurement_interval_start.since_origin().InMicroseconds());
SCOPED_CRASH_KEY_NUMBER(
"cpu_measurement", "end",
measurement_interval_end.since_origin().InMicroseconds());
base::debug::DumpWithoutCrashing();
return;
}

std::optional<base::TimeDelta> current_cpu_usage =
base::OptionalFromExpected(delegate_->GetCumulativeCPUUsage());
Expand Down

0 comments on commit 81d95d6

Please sign in to comment.