From 0aeca5f12374fdbf3d4f6c656abf950ba2a96f1c Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Wed, 21 Sep 2016 10:40:36 -0700 Subject: [PATCH] UMA changes based on Chromium-side review Per comments in https://codereview.chromium.org/2350943003/: - Increase the upper bound for Crashpad.CrashReportSize to 20M - Make ExceptionEncountered a 2 enum bucket to track start/end. R=asvitkine@chromium.org, mark@chromium.org BUG=crashpad:100 Change-Id: Ie848b2e3744c58f6d669986d3e78e7391b0e9e68 Reviewed-on: https://chromium-review.googlesource.com/387685 Reviewed-by: Mark Mentovai --- util/misc/metrics.cc | 25 +++++++++++++++++++++++-- util/misc/metrics.h | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/util/misc/metrics.cc b/util/misc/metrics.cc index 545495a2..6967398d 100644 --- a/util/misc/metrics.cc +++ b/util/misc/metrics.cc @@ -20,15 +20,36 @@ namespace crashpad { +namespace { + +//! \brief Metrics values used to track the start and completion of a crash +//! handling. These are used as metrics values directly, so +//! enumeration values so new values should always be added at the end. +enum class ExceptionProcessingState { + //! \brief Logged when exception processing is started. + kStarted = 0, + + //! \brief Logged when exception processing completes. + kFinished = 1, +}; + +void ExceptionProcessing(ExceptionProcessingState state) { + UMA_HISTOGRAM_COUNTS("Crashpad.ExceptionEncountered", + static_cast(state)); +} + +} // namespace + // static void Metrics::CrashReportSize(FileHandle file) { const FileOffset size = LoggingFileSizeByHandle(file); UMA_HISTOGRAM_CUSTOM_COUNTS( - "Crashpad.CrashReportSize", size, 0, 5 * 1024 * 1024, 50); + "Crashpad.CrashReportSize", size, 0, 20 * 1024 * 1024, 50); } // static void Metrics::ExceptionCaptureResult(CaptureResult result) { + ExceptionProcessing(ExceptionProcessingState::kFinished); UMA_HISTOGRAM_ENUMERATION("Crashpad.ExceptionCaptureResult", static_cast(result), static_cast(CaptureResult::kMaxValue)); @@ -47,7 +68,7 @@ void Metrics::ExceptionCode(uint32_t exception_code) { // static void Metrics::ExceptionEncountered() { - UMA_HISTOGRAM_COUNTS("Crashpad.ExceptionEncountered", 1); + ExceptionProcessing(ExceptionProcessingState::kStarted); } } // namespace crashpad diff --git a/util/misc/metrics.h b/util/misc/metrics.h index acb0e7d6..64fb1af3 100644 --- a/util/misc/metrics.h +++ b/util/misc/metrics.h @@ -71,7 +71,7 @@ class Metrics { }; //! \brief Reports on the outcome of capturing a report in the exception - //! handler. + //! handler. Should be called on all capture completion paths. static void ExceptionCaptureResult(CaptureResult result); //! \brief The exception code for an exception was retrieved.