0

tps: Implement Arc UI Available histograms for tast.

Current ARC "UiAvailable" histograms are difficult to wait for in tast.
This Cl adds two local histograms to be used in tast tests:

- Arc.Tast.UiAvailable.TimeDelta
- Ash.Tast.ArcUiAvailableAfterLogin.Duration

Bug: b/274850380
Change-Id: I3c611978c01323605143fdebc188cf2c563bb80a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4364641
Auto-Submit: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: Yury Khmel <khmel@chromium.org>
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1121420}
This commit is contained in:
Alexander Alekseev
2023-03-23 22:05:33 +00:00
committed by Chromium LUCI CQ
parent c15537e859
commit 5d7642e00f
4 changed files with 24 additions and 0 deletions

@ -19,6 +19,7 @@
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/histogram_macros_local.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
@ -541,6 +542,7 @@ void LoginUnlockThroughputRecorder::AddLoginTimeMarker(
REPORT_LOGIN_THROUGHPUT_EVENT("Ash.UnlockAnimation.Jank.TabletMode");
REPORT_LOGIN_THROUGHPUT_EVENT("Ash.UnlockAnimation.Duration.ClamshellMode");
REPORT_LOGIN_THROUGHPUT_EVENT("Ash.UnlockAnimation.Duration.TabletMode");
REPORT_LOGIN_THROUGHPUT_EVENT("ArcUiAvailable");
if (!reported) {
constexpr char kFailedEvent[] = "FailedToReportEvent";
TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0(
@ -568,6 +570,13 @@ void LoginUnlockThroughputRecorder::RestoreDataLoaded() {
}
}
void LoginUnlockThroughputRecorder::ArcUiAvailableAfterLogin() {
AddLoginTimeMarker("ArcUiAvailable");
const base::TimeDelta duration =
base::TimeTicks::Now() - primary_user_logged_in_;
LOCAL_HISTOGRAM_TIMES("Ash.Tast.ArcUiAvailableAfterLogin.Duration", duration);
}
void LoginUnlockThroughputRecorder::MaybeReportLoginFinished() {
if (login_finished_reported_) {
return;

@ -94,6 +94,9 @@ class ASH_EXPORT LoginUnlockThroughputRecorder : public SessionObserver,
// This flag signals that all expected browser windows are already scheduled.
void RestoreDataLoaded();
// Records that ARC has finished booting.
void ArcUiAvailableAfterLogin();
private:
class TimeMarker {
public:

@ -14,6 +14,7 @@
#include "ash/constants/ash_features.h"
#include "ash/game_dashboard/game_dashboard_controller.h"
#include "ash/in_session_auth/in_session_auth_dialog_controller_impl.h"
#include "ash/metrics/login_unlock_throughput_recorder.h"
#include "ash/public/cpp/session/session_observer.h"
#include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/system_sounds_delegate.h"

@ -10,8 +10,10 @@
#include "ash/components/arc/metrics/stability_metrics_manager.h"
#include "ash/components/arc/mojom/app.mojom.h"
#include "ash/components/arc/mojom/auth.mojom.h"
#include "ash/shell.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/histogram_macros_local.h"
#include "chrome/browser/ash/arc/arc_util.h"
#include "chrome/browser/ash/arc/policy/arc_policy_util.h"
#include "chrome/browser/ash/arc/session/arc_provisioning_result.h"
@ -159,10 +161,19 @@ void UpdatePlayAutoInstallRequestTime(const base::TimeDelta& elapsed_time,
void UpdateArcUiAvailableTime(const base::TimeDelta& elapsed_time,
const std::string& mode,
const Profile* profile) {
if (ash::Shell::HasInstance()) {
ash::Shell::Get()
->login_unlock_throughput_recorder()
->ArcUiAvailableAfterLogin();
}
base::UmaHistogramCustomTimes(
GetHistogramNameByUserType("Arc.UiAvailable." + mode + ".TimeDelta",
profile),
elapsed_time, base::Seconds(1), base::Minutes(5), 50);
// This is local test-only histogram.
LOCAL_HISTOGRAM_CUSTOM_TIMES("Arc.Tast.UiAvailable.TimeDelta", elapsed_time,
base::Seconds(1), base::Minutes(5), 50);
}
void UpdatePlayStoreLaunchTime(const base::TimeDelta& elapsed_time) {