From 81d95d6d4c039e592314ee3e0e6a8b3a9288c397 Mon Sep 17 00:00:00 2001 From: Joe Mason Date: Thu, 20 Jun 2024 19:18:37 +0000 Subject: [PATCH] Convert failing CHECK in CpuMeasurementMonitor to DumpWithoutCrash R=olivierli Bug: 340226030 Change-Id: I12185b524a71a6e2fcc46774c17c35390d7e92c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642920 Reviewed-by: Olivier Li Commit-Queue: Olivier Li Auto-Submit: Joe Mason Cr-Commit-Position: refs/heads/main@{#1317553} --- .../cpu_measurement_monitor.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/performance_manager/resource_attribution/cpu_measurement_monitor.cc b/components/performance_manager/resource_attribution/cpu_measurement_monitor.cc index f14942957f3174..caeead31e02669 100644 --- a/components/performance_manager/resource_attribution/cpu_measurement_monitor.cc +++ b/components/performance_manager/resource_attribution/cpu_measurement_monitor.cc @@ -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" @@ -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 current_cpu_usage = base::OptionalFromExpected(delegate_->GetCumulativeCPUUsage());