1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/metrics/cpu_metrics_provider.h"
8 #include "base/system/sys_info.h"
9 #include "third_party/metrics_proto/system_profile.pb.h"
13 CPUMetricsProvider::CPUMetricsProvider() {}
15 CPUMetricsProvider::~CPUMetricsProvider() {}
17 void CPUMetricsProvider::ProvideSystemProfileMetrics(
18 SystemProfileProto* system_profile) {
19 SystemProfileProto::Hardware::CPU* cpu =
20 system_profile->mutable_hardware()->mutable_cpu();
21 // All the CPU information is generated in the constructor.
23 cpu->set_vendor_name(cpu_info.vendor_name());
24 cpu->set_signature(cpu_info.signature());
25 cpu->set_num_cores(base::SysInfo::NumberOfProcessors());
26 cpu->set_is_hypervisor(cpu_info.is_running_in_vm());
29 } // namespace metrics