Commit c5c81589 authored by Avi Drissman's avatar Avi Drissman Committed by Chromium LUCI CQ

Add UMA field for app CPU architecture

Bug: 1164487
Change-Id: I7a2fbfd53d7321b3fead090ead52f1de699f53af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2631428Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845746}
parent 1c6180f7
......@@ -114,4 +114,19 @@ base::TimeDelta SysInfo::Uptime() {
return base::TimeDelta::FromMicroseconds(uptime_in_microseconds);
}
// static
std::string SysInfo::ProcessCPUArchitecture() {
#if defined(ARCH_CPU_X86)
return "x86";
#elif defined(ARCH_CPU_X86_64)
return "x86_64";
#elif defined(ARCH_CPU_ARMEL)
return "ARM";
#elif defined(ARCH_CPU_ARM64)
return "ARM_64";
#else
return std::string();
#endif
}
} // namespace base
......@@ -114,6 +114,13 @@ class BASE_EXPORT SysInfo {
// whereas a x86-64 kernel on the same CPU will return "x86_64"
static std::string OperatingSystemArchitecture();
// Returns the architecture of the running process, which might be different
// than the architecture returned by OperatingSystemArchitecture() (e.g.
// macOS Rosetta, a 32-bit binary on a 64-bit OS, etc).
// Will return one of: "x86", "x86_64", "ARM", "ARM_64", or an empty string if
// none of the above.
static std::string ProcessCPUArchitecture();
// Avoid using this. Use base/cpu.h to get information about the CPU instead.
// http://crbug.com/148884
// Returns the CPU model name of the system. If it can not be figured out,
......
......@@ -216,6 +216,9 @@ void MetricsLog::RecordCoreSystemProfile(
// crbug.com/370104 for details.
hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture());
#endif
auto app_os_arch = base::SysInfo::ProcessCPUArchitecture();
if (!app_os_arch.empty())
hardware->set_app_cpu_architecture(app_os_arch);
hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB());
hardware->set_hardware_class(base::SysInfo::HardwareModelName());
#if defined(OS_WIN)
......
......@@ -181,6 +181,9 @@ TEST_F(MetricsLogTest, BasicRecord) {
#if !defined(OS_IOS)
hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture());
#endif
auto app_os_arch = base::SysInfo::ProcessCPUArchitecture();
if (!app_os_arch.empty())
hardware->set_app_cpu_architecture(app_os_arch);
hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB());
hardware->set_hardware_class(GetExpectedHardwareClass());
#if defined(OS_WIN)
......
Name: Metrics Protos
Short Name: metrics_proto
URL: This is the canonical public repository
Version: 351916971
Date: 2021/01/15 UTC
Version: 352604480
Date: 2021/01/19 UTC
License: BSD
Security Critical: Yes
......
......@@ -147,13 +147,19 @@ message SystemProfileProto {
optional OS os = 5;
// Information on the user's hardware.
// Next tag: 21
// Next tag: 22
message Hardware {
// CPU architecture. Taken from uname -m and modified in Chromium logic.
// OS CPU architecture. Taken from uname -m and modified in Chromium logic.
// Common options are: x86, x86_64, armv7l, armv8l, aarch64.
// Not recorded on iOS.
optional string cpu_architecture = 1;
// Browser process CPU architecture. Will be different from
// `cpu_architecture` in the case where Chromium runs non-natively (e.g.
// macOS Rosetta or Arm Windows). One of four values: x86, x86_64, ARM,
// ARM_64. Added in M90.
optional string app_cpu_architecture = 21;
// The amount of RAM present on the system, in megabytes.
optional int64 system_ram_mb = 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment