| OLD | NEW |
| 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 "chrome/browser/gpu_util.h" | 5 #include "chrome/browser/gpu_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return dict; | 74 return dict; |
| 75 } | 75 } |
| 76 | 76 |
| 77 Value* NewStatusValue(const char* name, const char* status) { | 77 Value* NewStatusValue(const char* name, const char* status) { |
| 78 DictionaryValue* value = new DictionaryValue(); | 78 DictionaryValue* value = new DictionaryValue(); |
| 79 value->SetString("name", name); | 79 value->SetString("name", name); |
| 80 value->SetString("status", status); | 80 value->SetString("status", status); |
| 81 return value; | 81 return value; |
| 82 } | 82 } |
| 83 | 83 |
| 84 std::string GPUDeviceToString(const content::GPUInfo::GPUDevice& gpu) { |
| 85 std::string vendor = base::StringPrintf("0x%04x", gpu.vendor_id); |
| 86 if (!gpu.vendor_string.empty()) |
| 87 vendor += " [" + gpu.vendor_string + "]"; |
| 88 std::string device = base::StringPrintf("0x%04x", gpu.device_id); |
| 89 if (!gpu.device_string.empty()) |
| 90 device += " [" + gpu.device_string + "]"; |
| 91 return base::StringPrintf( |
| 92 "VENDOR = %s, DEVICE= %s", vendor.c_str(), device.c_str()); |
| 93 } |
| 94 |
| 84 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
| 85 | 96 |
| 86 enum WinSubVersion { | 97 enum WinSubVersion { |
| 87 kWinOthers = 0, | 98 kWinOthers = 0, |
| 88 kWinXP, | 99 kWinXP, |
| 89 kWinVista, | 100 kWinVista, |
| 90 kWin7, | 101 kWin7, |
| 91 kNumWinSubVersions | 102 kNumWinSubVersions |
| 92 }; | 103 }; |
| 93 | 104 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 return status; | 340 return status; |
| 330 } | 341 } |
| 331 | 342 |
| 332 DictionaryValue* GpuInfoAsDictionaryValue() { | 343 DictionaryValue* GpuInfoAsDictionaryValue() { |
| 333 content::GPUInfo gpu_info = GpuDataManager::GetInstance()->GetGPUInfo(); | 344 content::GPUInfo gpu_info = GpuDataManager::GetInstance()->GetGPUInfo(); |
| 334 ListValue* basic_info = new ListValue(); | 345 ListValue* basic_info = new ListValue(); |
| 335 basic_info->Append(NewDescriptionValuePair( | 346 basic_info->Append(NewDescriptionValuePair( |
| 336 "Initialization time", | 347 "Initialization time", |
| 337 base::Int64ToString(gpu_info.initialization_time.InMilliseconds()))); | 348 base::Int64ToString(gpu_info.initialization_time.InMilliseconds()))); |
| 338 basic_info->Append(NewDescriptionValuePair( | 349 basic_info->Append(NewDescriptionValuePair( |
| 339 "Vendor Id", base::StringPrintf("0x%04x", gpu_info.vendor_id))); | 350 "GPU0", GPUDeviceToString(gpu_info.gpu))); |
| 340 basic_info->Append(NewDescriptionValuePair( | 351 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { |
| 341 "Device Id", base::StringPrintf("0x%04x", gpu_info.device_id))); | 352 basic_info->Append(NewDescriptionValuePair( |
| 353 base::StringPrintf("GPU%d", static_cast<int>(i + 1)), |
| 354 GPUDeviceToString(gpu_info.secondary_gpus[i]))); |
| 355 } |
| 342 basic_info->Append(NewDescriptionValuePair( | 356 basic_info->Append(NewDescriptionValuePair( |
| 343 "Optimus", Value::CreateBooleanValue(gpu_info.optimus))); | 357 "Optimus", Value::CreateBooleanValue(gpu_info.optimus))); |
| 344 basic_info->Append(NewDescriptionValuePair( | 358 basic_info->Append(NewDescriptionValuePair( |
| 345 "AMD switchable", Value::CreateBooleanValue(gpu_info.amd_switchable))); | 359 "AMD switchable", Value::CreateBooleanValue(gpu_info.amd_switchable))); |
| 346 basic_info->Append(NewDescriptionValuePair("Driver vendor", | 360 basic_info->Append(NewDescriptionValuePair("Driver vendor", |
| 347 gpu_info.driver_vendor)); | 361 gpu_info.driver_vendor)); |
| 348 basic_info->Append(NewDescriptionValuePair("Driver version", | 362 basic_info->Append(NewDescriptionValuePair("Driver version", |
| 349 gpu_info.driver_version)); | 363 gpu_info.driver_version)); |
| 350 basic_info->Append(NewDescriptionValuePair("Driver date", | 364 basic_info->Append(NewDescriptionValuePair("Driver date", |
| 351 gpu_info.driver_date)); | 365 gpu_info.driver_date)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 kGpuBlacklistFeatureHistogramNamesWin[i], | 483 kGpuBlacklistFeatureHistogramNamesWin[i], |
| 470 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 484 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
| 471 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 485 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
| 472 base::Histogram::kUmaTargetedHistogramFlag); | 486 base::Histogram::kUmaTargetedHistogramFlag); |
| 473 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 487 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
| 474 #endif | 488 #endif |
| 475 } | 489 } |
| 476 } | 490 } |
| 477 | 491 |
| 478 } // namespace gpu_util; | 492 } // namespace gpu_util; |
| OLD | NEW |