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

Side by Side Diff: content/gpu/gpu_info_collector_win.cc

Issue 10832278: Fix WinSAT histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial commit. Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/gpu/gpu_info_collector.h" 5 #include "content/gpu/gpu_info_collector.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <d3d9.h> 8 #include <d3d9.h>
9 #include <setupapi.h> 9 #include <setupapi.h>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 content::GpuPerformanceStats RetrieveGpuPerformanceStats() { 53 content::GpuPerformanceStats RetrieveGpuPerformanceStats() {
54 TRACE_EVENT0("gpu", "RetrieveGpuPerformanceStats"); 54 TRACE_EVENT0("gpu", "RetrieveGpuPerformanceStats");
55 55
56 // If the user re-runs the assessment without restarting, the COM API 56 // If the user re-runs the assessment without restarting, the COM API
57 // returns WINSAT_ASSESSMENT_STATE_NOT_AVAILABLE. Because of that and 57 // returns WINSAT_ASSESSMENT_STATE_NOT_AVAILABLE. Because of that and
58 // http://crbug.com/124325, read the assessment result files directly. 58 // http://crbug.com/124325, read the assessment result files directly.
59 content::GpuPerformanceStats stats; 59 content::GpuPerformanceStats stats;
60 60
61 base::TimeTicks start_time = base::TimeTicks::Now();
62
63 // Get path to WinSAT results files. 61 // Get path to WinSAT results files.
64 wchar_t winsat_results_path[MAX_PATH]; 62 wchar_t winsat_results_path[MAX_PATH];
65 DWORD size = ExpandEnvironmentStrings( 63 DWORD size = ExpandEnvironmentStrings(
66 L"%WinDir%\\Performance\\WinSAT\\DataStore\\", 64 L"%WinDir%\\Performance\\WinSAT\\DataStore\\",
67 winsat_results_path, MAX_PATH); 65 winsat_results_path, MAX_PATH);
68 if (size == 0 || size > MAX_PATH) { 66 if (size == 0 || size > MAX_PATH) {
69 LOG(ERROR) << "The path to the WinSAT results is too long: " 67 LOG(ERROR) << "The path to the WinSAT results is too long: "
70 << size << " chars."; 68 << size << " chars.";
71 return stats; 69 return stats;
72 } 70 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 stats.gaming = ReadXMLFloatValue(&reader); 127 stats.gaming = ReadXMLFloatValue(&reader);
130 } 128 }
131 129
132 if (stats.overall == 0.0) 130 if (stats.overall == 0.0)
133 LOG(ERROR) << "Could not read overall score from assessment results."; 131 LOG(ERROR) << "Could not read overall score from assessment results.";
134 if (stats.graphics == 0.0) 132 if (stats.graphics == 0.0)
135 LOG(ERROR) << "Could not read graphics score from assessment results."; 133 LOG(ERROR) << "Could not read graphics score from assessment results.";
136 if (stats.gaming == 0.0) 134 if (stats.gaming == 0.0)
137 LOG(ERROR) << "Could not read gaming score from assessment results."; 135 LOG(ERROR) << "Could not read gaming score from assessment results.";
138 136
137 return stats;
138 }
139
140 content::GpuPerformanceStats RetrieveGpuPerformanceStatsWithHistograms() {
141 base::TimeTicks start_time = base::TimeTicks::Now();
142
143 content::GpuPerformanceStats stats = RetrieveGpuPerformanceStats();
144
145 UMA_HISTOGRAM_TIMES("GPU.WinSAT.ReadResultsFileTime",
146 base::TimeTicks::Now() - start_time);
139 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.WinSAT.OverallScore2", 147 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.WinSAT.OverallScore2",
140 stats.overall * 10, 10, 200, 50); 148 stats.overall * 10, 10, 200, 50);
141 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.WinSAT.GraphicsScore2", 149 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.WinSAT.GraphicsScore2",
142 stats.graphics * 10, 10, 200, 50); 150 stats.graphics * 10, 10, 200, 50);
143 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.WinSAT.GamingScore2", 151 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.WinSAT.GamingScore2",
144 stats.gaming * 10, 10, 200, 50); 152 stats.gaming * 10, 10, 200, 50);
145 153 UMA_HISTOGRAM_BOOLEAN(
146 UMA_HISTOGRAM_TIMES("GPU.WinSAT.ReadResultsFileTime", 154 "GPU.WinSAT.HasResults",
147 base::TimeTicks::Now() - start_time); 155 stats.overall != 0.0 && stats.graphics != 0.0 && stats.gaming != 0.0);
148 156
149 return stats; 157 return stats;
150 } 158 }
151 159
152 } // namespace anonymous 160 } // namespace anonymous
153 161
154 namespace gpu_info_collector { 162 namespace gpu_info_collector {
155 163
156 #if !defined(GOOGLE_CHROME_BUILD) 164 #if !defined(GOOGLE_CHROME_BUILD)
157 AMDVideoCardType GetAMDVideocardType() { 165 AMDVideoCardType GetAMDVideocardType() {
158 return UNKNOWN; 166 return UNKNOWN;
159 } 167 }
160 #else 168 #else
161 // This function has a real implementation for official builds that can 169 // This function has a real implementation for official builds that can
162 // be found in src/third_party/amd. 170 // be found in src/third_party/amd.
163 AMDVideoCardType GetAMDVideocardType(); 171 AMDVideoCardType GetAMDVideocardType();
164 #endif 172 #endif
165 173
166 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { 174 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
167 TRACE_EVENT0("gpu", "CollectGraphicsInfo"); 175 TRACE_EVENT0("gpu", "CollectGraphicsInfo");
168 176
169 DCHECK(gpu_info); 177 DCHECK(gpu_info);
170 178
171 content::GpuPerformanceStats stats = RetrieveGpuPerformanceStats(); 179 gpu_info->performance_stats = RetrieveGpuPerformanceStats();
172 UMA_HISTOGRAM_BOOLEAN(
173 "GPU.WinSAT.HasResults",
174 stats.overall != 0.0 && stats.graphics != 0.0 && stats.gaming != 0.0);
175 gpu_info->performance_stats = stats;
176 180
177 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) { 181 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) {
178 std::string requested_implementation_name = 182 std::string requested_implementation_name =
179 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); 183 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL);
180 if (requested_implementation_name == "swiftshader") { 184 if (requested_implementation_name == "swiftshader") {
181 gpu_info->software_rendering = true; 185 gpu_info->software_rendering = true;
182 return false; 186 return false;
183 } 187 }
184 } 188 }
185 189
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 224
221 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { 225 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) {
222 TRACE_EVENT0("gpu", "CollectPreliminaryGraphicsInfo"); 226 TRACE_EVENT0("gpu", "CollectPreliminaryGraphicsInfo");
223 227
224 DCHECK(gpu_info); 228 DCHECK(gpu_info);
225 229
226 bool rt = true; 230 bool rt = true;
227 if (!CollectVideoCardInfo(gpu_info)) 231 if (!CollectVideoCardInfo(gpu_info))
228 rt = false; 232 rt = false;
229 233
230 gpu_info->performance_stats = RetrieveGpuPerformanceStats(); 234 gpu_info->performance_stats = RetrieveGpuPerformanceStatsWithHistograms();
231 235
232 return rt; 236 return rt;
233 } 237 }
234 238
235 bool CollectGraphicsInfoD3D(IDirect3D9* d3d, content::GPUInfo* gpu_info) { 239 bool CollectGraphicsInfoD3D(IDirect3D9* d3d, content::GPUInfo* gpu_info) {
236 TRACE_EVENT0("gpu", "CollectGraphicsInfoD3D"); 240 TRACE_EVENT0("gpu", "CollectGraphicsInfoD3D");
237 241
238 DCHECK(d3d); 242 DCHECK(d3d);
239 DCHECK(gpu_info); 243 DCHECK(gpu_info);
240 244
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 392
389 size_t pos = gl_version_string.find_last_not_of("0123456789."); 393 size_t pos = gl_version_string.find_last_not_of("0123456789.");
390 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { 394 if (pos != std::string::npos && pos < gl_version_string.length() - 1) {
391 gpu_info->driver_version = gl_version_string.substr(pos + 1); 395 gpu_info->driver_version = gl_version_string.substr(pos + 1);
392 return true; 396 return true;
393 } 397 }
394 return false; 398 return false;
395 } 399 }
396 400
397 } // namespace gpu_info_collector 401 } // namespace gpu_info_collector
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698