Make UMA for exception code OS-specific

R=wfh@chromium.org, mark@chromium.org
BUG=crashpad:100

Change-Id: I9368168405d1bd761ae6205955968264543541c4
Reviewed-on: https://chromium-review.googlesource.com/386989
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Scott Graham 2016-09-19 14:47:13 -07:00
parent b48e9bfbab
commit 72a12e2e94
2 changed files with 15 additions and 3 deletions

View File

@ -14,6 +14,8 @@
#include "handler/win/crash_report_exception_handler.h"
#include <type_traits>
#include "client/crash_report_database.h"
#include "client/settings.h"
#include "handler/crash_report_upload_thread.h"
@ -65,6 +67,10 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
// can terminate the process with the correct exit code.
const unsigned int termination_code =
process_snapshot.Exception()->Exception();
static_assert(
std::is_same<std::remove_const<decltype(termination_code)>::type,
decltype(process_snapshot.Exception()->Exception())>::value,
"expected ExceptionCode() and process termination code to match");
Metrics::ExceptionCode(termination_code);

View File

@ -16,6 +16,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "build/build_config.h"
namespace crashpad {
@ -33,9 +34,14 @@ void Metrics::ExceptionCaptureResult(CaptureResult result) {
}
// static
void Metrics::ExceptionCode(uint32_t code) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Crashpad.ExceptionCode",
static_cast<int32_t>(code));
void Metrics::ExceptionCode(uint32_t exception_code) {
#if defined(OS_WIN)
const char kExceptionCodeString[] = "Crashpad.ExceptionCode.Win";
#elif defined(OS_MACOSX)
const char kExceptionCodeString[] = "Crashpad.ExceptionCode.Mac";
#endif
UMA_HISTOGRAM_SPARSE_SLOWLY(kExceptionCodeString,
static_cast<int32_t>(exception_code));
}
// static