Commit 61ecbac2 authored by Vaibhav Raheja's avatar Vaibhav Raheja Committed by Commit Bot

Add Primary-ABI-Migration UMA Metrics

This introduces 4 new histograms to add UMA metrics for
Primary ABI Migration.

ag/12863773 is the companion CL on ARC++ side.

Bug: b/170238493
Change-Id: Ib0f970985d728630ec1297a1b38f78f08bec109f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490673
Commit-Queue: Vaibhav Raheja <vraheja@chromium.org>
Reviewed-by: default avatarJosh Horwich <jhorwich@chromium.org>
Reviewed-by: default avatarLong Cheng <lgcheng@google.com>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823781}
parent b61dc1ac
......@@ -36,6 +36,7 @@ constexpr char kUmaPrefix[] = "Arc";
constexpr base::TimeDelta kUmaMinTime = base::TimeDelta::FromMilliseconds(1);
constexpr base::TimeDelta kUmaMaxTime = base::TimeDelta::FromSeconds(60);
constexpr int kUmaNumBuckets = 50;
constexpr int kUmaPriAbiMigMaxFailedAttempts = 10;
constexpr base::TimeDelta kRequestProcessListPeriod =
base::TimeDelta::FromMinutes(5);
......@@ -301,6 +302,62 @@ void ArcMetricsService::NotifyOOMKillCount(unsigned long count) {
obs.OnArcOOMKillCount(count);
}
void ArcMetricsService::ReportArcCorePriAbiMigEvent(
mojom::ArcCorePriAbiMigEvent event_type) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
UMA_HISTOGRAM_ENUMERATION("Arc.AbiMigration.Event", event_type);
}
void ArcMetricsService::ReportArcCorePriAbiMigFailedTries(
uint32_t failed_attempts) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
UMA_HISTOGRAM_EXACT_LINEAR("Arc.AbiMigration.FailedAttempts", failed_attempts,
kUmaPriAbiMigMaxFailedAttempts);
}
void ArcMetricsService::ReportArcCorePriAbiMigDowngradeDelay(
base::TimeDelta delay) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
base::UmaHistogramCustomTimes("Arc.AbiMigration.DowngradeDelay", delay,
kUmaMinTime, kUmaMaxTime, kUmaNumBuckets);
}
void ArcMetricsService::OnArcStartTimeForPriAbiMigration(
base::TimeTicks durationTicks,
base::Optional<base::TimeTicks> arc_start_time) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!arc_start_time.has_value()) {
LOG(ERROR) << "Failed to retrieve ARC start timeticks.";
return;
}
VLOG(2) << "ARC start for Primary Abi Migration @" << arc_start_time.value();
const base::TimeDelta elapsed_time = durationTicks - arc_start_time.value();
base::UmaHistogramCustomTimes("Arc.AbiMigration.BootTime", elapsed_time,
kUmaMinTime, kUmaMaxTime, kUmaNumBuckets);
}
void ArcMetricsService::ReportArcCorePriAbiMigBootTime(
base::TimeDelta duration) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
const base::TimeTicks durationTicks = duration + base::TimeTicks();
// For VM builds, do not call into session_manager since we don't use it
// for the builds. Using base::TimeTicks() is fine for now because 1) the
// clocks in host and guest are not synchronized, and 2) the guest does not
// support mini container.
// TODO(b/172266394): Guest should itself report the timing of the upgrade.
if(IsArcVmEnabled()) {
OnArcStartTimeForPriAbiMigration(std::move(durationTicks), base::TimeTicks());
return;
}
// Retrieve ARC full container's start time from session manager.
chromeos::SessionManagerClient::Get()->GetArcStartTime(
base::BindOnce(&ArcMetricsService::OnArcStartTimeForPriAbiMigration,
weak_ptr_factory_.GetWeakPtr(), durationTicks));
}
void ArcMetricsService::OnWindowActivated(
wm::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
......
......@@ -90,6 +90,11 @@ class ArcMetricsService : public KeyedService,
void ReportNativeBridge(mojom::NativeBridgeType native_bridge_type) override;
void ReportCompanionLibApiUsage(mojom::CompanionLibApiId api_id) override;
void ReportAppKill(mojom::AppKillPtr app_kill) override;
void ReportArcCorePriAbiMigEvent(
mojom::ArcCorePriAbiMigEvent event_type) override;
void ReportArcCorePriAbiMigFailedTries(uint32_t failed_attempts) override;
void ReportArcCorePriAbiMigDowngradeDelay(base::TimeDelta delay) override;
void ReportArcCorePriAbiMigBootTime(base::TimeDelta duration) override;
// wm::ActivationChangeObserver overrides.
// Records to UMA when a user has interacted with an ARC app window.
......@@ -185,6 +190,9 @@ class ArcMetricsService : public KeyedService,
void OnArcStartTimeRetrieved(std::vector<mojom::BootProgressEventPtr> events,
mojom::BootType boot_type,
base::Optional<base::TimeTicks> arc_start_time);
void OnArcStartTimeForPriAbiMigration(
base::TimeTicks durationTicks,
base::Optional<base::TimeTicks> arc_start_time);
// Notify AppKillObservers.
void NotifyLowMemoryKill();
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Next MinVersion: 7
// Next MinVersion: 8
module arc.mojom;
import "mojo/public/mojom/base/time.mojom";
[Extensible]
enum BootType {
// This is used only for backward compatibility reasons and the value has to
......@@ -119,7 +121,23 @@ struct AppKill {
uint32 count;
};
// Next method ID: 4
// Outlines the various states that can arise while performing Primary ABI
// Migration on a ChromeOS device.
[Extensible]
enum ArcCorePriAbiMigEvent {
// If an unknown event is reported, it will be recorded as UNSUPPORTED.
kUnsupported = 0,
kMigrationCompleted = 1,
kGmsNoDowngrade = 2,
kGmsDowngradeSuccess = 3,
kGmsDowngradeFailure = 4,
kWebviewNoDowngrade = 5,
kWebviewDowngradeSuccess = 6,
kWebviewDowngradeFailure = 7,
};
// Next method ID: 8
interface MetricsHost {
// Reports boot progress events from ARC instance.
ReportBootProgress@0(array<BootProgressEvent> events,
......@@ -133,6 +151,18 @@ interface MetricsHost {
// Reports LMKD and OOM kills from ARC.
[MinVersion=6] ReportAppKill@3(AppKill app_kill);
// Reports migration event by ARC Metrics Service.
[MinVersion=7] ReportArcCorePriAbiMigEvent@4(ArcCorePriAbiMigEvent event);
// Reports number of failed ABI Migration attempts by ARC Metrics Service.
[MinVersion=7] ReportArcCorePriAbiMigFailedTries@5(uint32 failed_attempts);
// Reports ABI Migration system packages downgrade delay by ArcMetricsService.
[MinVersion=7] ReportArcCorePriAbiMigDowngradeDelay@6(mojo_base.mojom.TimeDelta delay);
// Reports boot time during ABI Migration by ARC Metrics Service.
[MinVersion=7] ReportArcCorePriAbiMigBootTime@7(mojo_base.mojom.TimeDelta duration);
};
// Next method ID: 3
......
......@@ -3228,6 +3228,19 @@ Unknown properties are collapsed to zero. -->
<int value="3" label="Crashed"/>
</enum>
<enum name="ArcCorePriAbiMigEvent">
<!-- Value from components/arc/mojom/metrics.mojom -->
<int value="0" label="Unsupported"/>
<int value="1" label="Migration Completed"/>
<int value="2" label="GMS No Downgrade"/>
<int value="3" label="GMS Downgrade Success"/>
<int value="4" label="GMS Downgrade Failure"/>
<int value="5" label="Webview No Downgrade"/>
<int value="6" label="Webview Downgrade Success"/>
<int value="7" label="Webview Downgrade Failure"/>
</enum>
<enum name="ArcCustomTabsSessionEndReason">
<int value="0" label="Closed"/>
<int value="1" label="Forwarded to a normal tab"/>
......@@ -21,6 +21,42 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histograms>
<histogram name="Arc.AbiMigration.BootTime" units="ms"
expires_after="2021-10-10">
<owner>vraheja@chromium.org</owner>
<owner>arc-core@google.com</owner>
<summary>Time taken for ARC to boot during an Abi Migration event.</summary>
</histogram>
<histogram name="Arc.AbiMigration.DowngradeDelay" units="ms"
expires_after="2021-10-10">
<owner>vraheja@chromium.org</owner>
<owner>arc-core@google.com</owner>
<summary>
Time taken by ArcAbiMigrationService specifically to downgrade system
packages.
</summary>
</histogram>
<histogram name="Arc.AbiMigration.Event" enum="ArcCorePriAbiMigEvent"
expires_after="2021-10-10">
<owner>vraheja@google.com</owner>
<owner>arc-core@google.com</owner>
<summary>
Records event type for ArcAbiMigrationService during Abi Migration.
</summary>
</histogram>
<histogram name="Arc.AbiMigration.FailedAttempts" units="units"
expires_after="2021-10-10">
<owner>vraheja@chromium.org</owner>
<owner>arc-core@google.com</owner>
<summary>
Records the number of failed attempts in trying to perform Primary Abi
Migration.
</summary>
</histogram>
<histogram name="Arc.AccessibilityWithTalkBack" enum="BooleanEnabled"
expires_after="2021-07-01">
<owner>hirokisato@chromium.org</owner>
......
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