Commit f3bc06bd authored by Olga Sharonova's avatar Olga Sharonova Committed by Commit Bot

Audio output controller lifetime UMA

To understand why we get count mismatches for AudioOutputController
stats when running the audio service in- and out-of-process.

Bug: 867827
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I5d1dbe62ff07d91d48ff67a49b86a14cd071623d
Reviewed-on: https://chromium-review.googlesource.com/1250962Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Olga Sharonova <olka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595399}
parent c6c85490
......@@ -96,6 +96,7 @@ AudioOutputController::AudioOutputController(
params_(params),
handler_(handler),
task_runner_(audio_manager->GetTaskRunner()),
construction_time_(base::TimeTicks::Now()),
output_device_id_(output_device_id),
stream_(NULL),
diverting_to_stream_(NULL),
......@@ -118,6 +119,8 @@ AudioOutputController::~AudioOutputController() {
CHECK_EQ(kClosed, state_);
CHECK_EQ(nullptr, stream_);
CHECK(duplication_targets_.empty());
UMA_HISTOGRAM_LONG_TIMES("Media.AudioOutputController.LifeTime",
base::TimeTicks::Now() - construction_time_);
}
// static
......
......@@ -276,6 +276,10 @@ class MEDIA_EXPORT AudioOutputController
// The message loop of audio manager thread that this object runs on.
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// Time when the controller is constructed. Used to record its lifetime on
// destruction.
const base::TimeTicks construction_time_;
// Specifies the device id of the output device to open or empty for the
// default output device.
std::string output_device_id_;
......
......@@ -127,6 +127,7 @@ OutputController::OutputController(
params_(params),
handler_(handler),
task_runner_(audio_manager->GetTaskRunner()),
construction_time_(base::TimeTicks::Now()),
output_device_id_(output_device_id),
stream_(NULL),
disable_local_output_(false),
......@@ -153,6 +154,8 @@ OutputController::~OutputController() {
DCHECK_EQ(nullptr, stream_);
DCHECK(snoopers_.empty());
DCHECK(should_duplicate_.IsZero());
UMA_HISTOGRAM_LONG_TIMES("Media.AudioOutputController.LifeTime",
base::TimeTicks::Now() - construction_time_);
}
bool OutputController::Create(bool is_for_device_change) {
......
......@@ -242,6 +242,10 @@ class OutputController : public media::AudioOutputStream::AudioSourceCallback,
// via tasks run by this TaskRunner.
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// Time when the controller is constructed. Used to record its lifetime on
// destruction.
const base::TimeTicks construction_time_;
// Specifies the device id of the output device to open or empty for the
// default output device.
const std::string output_device_id_;
......
......@@ -42016,6 +42016,17 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="Media.AudioOutputController.LifeTime" units="ms"
expires_after="2019-02-01">
<owner>olka@chromium.org</owner>
<owner>marinaciocea@chromium.org</owner>
<owner>maxmorin@chromium.org</owner>
<summary>
Time interval from the output stream controller construction to its
destruction.
</summary>
</histogram>
<histogram name="Media.AudioOutputController.ProxyStreamCreationResult"
enum="AudioOutputStreamCreationResult">
<owner>maxmorin@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