OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 5 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
39 #include "chrome/installer/util/google_update_settings.h" | 39 #include "chrome/installer/util/google_update_settings.h" |
40 #endif // defined(OS_WIN) | 40 #endif // defined(OS_WIN) |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 enum UMALinuxGlibcVersion { | 44 enum UMALinuxGlibcVersion { |
45 UMA_LINUX_GLIBC_NOT_PARSEABLE, | 45 UMA_LINUX_GLIBC_NOT_PARSEABLE, |
46 UMA_LINUX_GLIBC_UNKNOWN, | 46 UMA_LINUX_GLIBC_UNKNOWN, |
47 UMA_LINUX_GLIBC_2_11, | 47 UMA_LINUX_GLIBC_2_11, |
48 UMA_LINUX_GLIBC_2_19 = UMA_LINUX_GLIBC_2_11 + 8, | 48 // To log newer versions, just update tools/metrics/histograms/histograms.xml. |
49 // NOTE: Add new version above this line and update the enum list in | |
50 // tools/metrics/histograms/histograms.xml accordingly. | |
51 UMA_LINUX_GLIBC_VERSION_COUNT | |
52 }; | 49 }; |
53 | 50 |
54 enum UMALinuxWindowManager { | 51 enum UMALinuxWindowManager { |
55 UMA_LINUX_WINDOW_MANAGER_OTHER, | 52 UMA_LINUX_WINDOW_MANAGER_OTHER, |
56 UMA_LINUX_WINDOW_MANAGER_BLACKBOX, | 53 UMA_LINUX_WINDOW_MANAGER_BLACKBOX, |
57 UMA_LINUX_WINDOW_MANAGER_CHROME_OS, // Deprecated. | 54 UMA_LINUX_WINDOW_MANAGER_CHROME_OS, // Deprecated. |
58 UMA_LINUX_WINDOW_MANAGER_COMPIZ, | 55 UMA_LINUX_WINDOW_MANAGER_COMPIZ, |
59 UMA_LINUX_WINDOW_MANAGER_ENLIGHTENMENT, | 56 UMA_LINUX_WINDOW_MANAGER_ENLIGHTENMENT, |
60 UMA_LINUX_WINDOW_MANAGER_ICE_WM, | 57 UMA_LINUX_WINDOW_MANAGER_ICE_WM, |
61 UMA_LINUX_WINDOW_MANAGER_KWIN, | 58 UMA_LINUX_WINDOW_MANAGER_KWIN, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (version.IsValid() && version.components().size() == 2) { | 123 if (version.IsValid() && version.components().size() == 2) { |
127 glibc_version_result = UMA_LINUX_GLIBC_UNKNOWN; | 124 glibc_version_result = UMA_LINUX_GLIBC_UNKNOWN; |
128 int glibc_major_version = version.components()[0]; | 125 int glibc_major_version = version.components()[0]; |
129 int glibc_minor_version = version.components()[1]; | 126 int glibc_minor_version = version.components()[1]; |
130 if (glibc_major_version == 2) { | 127 if (glibc_major_version == 2) { |
131 // A constant to translate glibc 2.x minor versions to their | 128 // A constant to translate glibc 2.x minor versions to their |
132 // equivalent UMALinuxGlibcVersion values. | 129 // equivalent UMALinuxGlibcVersion values. |
133 const int kGlibcMinorVersionTranslationOffset = 11 - UMA_LINUX_GLIBC_2_11; | 130 const int kGlibcMinorVersionTranslationOffset = 11 - UMA_LINUX_GLIBC_2_11; |
134 int translated_glibc_minor_version = | 131 int translated_glibc_minor_version = |
135 glibc_minor_version - kGlibcMinorVersionTranslationOffset; | 132 glibc_minor_version - kGlibcMinorVersionTranslationOffset; |
136 if (translated_glibc_minor_version >= UMA_LINUX_GLIBC_2_11 && | 133 if (translated_glibc_minor_version >= UMA_LINUX_GLIBC_2_11) { |
137 translated_glibc_minor_version <= UMA_LINUX_GLIBC_2_19) { | |
138 glibc_version_result = | 134 glibc_version_result = |
139 static_cast<UMALinuxGlibcVersion>(translated_glibc_minor_version); | 135 static_cast<UMALinuxGlibcVersion>(translated_glibc_minor_version); |
140 } | 136 } |
141 } | 137 } |
142 } | 138 } |
143 UMA_HISTOGRAM_ENUMERATION("Linux.GlibcVersion", glibc_version_result, | 139 UMA_HISTOGRAM_SPARSE_SLOWLY("Linux.GlibcVersion", glibc_version_result); |
144 UMA_LINUX_GLIBC_VERSION_COUNT); | |
145 #endif | 140 #endif |
146 } | 141 } |
147 | 142 |
148 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 143 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
149 UMALinuxWindowManager GetLinuxWindowManager() { | 144 UMALinuxWindowManager GetLinuxWindowManager() { |
150 switch (ui::GuessWindowManager()) { | 145 switch (ui::GuessWindowManager()) { |
151 case ui::WM_UNKNOWN: | 146 case ui::WM_UNKNOWN: |
152 return UMA_LINUX_WINDOW_MANAGER_OTHER; | 147 return UMA_LINUX_WINDOW_MANAGER_OTHER; |
153 case ui::WM_AWESOME: | 148 case ui::WM_AWESOME: |
154 return UMA_LINUX_WINDOW_MANAGER_AWESOME; | 149 return UMA_LINUX_WINDOW_MANAGER_AWESOME; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 294 } |
300 } | 295 } |
301 | 296 |
302 namespace chrome { | 297 namespace chrome { |
303 | 298 |
304 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts) { | 299 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts) { |
305 main_parts->AddParts(new ChromeBrowserMainExtraPartsMetrics()); | 300 main_parts->AddParts(new ChromeBrowserMainExtraPartsMetrics()); |
306 } | 301 } |
307 | 302 |
308 } // namespace chrome | 303 } // namespace chrome |
OLD | NEW |