diff options
author | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 03:58:56 +0000 |
---|---|---|
committer | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 03:58:56 +0000 |
commit | 5dacbb9f951251cb2247da5f0dfe895260560f58 (patch) | |
tree | e52a30ffacc61ed0fa204930383dfa2abec38567 /ash/periodic_metrics_recorder.cc | |
parent | 3164aa6480e48957ceeff0a0ef3da5558f3ce576 (diff) | |
download | chromium_src-5dacbb9f951251cb2247da5f0dfe895260560f58.zip chromium_src-5dacbb9f951251cb2247da5f0dfe895260560f58.tar.gz chromium_src-5dacbb9f951251cb2247da5f0dfe895260560f58.tar.bz2 |
Adding 2 simple UMA stats to track shelf alignment usage, firstly track when a shelf alignment is changed (rare), and during usage of the shelf launcher (buttons on the shelf) track the current alignment (more common) to provide some data on how frequent usage is of the various alignments.
BUG=298174
TBR=askvitkine@chromium.org
Review URL: https://codereview.chromium.org/26373009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/periodic_metrics_recorder.cc')
-rw-r--r-- | ash/periodic_metrics_recorder.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ash/periodic_metrics_recorder.cc b/ash/periodic_metrics_recorder.cc new file mode 100644 index 0000000..a1eb927 --- /dev/null +++ b/ash/periodic_metrics_recorder.cc @@ -0,0 +1,43 @@ +// Copyright 2013 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. + +#include "ash/periodic_metrics_recorder.h" + +#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_view.h" +#include "ash/shelf/shelf_widget.h" +#include "ash/shell.h" +#include "base/metrics/histogram.h" + +namespace ash { + +// Time in seconds between calls to "RecordMetrics". +const int kAshPeriodicMetricsTimeInSeconds = 30 * 60; + +PeriodicMetricsRecorder::PeriodicMetricsRecorder() { + timer_.Start(FROM_HERE, + base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), + this, + &PeriodicMetricsRecorder::RecordMetrics); +} + +PeriodicMetricsRecorder::~PeriodicMetricsRecorder() { + timer_.Stop(); +} + +void PeriodicMetricsRecorder::RecordMetrics() { + internal::ShelfLayoutManager* manager = + internal::ShelfLayoutManager::ForLauncher(Shell::GetPrimaryRootWindow()); + if (manager) { + UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", + manager->SelectValueForShelfAlignment( + internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, + internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, + internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, + -1), + internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); + } +} + +} // namespace ash |