[go: nahoru, domu]

blob: 332e20cae1b2dc145f8d4b916410a9bf82723f6f [file] [log] [blame]
Nikunj Bhagat19b859302018-12-20 00:39:561// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/metrics/cpu_metrics_provider.h"
6
7#include "base/cpu.h"
8#include "base/system/sys_info.h"
9#include "third_party/metrics_proto/system_profile.pb.h"
10
11namespace metrics {
12
13CPUMetricsProvider::CPUMetricsProvider() {}
14
15CPUMetricsProvider::~CPUMetricsProvider() {}
16
17void 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.
22 base::CPU cpu_info;
23 cpu->set_vendor_name(cpu_info.vendor_name());
24 cpu->set_signature(cpu_info.signature());
25 cpu->set_num_cores(base::SysInfo::NumberOfProcessors());
Nicolas Ouellet-payeur284202752019-06-27 14:49:0626 cpu->set_is_hypervisor(cpu_info.is_running_in_vm());
Nikunj Bhagat19b859302018-12-20 00:39:5627}
28
29} // namespace metrics