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