summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/cpu.cc4
-rw-r--r--base/cpu.h2
-rw-r--r--chrome/browser/metrics/metrics_log.cc6
-rw-r--r--chrome/browser/metrics/metrics_log_unittest.cc4
-rw-r--r--chrome/common/metrics/proto/system_profile.proto12
5 files changed, 26 insertions, 2 deletions
diff --git a/base/cpu.cc b/base/cpu.cc
index 4a94af0..1761529 100644
--- a/base/cpu.cc
+++ b/base/cpu.cc
@@ -19,7 +19,8 @@
namespace base {
CPU::CPU()
- : type_(0),
+ : signature_(0),
+ type_(0),
family_(0),
model_(0),
stepping_(0),
@@ -105,6 +106,7 @@ void CPU::Initialize() {
// Interpret CPU feature information.
if (num_ids > 0) {
__cpuid(cpu_info, 1);
+ signature_ = cpu_info[0];
stepping_ = cpu_info[0] & 0xf;
model_ = ((cpu_info[0] >> 4) & 0xf) + ((cpu_info[0] >> 12) & 0xf0);
family_ = (cpu_info[0] >> 8) & 0xf;
diff --git a/base/cpu.h b/base/cpu.h
index 1d45258..509763e 100644
--- a/base/cpu.h
+++ b/base/cpu.h
@@ -31,6 +31,7 @@ class BASE_EXPORT CPU {
// Accessors for CPU information.
const std::string& vendor_name() const { return cpu_vendor_; }
+ int signature() const { return signature_; }
int stepping() const { return stepping_; }
int model() const { return model_; }
int family() const { return family_; }
@@ -55,6 +56,7 @@ class BASE_EXPORT CPU {
// Query the processor for CPUID information.
void Initialize();
+ int signature_; // raw form of type, family, model, and stepping
int type_; // process type
int family_; // family of the processor
int model_; // model of processor
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 5bb290f..0e6a23a 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
+#include "base/cpu.h"
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "base/perftimer.h"
@@ -722,6 +723,11 @@ void MetricsLog::RecordEnvironmentProto(
base::android::BuildInfo::GetInstance()->android_build_fp());
#endif
+ base::CPU cpu_info;
+ SystemProfileProto::Hardware::CPU* cpu = hardware->mutable_cpu();
+ cpu->set_vendor_name(cpu_info.vendor_name());
+ cpu->set_signature(cpu_info.signature());
+
const gpu::GPUInfo& gpu_info =
GpuDataManager::GetInstance()->GetGPUInfo();
SystemProfileProto::Hardware::Graphics* gpu = hardware->mutable_gpu();
diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc
index 3f3506f..b306268 100644
--- a/chrome/browser/metrics/metrics_log_unittest.cc
+++ b/chrome/browser/metrics/metrics_log_unittest.cc
@@ -160,6 +160,10 @@ class MetricsLogTest : public testing::Test {
EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor());
EXPECT_EQ(kScreenCount, hardware.screen_count());
+ EXPECT_TRUE(hardware.has_cpu());
+ EXPECT_TRUE(hardware.cpu().has_vendor_name());
+ EXPECT_TRUE(hardware.cpu().has_signature());
+
// TODO(isherman): Verify other data written into the protobuf as a result
// of this call.
}
diff --git a/chrome/common/metrics/proto/system_profile.proto b/chrome/common/metrics/proto/system_profile.proto
index 1fabaa1..b09dd98 100644
--- a/chrome/common/metrics/proto/system_profile.proto
+++ b/chrome/common/metrics/proto/system_profile.proto
@@ -83,7 +83,7 @@ message SystemProfileProto {
}
optional OS os = 5;
- // Next tag for Hardware: 13
+ // Next tag for Hardware: 14
// Information on the user's hardware.
message Hardware {
// The CPU architecture (x86, PowerPC, x86_64, ...)
@@ -121,6 +121,16 @@ message SystemProfileProto {
optional float max_dpi_x = 9;
optional float max_dpi_y = 10;
+ // Information on the CPU obtained by CPUID.
+ message CPU {
+ // A 12 character string naming the vendor, e.g. "GeniuneIntel".
+ optional string vendor_name = 1;
+
+ // The signature reported by CPUID (from EAX).
+ optional uint32 signature = 2;
+ }
+ optional CPU cpu = 13;
+
// Information on the GPU
message Graphics {
// The GPU manufacturer's vendor id.