Commit f9d8f7f6 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: removes time_to_first_present.mojom

And instead has ash directly access the startup time.

BUG=958213
TEST=covered by tests
TBR=tsepez@chromium.org

Change-Id: I146c27edef79ff8fb69ca7cdd7f230ad77f040a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602854Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658315}
parent 025296e6
...@@ -1369,6 +1369,7 @@ component("ash") { ...@@ -1369,6 +1369,7 @@ component("ash") {
"//components/prefs", "//components/prefs",
"//components/quirks", "//components/quirks",
"//components/session_manager:base", "//components/session_manager:base",
"//components/startup_metric_utils/browser:lib",
"//components/strings", "//components/strings",
"//components/sync", "//components/sync",
"//components/user_manager", "//components/user_manager",
......
...@@ -13,6 +13,7 @@ include_rules = [ ...@@ -13,6 +13,7 @@ include_rules = [
"+components/prefs", "+components/prefs",
"+components/quirks", "+components/quirks",
"+components/session_manager", "+components/session_manager",
"+components/startup_metric_utils",
"+components/strings", "+components/strings",
"+components/sync", "+components/sync",
"+components/ui_devtools", "+components/ui_devtools",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/compositor/compositor.h" #include "ui/compositor/compositor.h"
...@@ -15,6 +16,10 @@ ...@@ -15,6 +16,10 @@
namespace ash { namespace ash {
// static
const char TimeToFirstPresentRecorder::kMetricName[] =
"Ash.ProcessCreationToFirstPresent";
TimeToFirstPresentRecorder::TimeToFirstPresentRecorder(aura::Window* window) { TimeToFirstPresentRecorder::TimeToFirstPresentRecorder(aura::Window* window) {
aura::WindowTreeHost* window_tree_host = window->GetHost(); aura::WindowTreeHost* window_tree_host = window->GetHost();
DCHECK(window_tree_host); DCHECK(window_tree_host);
...@@ -25,42 +30,13 @@ TimeToFirstPresentRecorder::TimeToFirstPresentRecorder(aura::Window* window) { ...@@ -25,42 +30,13 @@ TimeToFirstPresentRecorder::TimeToFirstPresentRecorder(aura::Window* window) {
TimeToFirstPresentRecorder::~TimeToFirstPresentRecorder() = default; TimeToFirstPresentRecorder::~TimeToFirstPresentRecorder() = default;
void TimeToFirstPresentRecorder::Bind(
mojom::ProcessCreationTimeRecorderRequest request) {
// Process createion time should only be set once.
if (binding_.is_bound() || !process_creation_time_.is_null())
return;
binding_.Bind(std::move(request));
}
void TimeToFirstPresentRecorder::SetMainProcessCreationTime(
base::TimeTicks start_time) {
if (!process_creation_time_.is_null())
return;
process_creation_time_ = start_time;
LogTime();
// Process creation time should be set only once.
binding_.Close();
}
void TimeToFirstPresentRecorder::LogTime() {
if (present_time_.is_null() || process_creation_time_.is_null())
return;
UMA_HISTOGRAM_TIMES("Ash.ProcessCreationToFirstPresent",
time_to_first_present());
if (log_callback_)
std::move(log_callback_).Run();
}
void TimeToFirstPresentRecorder::DidPresentCompositorFrame( void TimeToFirstPresentRecorder::DidPresentCompositorFrame(
const gfx::PresentationFeedback& feedback) { const gfx::PresentationFeedback& feedback) {
DCHECK(present_time_.is_null()); // This should only be called once. const base::TimeDelta time_to_first_present =
present_time_ = feedback.timestamp; feedback.timestamp - startup_metric_utils::MainEntryPointTicks();
LogTime(); UMA_HISTOGRAM_TIMES(kMetricName, time_to_first_present);
if (log_callback_)
std::move(log_callback_).Run();
} }
} // namespace ash } // namespace ash
...@@ -7,11 +7,9 @@ ...@@ -7,11 +7,9 @@
#include <stdint.h> #include <stdint.h>
#include "ash/public/interfaces/process_creation_time_recorder.mojom.h" #include "ash/ash_export.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/binding.h"
namespace aura { namespace aura {
class Window; class Window;
...@@ -26,41 +24,26 @@ namespace ash { ...@@ -26,41 +24,26 @@ namespace ash {
class TimeToFirstPresentRecorderTestApi; class TimeToFirstPresentRecorderTestApi;
// Used for tracking the time main started to the time the first bits make it // Used for tracking the time main started to the time the first bits make it
// the screen and logging a histogram of the time. Chrome is responsible for // the screen and logging a histogram of the time.
// providing the start time by way of ProcessCreationTimeRecorder.
// //
// This only logs the time to present the primary root window. // This only logs the time to present the primary root window.
class TimeToFirstPresentRecorder : public mojom::ProcessCreationTimeRecorder { class ASH_EXPORT TimeToFirstPresentRecorder {
public: public:
explicit TimeToFirstPresentRecorder(aura::Window* window); // The name of the histogram the time is logged against.
~TimeToFirstPresentRecorder() override; static const char kMetricName[];
void Bind(mojom::ProcessCreationTimeRecorderRequest request); explicit TimeToFirstPresentRecorder(aura::Window* window);
~TimeToFirstPresentRecorder();
private: private:
friend class TimeToFirstPresentRecorderTestApi; friend class TimeToFirstPresentRecorderTestApi;
// If both times are available the time to present is logged.
void LogTime();
// Callback from the compositor when it presented a valid frame. // Callback from the compositor when it presented a valid frame.
void DidPresentCompositorFrame(const gfx::PresentationFeedback& feedback); void DidPresentCompositorFrame(const gfx::PresentationFeedback& feedback);
base::TimeDelta time_to_first_present() const { // Only used by tests. If valid it's Run() when the time is recorded.
return present_time_ - process_creation_time_;
}
// mojom::ProcessCreationTimeRecorder:
void SetMainProcessCreationTime(base::TimeTicks start_time) override;
base::TimeTicks process_creation_time_;
base::TimeTicks present_time_;
// Only used by tests. If valid it's Run() when both times are determined.
base::OnceClosure log_callback_; base::OnceClosure log_callback_;
mojo::Binding<mojom::ProcessCreationTimeRecorder> binding_{this};
DISALLOW_COPY_AND_ASSIGN(TimeToFirstPresentRecorder); DISALLOW_COPY_AND_ASSIGN(TimeToFirstPresentRecorder);
}; };
......
...@@ -7,52 +7,14 @@ ...@@ -7,52 +7,14 @@
#include "ash/metrics/time_to_first_present_recorder.h" #include "ash/metrics/time_to_first_present_recorder.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
namespace ash { namespace ash {
TimeToFirstPresentRecorderTestApi::TimeToFirstPresentRecorderTestApi() =
default;
TimeToFirstPresentRecorderTestApi::~TimeToFirstPresentRecorderTestApi() =
default;
// static // static
void TimeToFirstPresentRecorderTestApi::BindRequest( void TimeToFirstPresentRecorderTestApi::SetTimeToFirstPresentCallback(
mojom::TimeToFirstPresentRecorderTestApiRequest request) { base::OnceClosure callback) {
mojo::MakeStrongBinding(std::make_unique<TimeToFirstPresentRecorderTestApi>(), Shell::Get()->time_to_first_present_recorder()->log_callback_ =
std::move(request)); std::move(callback);
}
void TimeToFirstPresentRecorderTestApi::GetProcessCreationToFirstPresentTime(
GetProcessCreationToFirstPresentTimeCallback callback) {
TimeToFirstPresentRecorder* recorder =
Shell::Get()->time_to_first_present_recorder();
if (recorder->process_creation_time_.is_null() ||
recorder->present_time_.is_null()) {
// Still waiting for time. Schedule a callback with
// TimeToFirstPresentRecorder. This only supports one callback at a time,
// which should be fine for tests.
DCHECK(recorder->log_callback_.is_null());
recorder->log_callback_ = base::BindOnce(
&TimeToFirstPresentRecorderTestApi::OnLog, base::Unretained(this));
DCHECK(!get_creation_time_callback_);
get_creation_time_callback_ = std::move(callback);
return;
}
std::move(callback).Run(recorder->time_to_first_present());
}
void TimeToFirstPresentRecorderTestApi::OnLog() {
TimeToFirstPresentRecorder* recorder =
Shell::Get()->time_to_first_present_recorder();
DCHECK(!recorder->process_creation_time_.is_null() &&
!recorder->present_time_.is_null());
std::move(get_creation_time_callback_)
.Run(Shell::Get()
->time_to_first_present_recorder()
->time_to_first_present());
} }
} // namespace ash } // namespace ash
...@@ -5,33 +5,17 @@ ...@@ -5,33 +5,17 @@
#ifndef ASH_METRICS_TIME_TO_FIRST_PRESENT_RECORDER_TEST_API_H_ #ifndef ASH_METRICS_TIME_TO_FIRST_PRESENT_RECORDER_TEST_API_H_
#define ASH_METRICS_TIME_TO_FIRST_PRESENT_RECORDER_TEST_API_H_ #define ASH_METRICS_TIME_TO_FIRST_PRESENT_RECORDER_TEST_API_H_
#include "ash/public/interfaces/time_to_first_present_recorder_test_api.test-mojom.h" #include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
namespace ash { namespace ash {
class TimeToFirstPresentRecorderTestApi class TimeToFirstPresentRecorderTestApi {
: public mojom::TimeToFirstPresentRecorderTestApi {
public: public:
TimeToFirstPresentRecorderTestApi(); static void SetTimeToFirstPresentCallback(base::OnceClosure callback);
~TimeToFirstPresentRecorderTestApi() override;
// Creates and binds an instance from a remote request (e.g. from chrome).
static void BindRequest(
mojom::TimeToFirstPresentRecorderTestApiRequest request);
// mojom::TimeToFirstPresentRecorderTestApi:
void GetProcessCreationToFirstPresentTime(
GetProcessCreationToFirstPresentTimeCallback callback) override;
private: private:
void OnLog(); DISALLOW_IMPLICIT_CONSTRUCTORS(TimeToFirstPresentRecorderTestApi);
// If valid GetProcessCreationToFirstPresentTimeCallback() was called and
// we're waiting for TimeToFirstPresentRecorder to see the first log.
GetProcessCreationToFirstPresentTimeCallback get_creation_time_callback_;
DISALLOW_COPY_AND_ASSIGN(TimeToFirstPresentRecorderTestApi);
}; };
} // namespace ash } // namespace ash
......
...@@ -210,11 +210,6 @@ void BindNoteTakingControllerRequestOnMainThread( ...@@ -210,11 +210,6 @@ void BindNoteTakingControllerRequestOnMainThread(
Shell::Get()->note_taking_controller()->BindRequest(std::move(request)); Shell::Get()->note_taking_controller()->BindRequest(std::move(request));
} }
void BindProcessCreationTimeRecorderOnMainThread(
mojom::ProcessCreationTimeRecorderRequest request) {
Shell::Get()->time_to_first_present_recorder()->Bind(std::move(request));
}
void BindShelfRequestOnMainThread(mojom::ShelfControllerRequest request) { void BindShelfRequestOnMainThread(mojom::ShelfControllerRequest request) {
Shell::Get()->shelf_controller()->BindRequest(std::move(request)); Shell::Get()->shelf_controller()->BindRequest(std::move(request));
} }
...@@ -352,9 +347,6 @@ void RegisterInterfaces( ...@@ -352,9 +347,6 @@ void RegisterInterfaces(
registry->AddInterface( registry->AddInterface(
base::BindRepeating(&BindNoteTakingControllerRequestOnMainThread), base::BindRepeating(&BindNoteTakingControllerRequestOnMainThread),
main_thread_task_runner); main_thread_task_runner);
registry->AddInterface(
base::BindRepeating(&BindProcessCreationTimeRecorderOnMainThread),
main_thread_task_runner);
registry->AddInterface(base::BindRepeating(&BindShelfRequestOnMainThread), registry->AddInterface(base::BindRepeating(&BindShelfRequestOnMainThread),
main_thread_task_runner); main_thread_task_runner);
registry->AddInterface( registry->AddInterface(
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "ash/public/interfaces/shell_test_api.test-mojom.h" #include "ash/public/interfaces/shell_test_api.test-mojom.h"
#include "ash/public/interfaces/status_area_widget_test_api.test-mojom.h" #include "ash/public/interfaces/status_area_widget_test_api.test-mojom.h"
#include "ash/public/interfaces/system_tray_test_api.test-mojom.h" #include "ash/public/interfaces/system_tray_test_api.test-mojom.h"
#include "ash/public/interfaces/time_to_first_present_recorder_test_api.test-mojom.h"
#include "ash/shelf/shelf_test_api.h" #include "ash/shelf/shelf_test_api.h"
#include "ash/shell_test_api.h" #include "ash/shell_test_api.h"
#include "ash/system/status_area_widget_test_api.h" #include "ash/system/status_area_widget_test_api.h"
...@@ -51,11 +50,6 @@ void BindSystemTrayTestApiOnMainThread( ...@@ -51,11 +50,6 @@ void BindSystemTrayTestApiOnMainThread(
UnifiedSystemTrayTestApi::BindRequest(std::move(request)); UnifiedSystemTrayTestApi::BindRequest(std::move(request));
} }
void BindTimeToFirstPresentRecorderTestApiOnMainThread(
mojom::TimeToFirstPresentRecorderTestApiRequest request) {
TimeToFirstPresentRecorderTestApi::BindRequest(std::move(request));
}
} // namespace } // namespace
void RegisterInterfaces( void RegisterInterfaces(
...@@ -71,9 +65,6 @@ void RegisterInterfaces( ...@@ -71,9 +65,6 @@ void RegisterInterfaces(
main_thread_task_runner); main_thread_task_runner);
registry->AddInterface(base::Bind(&BindSystemTrayTestApiOnMainThread), registry->AddInterface(base::Bind(&BindSystemTrayTestApiOnMainThread),
main_thread_task_runner); main_thread_task_runner);
registry->AddInterface(
base::Bind(&BindTimeToFirstPresentRecorderTestApiOnMainThread),
main_thread_task_runner);
} }
} // namespace mojo_test_interface_factory } // namespace mojo_test_interface_factory
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "ash/public/interfaces/night_light_controller.mojom.h" #include "ash/public/interfaces/night_light_controller.mojom.h"
#include "ash/public/interfaces/note_taking_controller.mojom.h" #include "ash/public/interfaces/note_taking_controller.mojom.h"
#include "ash/public/interfaces/pref_connector.mojom.h" #include "ash/public/interfaces/pref_connector.mojom.h"
#include "ash/public/interfaces/process_creation_time_recorder.mojom.h"
#include "ash/public/interfaces/shelf.mojom.h" #include "ash/public/interfaces/shelf.mojom.h"
#include "ash/public/interfaces/shelf_integration_test_api.mojom.h" #include "ash/public/interfaces/shelf_integration_test_api.mojom.h"
#include "ash/public/interfaces/shutdown.mojom.h" #include "ash/public/interfaces/shutdown.mojom.h"
...@@ -91,8 +90,7 @@ const service_manager::Manifest& GetManifest() { ...@@ -91,8 +90,7 @@ const service_manager::Manifest& GetManifest() {
mojom::KeyboardController, mojom::LocaleUpdateController, mojom::KeyboardController, mojom::LocaleUpdateController,
mojom::LoginScreen, mojom::MediaController, mojom::LoginScreen, mojom::MediaController,
mojom::NewWindowController, mojom::NightLightController, mojom::NewWindowController, mojom::NightLightController,
mojom::NoteTakingController, mojom::NoteTakingController, mojom::ShelfController,
mojom::ProcessCreationTimeRecorder, mojom::ShelfController,
mojom::ShutdownController, mojom::SystemTray, mojom::ShutdownController, mojom::SystemTray,
mojom::TabletModeController, mojom::TrayAction, mojom::TabletModeController, mojom::TrayAction,
mojom::VoiceInteractionController, mojom::VpnList, mojom::VoiceInteractionController, mojom::VpnList,
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ash/public/interfaces/shell_test_api.test-mojom.h" #include "ash/public/interfaces/shell_test_api.test-mojom.h"
#include "ash/public/interfaces/status_area_widget_test_api.test-mojom.h" #include "ash/public/interfaces/status_area_widget_test_api.test-mojom.h"
#include "ash/public/interfaces/system_tray_test_api.test-mojom.h" #include "ash/public/interfaces/system_tray_test_api.test-mojom.h"
#include "ash/public/interfaces/time_to_first_present_recorder_test_api.test-mojom.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "services/service_manager/public/cpp/manifest_builder.h" #include "services/service_manager/public/cpp/manifest_builder.h"
...@@ -22,8 +21,7 @@ const service_manager::Manifest& GetManifestOverlayForTesting() { ...@@ -22,8 +21,7 @@ const service_manager::Manifest& GetManifestOverlayForTesting() {
"test", service_manager::Manifest::InterfaceList< "test", service_manager::Manifest::InterfaceList<
mojom::LoginScreenTestApi, mojom::ShelfTestApi, mojom::LoginScreenTestApi, mojom::ShelfTestApi,
mojom::ShellTestApi, mojom::StatusAreaWidgetTestApi, mojom::ShellTestApi, mojom::StatusAreaWidgetTestApi,
mojom::SystemTrayTestApi, mojom::SystemTrayTestApi>())
mojom::TimeToFirstPresentRecorderTestApi>())
.Build()}; .Build()};
return *manifest; return *manifest;
} }
......
...@@ -50,7 +50,6 @@ mojom("interfaces_internal") { ...@@ -50,7 +50,6 @@ mojom("interfaces_internal") {
"night_light_controller.mojom", "night_light_controller.mojom",
"note_taking_controller.mojom", "note_taking_controller.mojom",
"pref_connector.mojom", "pref_connector.mojom",
"process_creation_time_recorder.mojom",
"shelf.mojom", "shelf.mojom",
"shelf_integration_test_api.mojom", "shelf_integration_test_api.mojom",
"shutdown.mojom", "shutdown.mojom",
...@@ -105,7 +104,6 @@ mojom("test_interfaces") { ...@@ -105,7 +104,6 @@ mojom("test_interfaces") {
"shell_test_api.test-mojom", "shell_test_api.test-mojom",
"status_area_widget_test_api.test-mojom", "status_area_widget_test_api.test-mojom",
"system_tray_test_api.test-mojom", "system_tray_test_api.test-mojom",
"time_to_first_present_recorder_test_api.test-mojom",
] ]
deps = [ deps = [
"//ash/public/interfaces:interfaces_internal", "//ash/public/interfaces:interfaces_internal",
......
// Copyright 2017 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.
module ash.mojom;
import "mojo/public/mojom/base/time.mojom";
interface ProcessCreationTimeRecorder {
// Sets the time the main process was created at, used for logging metrics.
SetMainProcessCreationTime(mojo_base.mojom.TimeTicks start_time);
};
// Copyright 2017 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.
module ash.mojom;
import "mojo/public/mojom/base/time.mojom";
// Used to test internal state of TimeToFirstPresentRecorder.
interface TimeToFirstPresentRecorderTestApi {
// Returns the time between process creation and the first pixels shown on
// screen.
GetProcessCreationToFirstPresentTime() => (mojo_base.mojom.TimeDelta delta);
};
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "ash/public/cpp/shelf_model.h" #include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/public/interfaces/constants.mojom.h" #include "ash/public/interfaces/constants.mojom.h"
#include "ash/public/interfaces/process_creation_time_recorder.mojom.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
...@@ -74,20 +73,6 @@ ...@@ -74,20 +73,6 @@
#include "chrome/browser/exo_parts.h" #include "chrome/browser/exo_parts.h"
#endif #endif
namespace {
void PushProcessCreationTimeToAsh() {
ash::mojom::ProcessCreationTimeRecorderPtr recorder;
content::ServiceManagerConnection::GetForProcess()
->GetConnector()
->BindInterface(ash::mojom::kServiceName, &recorder);
DCHECK(!startup_metric_utils::MainEntryPointTicks().is_null());
recorder->SetMainProcessCreationTime(
startup_metric_utils::MainEntryPointTicks());
}
} // namespace
namespace internal { namespace internal {
// Creates a ChromeLauncherController on the first active session notification. // Creates a ChromeLauncherController on the first active session notification.
...@@ -204,8 +189,6 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { ...@@ -204,8 +189,6 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
#if BUILDFLAG(ENABLE_WAYLAND_SERVER) #if BUILDFLAG(ENABLE_WAYLAND_SERVER)
exo_parts_ = ExoParts::CreateIfNecessary(); exo_parts_ = ExoParts::CreateIfNecessary();
#endif #endif
PushProcessCreationTimeToAsh();
} }
void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { void ChromeBrowserMainExtraPartsAsh::PostProfileInit() {
......
...@@ -2,24 +2,30 @@ ...@@ -2,24 +2,30 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/public/interfaces/constants.mojom.h" #include "ash/metrics/time_to_first_present_recorder.h"
#include "ash/public/interfaces/time_to_first_present_recorder_test_api.test-mojom-test-utils.h"
#include "ash/public/interfaces/time_to_first_present_recorder_test_api.test-mojom.h" #include "ash/metrics/time_to_first_present_recorder_test_api.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "content/public/common/service_manager_connection.h"
#include "services/service_manager/public/cpp/connector.h"
using TimeToFirstPresentRecorderTest = InProcessBrowserTest; using TimeToFirstPresentRecorderTest = InProcessBrowserTest;
IN_PROC_BROWSER_TEST_F(TimeToFirstPresentRecorderTest, VerifyTimeCalculated) { IN_PROC_BROWSER_TEST_F(TimeToFirstPresentRecorderTest, VerifyTimeCalculated) {
ash::mojom::TimeToFirstPresentRecorderTestApiPtr recorder_test_api; // It's possible that the metric was already recorded.
content::ServiceManagerConnection::GetForProcess() base::HistogramTester tester;
->GetConnector() auto counts = tester.GetTotalCountsForPrefix(
->BindInterface(ash::mojom::kServiceName, &recorder_test_api); ash::TimeToFirstPresentRecorder::kMetricName);
ash::mojom::TimeToFirstPresentRecorderTestApiAsyncWaiter recorder( if (counts[ash::TimeToFirstPresentRecorder::kMetricName] == 1)
recorder_test_api.get()); return;
base::TimeDelta time_delta;
recorder.GetProcessCreationToFirstPresentTime(&time_delta); // The metric wasn't recorded. Wait for it to be recorded.
EXPECT_FALSE(time_delta.is_zero()); base::RunLoop run_loop;
ash::TimeToFirstPresentRecorderTestApi::SetTimeToFirstPresentCallback(
run_loop.QuitClosure());
run_loop.Run();
counts = tester.GetTotalCountsForPrefix(
ash::TimeToFirstPresentRecorder::kMetricName);
EXPECT_EQ(1, counts[ash::TimeToFirstPresentRecorder::kMetricName]);
} }
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