OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/metrics/user_metrics_recorder.h" | 5 #include "ash/metrics/user_metrics_recorder.h" |
6 | 6 |
7 #include "ash/session/session_state_delegate.h" | |
7 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
8 #include "ash/shelf/shelf_view.h" | 9 #include "ash/shelf/shelf_view.h" |
9 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
13 #include "ash/system/tray/system_tray_delegate.h" | |
12 #include "ash/wm/window_state.h" | 14 #include "ash/wm/window_state.h" |
13 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
14 #include "base/metrics/user_metrics.h" | 16 #include "base/metrics/user_metrics.h" |
15 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
16 | 18 |
17 namespace ash { | 19 namespace ash { |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 // Time in seconds between calls to "RecordPeriodicMetrics". | 23 // Time in seconds between calls to "RecordPeriodicMetrics". |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 break; | 119 break; |
118 } | 120 } |
119 } | 121 } |
120 } | 122 } |
121 return visible_window_count; | 123 return visible_window_count; |
122 } | 124 } |
123 | 125 |
124 } // namespace | 126 } // namespace |
125 | 127 |
126 UserMetricsRecorder::UserMetricsRecorder() { | 128 UserMetricsRecorder::UserMetricsRecorder() { |
127 timer_.Start(FROM_HERE, | 129 StartTimer(); |
128 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 130 } |
129 this, | 131 |
130 &UserMetricsRecorder::RecordPeriodicMetrics); | 132 UserMetricsRecorder::UserMetricsRecorder(bool record_periodic_metrics) { |
133 if (record_periodic_metrics) | |
134 StartTimer(); | |
131 } | 135 } |
132 | 136 |
133 UserMetricsRecorder::~UserMetricsRecorder() { | 137 UserMetricsRecorder::~UserMetricsRecorder() { |
134 timer_.Stop(); | 138 timer_.Stop(); |
135 } | 139 } |
136 | 140 |
137 void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { | 141 void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { |
138 switch (action) { | 142 switch (action) { |
139 case ash::UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6: | 143 case ash::UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6: |
140 base::RecordAction( | 144 base::RecordAction( |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 if (manager) { | 526 if (manager) { |
523 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 527 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", |
524 manager->SelectValueForShelfAlignment( | 528 manager->SelectValueForShelfAlignment( |
525 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 529 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
526 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 530 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
527 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, | 531 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, |
528 -1), | 532 -1), |
529 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 533 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); |
530 } | 534 } |
531 | 535 |
532 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay", | 536 if (UserIsActive()) { |
pkotwicz
2015/04/17 13:45:38
Should we also ignore kiosk mode? In kiosk mode, a
bruthig
2015/04/17 14:41:23
Good point, I agree it should probably not be logg
tdanderson
2015/04/17 17:59:57
Agreed, let's ignore kiosk mode.
bruthig
2015/04/21 14:34:05
Done.
| |
533 GetNumVisibleWindowsInPrimaryDisplay()); | 537 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay", |
538 GetNumVisibleWindowsInPrimaryDisplay()); | |
539 } | |
534 | 540 |
541 // TODO(bruthig): Find out if this should only be logged when the user is | |
542 // active. | |
535 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime", | 543 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime", |
tdanderson
2015/04/17 17:59:57
IMO, we should only be collecting periodic metrics
bruthig
2015/04/21 14:34:05
I will check with the owner's on these and will ma
| |
536 GetActiveWindowState(), | 544 GetActiveWindowState(), |
537 ACTIVE_WINDOW_STATE_TYPE_COUNT); | 545 ACTIVE_WINDOW_STATE_TYPE_COUNT); |
538 } | 546 } |
sadrul
2015/04/17 22:55:39
This function is ... interesting. What are the val
bruthig
2015/04/21 14:34:05
I've added some TODO's to consider these suggestio
sadrul
2015/04/21 17:24:56
The only concern I have is that this data is not u
oshima
2015/04/25 01:06:58
You can listen to activation change plus login sta
| |
539 | 547 |
548 bool UserMetricsRecorder::UserIsActive() { | |
549 return Shell::GetInstance() | |
550 ->session_state_delegate() | |
551 ->IsActiveUserSessionStarted() && | |
552 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() != | |
553 user::LOGGED_IN_LOCKED; | |
tdanderson
2015/04/17 17:59:57
Is the first clause necessary here?
bruthig
2015/04/21 14:34:05
Removed.
| |
554 } | |
555 | |
556 void UserMetricsRecorder::StartTimer() { | |
557 timer_.Start(FROM_HERE, | |
558 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | |
559 this, &UserMetricsRecorder::RecordPeriodicMetrics); | |
560 } | |
561 | |
540 } // namespace ash | 562 } // namespace ash |
OLD | NEW |