Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/uma_browsing_activity_observer.h" | 5 #include "chrome/browser/ui/uma_browsing_activity_observer.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_iterator.h" | 10 #include "chrome/browser/ui/browser_iterator.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 content::RenderProcessHost::AllHostsIterator()); | 64 content::RenderProcessHost::AllHostsIterator()); |
| 65 !i.IsAtEnd(); i.Advance()) | 65 !i.IsAtEnd(); i.Advance()) |
| 66 ++hosts_count; | 66 ++hosts_count; |
| 67 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, | 67 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, |
| 68 1, 50, 50); | 68 1, 50, 50); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void UMABrowsingActivityObserver::LogBrowserTabCount() const { | 71 void UMABrowsingActivityObserver::LogBrowserTabCount() const { |
| 72 int tab_count = 0; | 72 int tab_count = 0; |
| 73 int app_window_count = 0; | 73 int app_window_count = 0; |
| 74 int panel_window_count = 0; | 74 int panel_window_count = 0; |
|
Dmitry Titov
2013/04/02 21:21:50
Should the panel counter be removed from here?
stevenjb
2013/04/02 21:38:43
Yep. And UMA counts below. And the histogram entry
| |
| 75 int popup_window_count = 0; | 75 int popup_window_count = 0; |
| 76 int tabbed_window_count = 0; | 76 int tabbed_window_count = 0; |
| 77 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 77 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 78 // Record how many tabs each window has open. | 78 // Record how many tabs each window has open. |
| 79 Browser* browser = *it; | 79 Browser* browser = *it; |
| 80 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow", | 80 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow", |
| 81 browser->tab_strip_model()->count(), | 81 browser->tab_strip_model()->count(), |
| 82 1, 200, 50); | 82 1, 200, 50); |
| 83 tab_count += browser->tab_strip_model()->count(); | 83 tab_count += browser->tab_strip_model()->count(); |
| 84 | 84 |
| 85 if (browser->window()->IsActive()) { | 85 if (browser->window()->IsActive()) { |
| 86 // Record how many tabs the active window has open. | 86 // Record how many tabs the active window has open. |
| 87 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountActiveWindow", | 87 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountActiveWindow", |
| 88 browser->tab_strip_model()->count(), | 88 browser->tab_strip_model()->count(), |
| 89 1, 200, 50); | 89 1, 200, 50); |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (browser->is_app()) | 92 if (browser->is_app()) |
| 93 app_window_count++; | 93 app_window_count++; |
| 94 else if (browser->is_type_panel()) | |
| 95 panel_window_count++; | |
| 96 else if (browser->is_type_popup()) | 94 else if (browser->is_type_popup()) |
| 97 popup_window_count++; | 95 popup_window_count++; |
| 98 else if (browser->is_type_tabbed()) | 96 else if (browser->is_type_tabbed()) |
| 99 tabbed_window_count++; | 97 tabbed_window_count++; |
| 100 } | 98 } |
| 101 // Record how many tabs total are open (across all windows). | 99 // Record how many tabs total are open (across all windows). |
| 102 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerLoad", tab_count, 1, 200, 50); | 100 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerLoad", tab_count, 1, 200, 50); |
| 103 | 101 |
| 104 // Record how many windows are open, by type. | 102 // Record how many windows are open, by type. |
| 105 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", | 103 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", |
| 106 app_window_count); | 104 app_window_count); |
| 107 UMA_HISTOGRAM_COUNTS_100("WindowManager.PanelWindowCountPerLoad", | 105 UMA_HISTOGRAM_COUNTS_100("WindowManager.PanelWindowCountPerLoad", |
| 108 panel_window_count); | 106 panel_window_count); |
| 109 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", | 107 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", |
| 110 popup_window_count); | 108 popup_window_count); |
| 111 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", | 109 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", |
| 112 tabbed_window_count); | 110 tabbed_window_count); |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // namespace chrome | 113 } // namespace chrome |
| OLD | NEW |