Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: ash/periodic_metrics_recorder.cc

Issue 26373009: ash:Shelf - Added UMA stats for ShelfAlignment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/periodic_metrics_recorder.h ('k') | ash/shelf/shelf_alignment_menu.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/periodic_metrics_recorder.cc
diff --git a/ash/periodic_metrics_recorder.cc b/ash/periodic_metrics_recorder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..40cb0b958fe3102aa708504e3df5eeba46803fd6
--- /dev/null
+++ b/ash/periodic_metrics_recorder.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 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
« no previous file with comments | « ash/periodic_metrics_recorder.h ('k') | ash/shelf/shelf_alignment_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698