Commit 6f5b4f56 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Collect DevicePerfInfo even if the info collection GPU process fails to launch.

There are multiple reasons the info collection GPU process may not launch.
Make sure certain DevicePerfInfo fields are collected. Otherwise the histograms
could be biased.

BUG=1039792
TEST=manual
R=magchen@chromium.org,sky@chromium.org

Change-Id: I2c0fee99935e55b6d1a65982bdbf5da38f95eef7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079852
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMaggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745641}
parent 0e3b0d1c
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
#include "content/public/common/service_names.mojom.h" #include "content/public/common/service_names.mojom.h"
#include "device/fido/hid/fido_hid_discovery.h" #include "device/fido/hid/fido_hid_discovery.h"
#include "device/gamepad/gamepad_service.h" #include "device/gamepad/gamepad_service.h"
#include "gpu/config/gpu_switches.h"
#include "media/audio/audio_manager.h" #include "media/audio/audio_manager.h"
#include "media/audio/audio_system.h" #include "media/audio/audio_system.h"
#include "media/audio/audio_thread_impl.h" #include "media/audio/audio_thread_impl.h"
...@@ -1412,15 +1411,11 @@ int BrowserMainLoop::BrowserThreadsStarted() { ...@@ -1412,15 +1411,11 @@ int BrowserMainLoop::BrowserThreadsStarted() {
} }
#if defined(OS_WIN) #if defined(OS_WIN)
if (!parsed_command_line_.HasSwitch( // Launch the info collection GPU process to collect DX12 and Vulkan support
switches::kDisableGpuProcessForDX12VulkanInfoCollection)) { // information. Not to affect Chrome startup, this is done in a delayed mode,
// The default is to delay the secondary GPU process for 120 seconds. // i.e., 120 seconds after Chrome startup.
bool delayed = !parsed_command_line_.HasSwitch( GpuDataManagerImpl::GetInstance()->RequestDxdiagDx12VulkanGpuInfoIfNeeded(
switches::kNoDelayForDX12VulkanInfoCollection); kGpuInfoRequestDx12Vulkan, /*delayed=*/true);
GpuDataManagerImpl::GetInstance()->RequestDxdiagDx12VulkanGpuInfoIfNeeded(
kGpuInfoRequestDx12Vulkan, delayed);
}
#endif #endif
if (MediaKeysListenerManager::IsMediaKeysListenerManagerEnabled()) { if (MediaKeysListenerManager::IsMediaKeysListenerManagerEnabled()) {
......
...@@ -114,12 +114,16 @@ void GpuDataManagerImpl::UpdateDxDiagNode( ...@@ -114,12 +114,16 @@ void GpuDataManagerImpl::UpdateDxDiagNode(
private_->UpdateDxDiagNode(dx_diagnostics); private_->UpdateDxDiagNode(dx_diagnostics);
} }
void GpuDataManagerImpl::UpdateDx12VulkanDevicePerfInfo( void GpuDataManagerImpl::UpdateDx12VulkanInfo(
const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info, const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info) {
base::AutoLock auto_lock(lock_);
private_->UpdateDx12VulkanInfo(dx12_vulkan_version_info);
}
void GpuDataManagerImpl::UpdateDevicePerfInfo(
const gpu::DevicePerfInfo& device_perf_info) { const gpu::DevicePerfInfo& device_perf_info) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
private_->UpdateDx12VulkanDevicePerfInfo(dx12_vulkan_version_info, private_->UpdateDevicePerfInfo(device_perf_info);
device_perf_info);
} }
void GpuDataManagerImpl::UpdateOverlayInfo( void GpuDataManagerImpl::UpdateOverlayInfo(
......
...@@ -80,9 +80,9 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager, ...@@ -80,9 +80,9 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
const base::Optional<gpu::GPUInfo>& gpu_info_for_hardware_gpu); const base::Optional<gpu::GPUInfo>& gpu_info_for_hardware_gpu);
#if defined(OS_WIN) #if defined(OS_WIN)
void UpdateDxDiagNode(const gpu::DxDiagNode& dx_diagnostics); void UpdateDxDiagNode(const gpu::DxDiagNode& dx_diagnostics);
void UpdateDx12VulkanDevicePerfInfo( void UpdateDx12VulkanInfo(
const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info, const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info);
const gpu::DevicePerfInfo& device_perf_info); void UpdateDevicePerfInfo(const gpu::DevicePerfInfo& device_perf_info);
void UpdateOverlayInfo(const gpu::OverlayInfo& overlay_info); void UpdateOverlayInfo(const gpu::OverlayInfo& overlay_info);
void UpdateDxDiagNodeRequestStatus(bool request_continues); void UpdateDxDiagNodeRequestStatus(bool request_continues);
void UpdateDx12VulkanRequestStatus(bool request_continues); void UpdateDx12VulkanRequestStatus(bool request_continues);
......
...@@ -661,12 +661,27 @@ void GpuDataManagerImplPrivate::RequestDxDiagNodeData() { ...@@ -661,12 +661,27 @@ void GpuDataManagerImplPrivate::RequestDxDiagNodeData() {
void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion( void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion(
bool delayed) { bool delayed) {
#if defined(OS_WIN) #if defined(OS_WIN)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::TimeDelta delta;
if (delayed &&
!command_line->HasSwitch(switches::kNoDelayForDX12VulkanInfoCollection)) {
delta = base::TimeDelta::FromSeconds(120);
}
base::OnceClosure task = base::BindOnce( base::OnceClosure task = base::BindOnce(
[](bool delayed) { [](base::TimeDelta delta) {
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
if (manager->Dx12VulkanRequested()) if (manager->Dx12VulkanRequested())
return; return;
base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(
switches::kDisableGpuProcessForDX12VulkanInfoCollection)) {
manager->UpdateDx12VulkanRequestStatus(false);
return;
}
// No info collection for software GL implementation (id == 0xffff) or // No info collection for software GL implementation (id == 0xffff) or
// abnormal situation (id == 0). There are a few crash reports on // abnormal situation (id == 0). There are a few crash reports on
// exit_or_terminate_process() during process teardown. The GPU ID // exit_or_terminate_process() during process teardown. The GPU ID
...@@ -675,7 +690,7 @@ void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion( ...@@ -675,7 +690,7 @@ void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion(
// because the ID is not available yet. // because the ID is not available yet.
const gpu::GPUInfo::GPUDevice gpu = manager->GetGPUInfo().gpu; const gpu::GPUInfo::GPUDevice gpu = manager->GetGPUInfo().gpu;
if ((gpu.vendor_id == 0xffff && gpu.device_id == 0xffff) || if ((gpu.vendor_id == 0xffff && gpu.device_id == 0xffff) ||
(delayed && gpu.vendor_id == 0 && gpu.device_id == 0)) { (!delta.is_zero() && gpu.vendor_id == 0 && gpu.device_id == 0)) {
manager->UpdateDx12VulkanRequestStatus(false); manager->UpdateDx12VulkanRequestStatus(false);
return; return;
} }
...@@ -692,19 +707,18 @@ void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion( ...@@ -692,19 +707,18 @@ void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion(
base::BindOnce( base::BindOnce(
[](const gpu::Dx12VulkanVersionInfo& dx12_vulkan_info, [](const gpu::Dx12VulkanVersionInfo& dx12_vulkan_info,
const gpu::DevicePerfInfo& device_perf_info) { const gpu::DevicePerfInfo& device_perf_info) {
GpuDataManagerImpl::GetInstance() GpuDataManagerImpl* manager =
->UpdateDx12VulkanDevicePerfInfo(dx12_vulkan_info, GpuDataManagerImpl::GetInstance();
device_perf_info); manager->UpdateDx12VulkanInfo(dx12_vulkan_info);
// UpdateDx12VulkanInfo() needs to be called before
// UpdateDevicePerfInfo() because only the latter calls
// NotifyGpuInfoUpdate().
manager->UpdateDevicePerfInfo(device_perf_info);
})); }));
}, },
delayed); delta);
if (delayed) { base::PostDelayedTask(FROM_HERE, {BrowserThread::IO}, std::move(task), delta);
base::PostDelayedTask(FROM_HERE, {BrowserThread::IO}, std::move(task),
base::TimeDelta::FromSeconds(120));
} else {
base::PostTask(FROM_HERE, {BrowserThread::IO}, std::move(task));
}
#endif #endif
} }
...@@ -827,11 +841,17 @@ void GpuDataManagerImplPrivate::UpdateDxDiagNode( ...@@ -827,11 +841,17 @@ void GpuDataManagerImplPrivate::UpdateDxDiagNode(
NotifyGpuInfoUpdate(); NotifyGpuInfoUpdate();
} }
void GpuDataManagerImplPrivate::UpdateDx12VulkanDevicePerfInfo( void GpuDataManagerImplPrivate::UpdateDx12VulkanInfo(
const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info, const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info) {
const gpu::DevicePerfInfo& device_perf_info) {
gpu_info_.dx12_vulkan_version_info = dx12_vulkan_version_info; gpu_info_.dx12_vulkan_version_info = dx12_vulkan_version_info;
gpu_info_dx12_vulkan_valid_ = true; gpu_info_dx12_vulkan_valid_ = true;
// No need to call NotifyGpuInfoUpdate() because UpdateDx12VulkanInfo() is
// always called together with UpdateDevicePerfInfo, which calls
// NotifyGpuInfoUpdate().
}
void GpuDataManagerImplPrivate::UpdateDevicePerfInfo(
const gpu::DevicePerfInfo& device_perf_info) {
gpu::DevicePerfInfo mutable_device_perf_info = device_perf_info; gpu::DevicePerfInfo mutable_device_perf_info = device_perf_info;
CollectExtraDevicePerfInfo(gpu_info_, &mutable_device_perf_info); CollectExtraDevicePerfInfo(gpu_info_, &mutable_device_perf_info);
gpu::SetDevicePerfInfo(mutable_device_perf_info); gpu::SetDevicePerfInfo(mutable_device_perf_info);
...@@ -860,8 +880,11 @@ void GpuDataManagerImplPrivate::UpdateDx12VulkanRequestStatus( ...@@ -860,8 +880,11 @@ void GpuDataManagerImplPrivate::UpdateDx12VulkanRequestStatus(
gpu_info_dx12_vulkan_requested_ = true; gpu_info_dx12_vulkan_requested_ = true;
gpu_info_dx12_vulkan_request_failed_ = !request_continues; gpu_info_dx12_vulkan_request_failed_ = !request_continues;
if (gpu_info_dx12_vulkan_request_failed_) if (gpu_info_dx12_vulkan_request_failed_) {
NotifyGpuInfoUpdate(); gpu::DevicePerfInfo device_perf_info;
gpu::CollectDevicePerfInfo(&device_perf_info, /*in_browser_process=*/true);
UpdateDevicePerfInfo(device_perf_info);
}
} }
bool GpuDataManagerImplPrivate::Dx12VulkanRequested() const { bool GpuDataManagerImplPrivate::Dx12VulkanRequested() const {
......
...@@ -62,9 +62,10 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -62,9 +62,10 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
const base::Optional<gpu::GPUInfo>& optional_gpu_info_for_hardware_gpu); const base::Optional<gpu::GPUInfo>& optional_gpu_info_for_hardware_gpu);
#if defined(OS_WIN) #if defined(OS_WIN)
void UpdateDxDiagNode(const gpu::DxDiagNode& dx_diagnostics); void UpdateDxDiagNode(const gpu::DxDiagNode& dx_diagnostics);
void UpdateDx12VulkanDevicePerfInfo( void UpdateDx12VulkanInfo(
const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info, const gpu::Dx12VulkanVersionInfo& dx12_vulkan_version_info);
const gpu::DevicePerfInfo& device_perf_info); void UpdateDevicePerfInfo(const gpu::DevicePerfInfo& device_perf_info);
void UpdateOverlayInfo(const gpu::OverlayInfo& overlay_info); void UpdateOverlayInfo(const gpu::OverlayInfo& overlay_info);
void UpdateDx12VulkanRequestStatus(bool request_continues); void UpdateDx12VulkanRequestStatus(bool request_continues);
void UpdateDxDiagNodeRequestStatus(bool request_continues); void UpdateDxDiagNodeRequestStatus(bool request_continues);
......
...@@ -758,7 +758,7 @@ void GpuMessageHandler::OnBrowserBridgeInitialized( ...@@ -758,7 +758,7 @@ void GpuMessageHandler::OnBrowserBridgeInitialized(
// Tell GpuDataManager it should have full GpuInfo. If the // Tell GpuDataManager it should have full GpuInfo. If the
// Gpu process has not run yet, this will trigger its launch. // Gpu process has not run yet, this will trigger its launch.
GpuDataManagerImpl::GetInstance()->RequestDxdiagDx12VulkanGpuInfoIfNeeded( GpuDataManagerImpl::GetInstance()->RequestDxdiagDx12VulkanGpuInfoIfNeeded(
kGpuInfoRequestAll, /*delayed*/ false); kGpuInfoRequestAll, /*delayed=*/false);
// Run callback immediately in case the info is ready and no update in the // Run callback immediately in case the info is ready and no update in the
// future. // future.
......
...@@ -916,22 +916,26 @@ IntelGpuGeneration GetIntelGpuGeneration(const GPUInfo& gpu_info) { ...@@ -916,22 +916,26 @@ IntelGpuGeneration GetIntelGpuGeneration(const GPUInfo& gpu_info) {
return latest; return latest;
} }
void CollectDevicePerfInfo(DevicePerfInfo* device_perf_info) { void CollectDevicePerfInfo(DevicePerfInfo* device_perf_info,
bool in_browser_process) {
DCHECK(device_perf_info); DCHECK(device_perf_info);
device_perf_info->total_physical_memory_mb = device_perf_info->total_physical_memory_mb =
static_cast<uint32_t>(base::SysInfo::AmountOfPhysicalMemoryMB()); static_cast<uint32_t>(base::SysInfo::AmountOfPhysicalMemoryMB());
device_perf_info->total_disk_space_mb = EstimateAmountOfTotalDiskSpaceMB(); if (!in_browser_process)
device_perf_info->total_disk_space_mb = EstimateAmountOfTotalDiskSpaceMB();
device_perf_info->hardware_concurrency = device_perf_info->hardware_concurrency =
static_cast<uint32_t>(std::thread::hardware_concurrency()); static_cast<uint32_t>(std::thread::hardware_concurrency());
#if defined(OS_WIN) #if defined(OS_WIN)
device_perf_info->system_commit_limit_mb = GetSystemCommitLimitMb(); device_perf_info->system_commit_limit_mb = GetSystemCommitLimitMb();
D3D_FEATURE_LEVEL d3d11_feature_level = D3D_FEATURE_LEVEL_1_0_CORE; if (!in_browser_process) {
bool has_discrete_gpu = false; D3D_FEATURE_LEVEL d3d11_feature_level = D3D_FEATURE_LEVEL_1_0_CORE;
if (CollectD3D11FeatureInfo(&d3d11_feature_level, &has_discrete_gpu)) { bool has_discrete_gpu = false;
device_perf_info->d3d11_feature_level = d3d11_feature_level; if (CollectD3D11FeatureInfo(&d3d11_feature_level, &has_discrete_gpu)) {
device_perf_info->has_discrete_gpu = device_perf_info->d3d11_feature_level = d3d11_feature_level;
has_discrete_gpu ? HasDiscreteGpu::kYes : HasDiscreteGpu::kNo; device_perf_info->has_discrete_gpu =
has_discrete_gpu ? HasDiscreteGpu::kYes : HasDiscreteGpu::kNo;
}
} }
#endif #endif
} }
......
...@@ -85,7 +85,11 @@ GPU_EXPORT std::string GetIntelGpuGeneration(uint32_t vendor_id, ...@@ -85,7 +85,11 @@ GPU_EXPORT std::string GetIntelGpuGeneration(uint32_t vendor_id,
// If multiple Intel GPUs are detected, this returns the latest generation. // If multiple Intel GPUs are detected, this returns the latest generation.
GPU_EXPORT IntelGpuGeneration GetIntelGpuGeneration(const GPUInfo& gpu_info); GPU_EXPORT IntelGpuGeneration GetIntelGpuGeneration(const GPUInfo& gpu_info);
GPU_EXPORT void CollectDevicePerfInfo(DevicePerfInfo* device_perf_info); // If this function is called in browser process (|in_browser_process| is set
// to true), don't collect total disk space (which may block) and D3D related
// info.
GPU_EXPORT void CollectDevicePerfInfo(DevicePerfInfo* device_perf_info,
bool in_browser_process);
GPU_EXPORT void RecordDevicePerfInfoHistograms(); GPU_EXPORT void RecordDevicePerfInfoHistograms();
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -128,7 +128,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -128,7 +128,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
if (gpu_preferences_.enable_perf_data_collection) { if (gpu_preferences_.enable_perf_data_collection) {
// This is only enabled on the info collection GPU process. // This is only enabled on the info collection GPU process.
DevicePerfInfo device_perf_info; DevicePerfInfo device_perf_info;
CollectDevicePerfInfo(&device_perf_info); CollectDevicePerfInfo(&device_perf_info, /*in_browser_process=*/false);
device_perf_info_ = device_perf_info; device_perf_info_ = device_perf_info;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment