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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics); | 383 dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics); |
384 else | 384 else |
385 dx_info = Value::CreateNullValue(); | 385 dx_info = Value::CreateNullValue(); |
386 info->Set("diagnostics", dx_info); | 386 info->Set("diagnostics", dx_info); |
387 #endif | 387 #endif |
388 | 388 |
389 return info; | 389 return info; |
390 } | 390 } |
391 | 391 |
392 void UpdateStats() { | 392 void UpdateStats() { |
| 393 GpuBlacklist* blacklist = GpuBlacklist::GetInstance(); |
| 394 uint32 max_entry_id = blacklist->max_entry_id(); |
| 395 if (max_entry_id == 0) { |
| 396 // GPU Blacklist was not loaded. No need to go further. |
| 397 return; |
| 398 } |
| 399 |
393 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 400 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
394 uint32 flags = GpuDataManager::GetInstance()->GetGpuFeatureType(); | 401 uint32 flags = GpuDataManager::GetInstance()->GetGpuFeatureType(); |
395 GpuBlacklist* blacklist = GpuBlacklist::GetInstance(); | |
396 bool disabled = false; | 402 bool disabled = false; |
397 if (flags == 0) { | 403 if (flags == 0) { |
398 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", | 404 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", |
399 0, blacklist->max_entry_id() + 1); | 405 0, max_entry_id + 1); |
400 } else { | 406 } else { |
401 std::vector<uint32> flag_entries; | 407 std::vector<uint32> flag_entries; |
402 blacklist->GetGpuFeatureTypeEntries( | 408 blacklist->GetGpuFeatureTypeEntries( |
403 content::GPU_FEATURE_TYPE_ALL, flag_entries, disabled); | 409 content::GPU_FEATURE_TYPE_ALL, flag_entries, disabled); |
404 DCHECK_GT(flag_entries.size(), 0u); | 410 DCHECK_GT(flag_entries.size(), 0u); |
405 for (size_t i = 0; i < flag_entries.size(); ++i) { | 411 for (size_t i = 0; i < flag_entries.size(); ++i) { |
406 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", | 412 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", |
407 flag_entries[i], blacklist->max_entry_id() + 1); | 413 flag_entries[i], max_entry_id + 1); |
408 } | 414 } |
409 } | 415 } |
410 | 416 |
411 // This counts how many users are affected by a disabled entry - this allows | 417 // This counts how many users are affected by a disabled entry - this allows |
412 // us to understand the impact of an entry before enable it. | 418 // us to understand the impact of an entry before enable it. |
413 std::vector<uint32> flag_disabled_entries; | 419 std::vector<uint32> flag_disabled_entries; |
414 disabled = true; | 420 disabled = true; |
415 blacklist->GetGpuFeatureTypeEntries( | 421 blacklist->GetGpuFeatureTypeEntries( |
416 content::GPU_FEATURE_TYPE_ALL, flag_disabled_entries, disabled); | 422 content::GPU_FEATURE_TYPE_ALL, flag_disabled_entries, disabled); |
417 for (size_t i = 0; i < flag_disabled_entries.size(); ++i) { | 423 for (size_t i = 0; i < flag_disabled_entries.size(); ++i) { |
418 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry", | 424 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry", |
419 flag_disabled_entries[i], blacklist->max_entry_id() + 1); | 425 flag_disabled_entries[i], max_entry_id + 1); |
420 } | 426 } |
421 | 427 |
422 const content::GpuFeatureType kGpuFeatures[] = { | 428 const content::GpuFeatureType kGpuFeatures[] = { |
423 content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, | 429 content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, |
424 content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, | 430 content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, |
425 content::GPU_FEATURE_TYPE_WEBGL | 431 content::GPU_FEATURE_TYPE_WEBGL |
426 }; | 432 }; |
427 const std::string kGpuBlacklistFeatureHistogramNames[] = { | 433 const std::string kGpuBlacklistFeatureHistogramNames[] = { |
428 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", | 434 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", |
429 "GPU.BlacklistFeatureTestResults.AcceleratedCompositing", | 435 "GPU.BlacklistFeatureTestResults.AcceleratedCompositing", |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 kGpuBlacklistFeatureHistogramNamesWin[i], | 467 kGpuBlacklistFeatureHistogramNamesWin[i], |
462 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 468 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
463 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 469 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
464 base::Histogram::kUmaTargetedHistogramFlag); | 470 base::Histogram::kUmaTargetedHistogramFlag); |
465 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 471 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
466 #endif | 472 #endif |
467 } | 473 } |
468 } | 474 } |
469 | 475 |
470 } // namespace gpu_util; | 476 } // namespace gpu_util; |
OLD | NEW |