Commit ca8eefb7 authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Report crash count UMAs for utility process on Android

Bug: 872343
Change-Id: Icb7aef94a64039b45f2284fc9ff9fe2dba33296e
Reviewed-on: https://chromium-review.googlesource.com/c/1284062Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600113}
parent f539dad0
...@@ -147,9 +147,14 @@ void CrashMetricsReporter::CrashDumpProcessed( ...@@ -147,9 +147,14 @@ void CrashMetricsReporter::CrashDumpProcessed(
const uint64_t vm_size_kb = info.blink_oom_metrics.current_vm_size_kb; const uint64_t vm_size_kb = info.blink_oom_metrics.current_vm_size_kb;
const uint64_t blink_usage_kb = info.blink_oom_metrics.current_blink_usage_kb; const uint64_t blink_usage_kb = info.blink_oom_metrics.current_blink_usage_kb;
if (info.process_type == content::PROCESS_TYPE_GPU && app_foreground && if (app_foreground && android_oom_kill) {
android_oom_kill) { if (info.process_type == content::PROCESS_TYPE_GPU) {
ReportCrashCount(ProcessedCrashCounts::kGpuForegroundOom, &reported_counts); ReportCrashCount(ProcessedCrashCounts::kGpuForegroundOom,
&reported_counts);
} else if (info.process_type == content::PROCESS_TYPE_UTILITY) {
ReportCrashCount(ProcessedCrashCounts::kUtilityForegroundOom,
&reported_counts);
}
} }
if (info.process_type == content::PROCESS_TYPE_RENDERER && if (info.process_type == content::PROCESS_TYPE_RENDERER &&
...@@ -263,10 +268,15 @@ void CrashMetricsReporter::CrashDumpProcessed( ...@@ -263,10 +268,15 @@ void CrashMetricsReporter::CrashDumpProcessed(
} }
if (has_valid_dump) { if (has_valid_dump) {
ReportCrashCount(info.process_type == content::PROCESS_TYPE_GPU if (info.process_type == content::PROCESS_TYPE_RENDERER) {
? ProcessedCrashCounts::kGpuCrashAll ReportCrashCount(ProcessedCrashCounts::kRendererCrashAll,
: ProcessedCrashCounts::kRendererCrashAll, &reported_counts);
&reported_counts); } else if (info.process_type == content::PROCESS_TYPE_GPU) {
ReportCrashCount(ProcessedCrashCounts::kGpuCrashAll, &reported_counts);
} else if (info.process_type == content::PROCESS_TYPE_UTILITY) {
ReportCrashCount(ProcessedCrashCounts::kUtilityCrashAll,
&reported_counts);
}
} }
if (app_foreground && android_oom_kill && if (app_foreground && android_oom_kill &&
......
...@@ -49,7 +49,9 @@ class CrashMetricsReporter { ...@@ -49,7 +49,9 @@ class CrashMetricsReporter {
kRendererForegroundInvisibleWithModerateBindingOom = 14, kRendererForegroundInvisibleWithModerateBindingOom = 14,
kRendererForegroundVisibleAllocationFailure = 15, kRendererForegroundVisibleAllocationFailure = 15,
kRendererAllocationFailureAll = 16, kRendererAllocationFailureAll = 16,
kMaxValue = kRendererAllocationFailureAll kUtilityForegroundOom = 17,
kUtilityCrashAll = 18,
kMaxValue = kUtilityCrashAll
}; };
using ReportedCrashTypeSet = base::flat_set<ProcessedCrashCounts>; using ReportedCrashTypeSet = base::flat_set<ProcessedCrashCounts>;
......
...@@ -138,6 +138,51 @@ TEST_F(CrashMetricsReporterTest, GpuProcessOOM) { ...@@ -138,6 +138,51 @@ TEST_F(CrashMetricsReporterTest, GpuProcessOOM) {
"GPU.GPUProcessDetailedExitStatus"); "GPU.GPUProcessDetailedExitStatus");
} }
TEST_F(CrashMetricsReporterTest, UtilityProcessOOM) {
ChildExitObserver::TerminationInfo termination_info;
termination_info.process_host_id = 1;
termination_info.pid = base::kNullProcessHandle;
termination_info.process_type = content::PROCESS_TYPE_UTILITY;
termination_info.app_state =
base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES;
termination_info.normal_termination = false;
termination_info.binding_state = base::android::ChildBindingState::STRONG;
termination_info.was_killed_intentionally_by_browser = false;
termination_info.was_oom_protected_status = true;
termination_info.renderer_has_visible_clients = true;
TestOomCrashProcessing(
termination_info,
{CrashMetricsReporter::ProcessedCrashCounts::kUtilityForegroundOom},
nullptr);
}
TEST_F(CrashMetricsReporterTest, UtilityProcessAll) {
ChildExitObserver::TerminationInfo termination_info;
termination_info.process_host_id = 1;
termination_info.pid = base::kNullProcessHandle;
termination_info.process_type = content::PROCESS_TYPE_UTILITY;
termination_info.app_state =
base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES;
termination_info.normal_termination = false;
termination_info.binding_state = base::android::ChildBindingState::STRONG;
termination_info.was_killed_intentionally_by_browser = false;
termination_info.was_oom_protected_status = true;
termination_info.renderer_has_visible_clients = true;
CrashMetricsReporterObserver crash_dump_observer;
CrashMetricsReporter::GetInstance()->AddObserver(&crash_dump_observer);
CrashMetricsReporter::GetInstance()->CrashDumpProcessed(
termination_info,
breakpad::CrashDumpManager::CrashDumpStatus::kValidDump);
crash_dump_observer.WaitForProcessed();
EXPECT_EQ(CrashMetricsReporter::ReportedCrashTypeSet(
{CrashMetricsReporter::ProcessedCrashCounts::kUtilityCrashAll}),
crash_dump_observer.recorded_crash_types());
}
TEST_F(CrashMetricsReporterTest, RendererSubframeOOM) { TEST_F(CrashMetricsReporterTest, RendererSubframeOOM) {
ChildExitObserver::TerminationInfo termination_info; ChildExitObserver::TerminationInfo termination_info;
termination_info.process_host_id = 1; termination_info.process_host_id = 1;
......
...@@ -1114,6 +1114,8 @@ uploading your change for review. These are checked by presubmit scripts. ...@@ -1114,6 +1114,8 @@ uploading your change for review. These are checked by presubmit scripts.
<int value="15" <int value="15"
label="Visible renderer in foreground app allocation failure"/> label="Visible renderer in foreground app allocation failure"/>
<int value="16" label="All renderer allocation failure"/> <int value="16" label="All renderer allocation failure"/>
<int value="17" label="Utility process foreground OOM"/>
<int value="18" label="All utility process crashes"/>
</enum> </enum>
<enum name="AndroidResourceExtractionStatus"> <enum name="AndroidResourceExtractionStatus">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment