Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: gpu/config/gpu_info.cc

Issue 21682002: Expose GPU information to Telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed more unnecessary includes. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/config/gpu_info.h" 5 #include "gpu/config/gpu_info.h"
6 6
7 namespace gpu { 7 namespace gpu {
8 8
9 GPUInfo::GPUDevice::GPUDevice() 9 GPUInfo::GPUDevice::GPUDevice()
10 : vendor_id(0), 10 : vendor_id(0),
11 device_id(0) { 11 device_id(0) {
12 } 12 }
13 13
14 GPUInfo::GPUDevice::~GPUDevice() { } 14 GPUInfo::GPUDevice::~GPUDevice() { }
15 15
16 GPUInfo::GPUInfo() 16 GPUInfo::GPUInfo()
17 : finalized(false), 17 : finalized(false),
18 optimus(false), 18 optimus(false),
19 amd_switchable(false), 19 amd_switchable(false),
20 lenovo_dcute(false), 20 lenovo_dcute(false),
21 adapter_luid(0), 21 adapter_luid(0),
22 gl_reset_notification_strategy(0), 22 gl_reset_notification_strategy(0),
23 can_lose_context(false), 23 can_lose_context(false),
24 software_rendering(false), 24 software_rendering(false),
25 sandboxed(false) { 25 sandboxed(false) {
26 } 26 }
27 27
28 GPUInfo::~GPUInfo() { } 28 GPUInfo::~GPUInfo() { }
29 29
30 void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
31 struct GPUInfoKnownFields {
32 bool finalized;
33 base::TimeDelta initialization_time;
34 bool optimus;
35 bool amd_switchable;
36 bool lenovo_dcute;
37 Version display_link_version;
38 GPUDevice gpu;
39 std::vector<GPUDevice> secondary_gpus;
40 uint64 adapter_luid;
41 std::string driver_vendor;
42 std::string driver_version;
43 std::string driver_date;
44 std::string pixel_shader_version;
45 std::string vertex_shader_version;
46 std::string machine_model;
47 std::string gl_version;
48 std::string gl_version_string;
49 std::string gl_vendor;
50 std::string gl_renderer;
51 std::string gl_extensions;
52 std::string gl_ws_vendor;
53 std::string gl_ws_version;
54 std::string gl_ws_extensions;
55 bool can_lose_context;
56 GpuPerformanceStats performance_stats;
57 bool software_rendering;
58 bool sandboxed;
59 #if defined(OS_WIN)
60 DxDiagNode dx_diagnostics;
61 #endif
62 };
63
64 // If this assert fails then most likely something below needs to be updated.
65 // Note that this assert is only approximate. If a new field is added to
66 // GPUInfo which fits within the current padding then it will not be caught.
67 COMPILE_ASSERT(
68 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields),
69 Fields_Have_Changed_In_GPUInfo_So_Update_Below);
70
71 // Note that we use the C++, and Python, naming convention for these
72 // fields. The final consumer of this information is Telemetry's Python
73 // classes, and using a consistent naming convention reduces the amount
74 // of code that must be written converting back and forth.
75 enumerator->AddBool("finalized", finalized);
76 enumerator->AddTimeDeltaInSecondsF("initialization_time",
77 initialization_time);
78 enumerator->AddBool("optimus", optimus);
79 enumerator->AddBool("amd_switchable", amd_switchable);
80 enumerator->AddBool("lenovo_dcute", lenovo_dcute);
81 if (display_link_version.IsValid()) {
82 enumerator->AddString("display_link_version",
83 display_link_version.GetString());
84 }
85 enumerator->AddGPUDevice(gpu);
86 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) {
87 enumerator->AddGPUDevice(secondary_gpus[ii]);
88 }
89 enumerator->AddInt64("adapter_luid", adapter_luid);
90 enumerator->AddString("driver_vendor", driver_vendor);
91 enumerator->AddString("driver_version", driver_version);
92 enumerator->AddString("driver_date", driver_date);
93 enumerator->AddString("pixel_shader_version", pixel_shader_version);
94 enumerator->AddString("vertex_shader_version", vertex_shader_version);
95 enumerator->AddString("machine_model", machine_model);
96 enumerator->AddString("gl_version", gl_version);
97 enumerator->AddString("gl_version_string", gl_version_string);
98 enumerator->AddString("gl_vendor", gl_vendor);
99 enumerator->AddString("gl_renderer", gl_renderer);
100 enumerator->AddString("gl_extensions", gl_extensions);
101 enumerator->AddString("gl_ws_vendor", gl_ws_vendor);
102 enumerator->AddString("gl_ws_version", gl_ws_version);
103 enumerator->AddString("gl_ws_extensions", gl_ws_extensions);
104 enumerator->AddBool("can_lose_context", can_lose_context);
105 // TODO(kbr): add performance_stats.
106 enumerator->AddBool("software_rendering", software_rendering);
107 enumerator->AddBool("sandboxed", sandboxed);
108 // TODO(kbr): add dx_diagnostics on Windows.
109 }
110
30 } // namespace gpu 111 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698