1 // Copyright 2014 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. 4 5 #include "components/metrics/content/gpu_metrics_provider.h" 6 7 #include "content/public/browser/gpu_data_manager.h" 8 #include "gpu/config/gpu_info.h" 9 #include "third_party/metrics_proto/system_profile.pb.h" 10 11 namespace metrics { 12 GPUMetricsProvider()13GPUMetricsProvider::GPUMetricsProvider() {} 14 ~GPUMetricsProvider()15GPUMetricsProvider::~GPUMetricsProvider() {} 16 ProvideSystemProfileMetrics(SystemProfileProto * system_profile_proto)17void GPUMetricsProvider::ProvideSystemProfileMetrics( 18 SystemProfileProto* system_profile_proto) { 19 SystemProfileProto::Hardware* hardware = 20 system_profile_proto->mutable_hardware(); 21 22 const gpu::GPUInfo& gpu_info = 23 content::GpuDataManager::GetInstance()->GetGPUInfo(); 24 const gpu::GPUInfo::GPUDevice& active_gpu = gpu_info.active_gpu(); 25 SystemProfileProto::Hardware::Graphics* gpu = hardware->mutable_gpu(); 26 gpu->set_vendor_id(active_gpu.vendor_id); 27 gpu->set_device_id(active_gpu.device_id); 28 gpu->set_driver_version(active_gpu.driver_version); 29 gpu->set_gl_vendor(gpu_info.gl_vendor); 30 gpu->set_gl_renderer(gpu_info.gl_renderer); 31 } 32 33 } // namespace metrics 34