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

Unified Diff: chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc

Issue 13901007: Linux: Add a UMA for the glibc version. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
===================================================================
--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc (revision 194041)
+++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
#include <string>
+#include <vector>
#include "base/bind.h"
#include "base/command_line.h"
@@ -20,8 +21,32 @@
#include "ui/base/touch/touch_device.h"
#include "ui/base/ui_base_switches.h"
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#include <gnu/libc-version.h>
+
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
+#endif
+
namespace {
+enum UMALinuxGlibcVersion {
+ UMA_LINUX_GLIBC_NOT_PARSEABLE,
+ UMA_LINUX_GLIBC_UNKNOWN,
+ UMA_LINUX_GLIBC_2_11 = 11,
jar (doing other things) 2013/04/14 16:14:15 See note below about how to avoid having to list t
+ UMA_LINUX_GLIBC_2_12 = 12,
+ UMA_LINUX_GLIBC_2_13 = 13,
+ UMA_LINUX_GLIBC_2_14 = 14,
+ UMA_LINUX_GLIBC_2_15 = 15,
+ UMA_LINUX_GLIBC_2_16 = 16,
+ UMA_LINUX_GLIBC_2_17 = 17,
+ UMA_LINUX_GLIBC_2_18 = 18,
+ UMA_LINUX_GLIBC_2_19 = 19,
+ // NOTE: Add new version above this line and update the enum list in
+ // tools/histograms/histograms.xml accordingly.
+ UMA_LINUX_GLIBC_VERSION_COUNT
+};
+
enum UMATouchEventsState {
UMA_TOUCH_EVENTS_ENABLED,
UMA_TOUCH_EVENTS_AUTO_ENABLED,
@@ -32,7 +57,7 @@
UMA_TOUCH_EVENTS_STATE_COUNT
};
-void LogIntelMicroArchitecture() {
+void RecordIntelMicroArchitecture() {
#if defined(ARCH_CPU_X86_FAMILY)
base::CPU cpu;
base::CPU::IntelMicroArchitecture arch = cpu.GetIntelMicroArchitecture();
@@ -49,6 +74,32 @@
ShellIntegration::NUM_DEFAULT_STATES);
}
+void RecordLinuxGlibcVersion() {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ std::string glibc_version_string(gnu_get_libc_version());
+ std::vector<std::string> split_glibc_version;
+ base::SplitString(glibc_version_string, '.', &split_glibc_version);
+
+ UMALinuxGlibcVersion glibc_version_result = UMA_LINUX_GLIBC_NOT_PARSEABLE;
+ unsigned glibc_major_version = 0;
+ unsigned glibc_minor_version = 0;
+ if (split_glibc_version.size() == 2 &&
+ base::StringToUint(split_glibc_version[0], &glibc_major_version) &&
+ base::StringToUint(split_glibc_version[1], &glibc_minor_version)) {
+ if (glibc_major_version == 2 &&
+ (glibc_minor_version >= 11 && glibc_minor_version <= 19)) {
+ // |glibc_minor_version| values lines up with the enum values.
+ glibc_version_result =
+ static_cast<UMALinuxGlibcVersion>(glibc_minor_version);
jar (doing other things) 2013/04/14 16:14:15 I think this might read better if you have the adj
+ } else {
+ glibc_version_result = UMA_LINUX_GLIBC_UNKNOWN;
+ }
+ }
+ UMA_HISTOGRAM_ENUMERATION("Linux.GlibcVersion", glibc_version_result,
+ UMA_LINUX_GLIBC_VERSION_COUNT);
+#endif
+}
+
void RecordTouchEventState() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
const std::string touch_enabled_switch =
@@ -83,7 +134,7 @@
}
void ChromeBrowserMainExtraPartsMetrics::PreProfileInit() {
- LogIntelMicroArchitecture();
+ RecordIntelMicroArchitecture();
}
void ChromeBrowserMainExtraPartsMetrics::PreBrowserStart() {
@@ -97,6 +148,7 @@
}
void ChromeBrowserMainExtraPartsMetrics::PostBrowserStart() {
+ RecordLinuxGlibcVersion();
RecordTouchEventState();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698