Commit ee82ef83 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Label UMA data with backend name for SkiaRenderer

We plan to start vulkan finch for Linux Dev. This change labels UMA
data with backend names (GL, VK, etc). So we can compare metrics in UMA
by labels.

Bug: 1022495,1012393
Change-Id: I75404b4c7fc8d63d09e145b7a03342a7439e88ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1924632Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718118}
parent 8f391791
...@@ -545,6 +545,8 @@ jumbo_static_library("browser") { ...@@ -545,6 +545,8 @@ jumbo_static_library("browser") {
"google/google_search_domain_mixing_metrics_emitter.h", "google/google_search_domain_mixing_metrics_emitter.h",
"google/google_search_domain_mixing_metrics_emitter_factory.cc", "google/google_search_domain_mixing_metrics_emitter_factory.cc",
"google/google_search_domain_mixing_metrics_emitter_factory.h", "google/google_search_domain_mixing_metrics_emitter_factory.h",
"gpu/chrome_browser_main_extra_parts_gpu.cc",
"gpu/chrome_browser_main_extra_parts_gpu.h",
"gpu/gpu_mode_manager.cc", "gpu/gpu_mode_manager.cc",
"gpu/gpu_mode_manager.h", "gpu/gpu_mode_manager.h",
"hang_monitor/hang_crash_dump.h", "hang_monitor/hang_crash_dump.h",
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "chrome/browser/extensions/chrome_extension_cookies.h" #include "chrome/browser/extensions/chrome_extension_cookies.h"
#include "chrome/browser/external_protocol/external_protocol_handler.h" #include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/font_family_cache.h" #include "chrome/browser/font_family_cache.h"
#include "chrome/browser/gpu/chrome_browser_main_extra_parts_gpu.h"
#include "chrome/browser/hid/chrome_hid_delegate.h" #include "chrome/browser/hid/chrome_hid_delegate.h"
#include "chrome/browser/language/translate_frame_binder.h" #include "chrome/browser/language/translate_frame_binder.h"
#include "chrome/browser/lifetime/browser_shutdown.h" #include "chrome/browser/lifetime/browser_shutdown.h"
...@@ -1236,6 +1237,8 @@ ChromeContentBrowserClient::CreateBrowserMainParts( ...@@ -1236,6 +1237,8 @@ ChromeContentBrowserClient::CreateBrowserMainParts(
main_parts->AddParts(new ChromeBrowserMainExtraPartsMemory); main_parts->AddParts(new ChromeBrowserMainExtraPartsMemory);
main_parts->AddParts(new ChromeBrowserMainExtraPartsGpu);
chrome::AddMetricsExtraParts(main_parts.get()); chrome::AddMetricsExtraParts(main_parts.get());
return main_parts; return main_parts;
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/gpu/chrome_browser_main_extra_parts_gpu.h"
#include "base/logging.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "components/viz/common/features.h"
#include "content/public/browser/gpu_data_manager.h"
#include "gpu/config/gpu_info.h"
namespace {
const char kTrialName[] = "SkiaBackend";
const char kGL[] = "GL";
const char kVulkan[] = "Vulkan";
} // namespace
ChromeBrowserMainExtraPartsGpu::ChromeBrowserMainExtraPartsGpu() {}
ChromeBrowserMainExtraPartsGpu::~ChromeBrowserMainExtraPartsGpu() {
if (features::IsUsingSkiaRenderer())
content::GpuDataManager::GetInstance()->RemoveObserver(this);
}
void ChromeBrowserMainExtraPartsGpu::PostEarlyInitialization() {
if (features::IsUsingSkiaRenderer())
content::GpuDataManager::GetInstance()->AddObserver(this);
}
void ChromeBrowserMainExtraPartsGpu::OnGpuInfoUpdate() {
DCHECK(features::IsUsingSkiaRenderer());
ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial(
kTrialName, GetSkiaBackendName());
}
const char* ChromeBrowserMainExtraPartsGpu::GetSkiaBackendName() const {
auto* manager = content::GpuDataManager::GetInstance();
if (manager->GetFeatureStatus(gpu::GpuFeatureType::GPU_FEATURE_TYPE_VULKAN) ==
gpu::GpuFeatureStatus::kGpuFeatureStatusEnabled) {
return kVulkan;
}
return kGL;
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_GPU_CHROME_BROWSER_MAIN_EXTRA_PARTS_GPU_H_
#define CHROME_BROWSER_GPU_CHROME_BROWSER_MAIN_EXTRA_PARTS_GPU_H_
#include "chrome/browser/chrome_browser_main_extra_parts.h"
#include "content/public/browser/gpu_data_manager_observer.h"
namespace content {
class GpuDataManagerObserver;
}
class ChromeBrowserMainExtraPartsGpu : public ChromeBrowserMainExtraParts,
public content::GpuDataManagerObserver {
public:
ChromeBrowserMainExtraPartsGpu();
~ChromeBrowserMainExtraPartsGpu() override;
ChromeBrowserMainExtraPartsGpu(const ChromeBrowserMainExtraPartsGpu&) =
delete;
ChromeBrowserMainExtraPartsGpu& operator=(
const ChromeBrowserMainExtraPartsGpu&) = delete;
// ChromeBrowserMainExtraParts:
void PostEarlyInitialization() override;
// content::GpuDataManagerObserver:
void OnGpuInfoUpdate() override;
private:
const char* GetSkiaBackendName() const;
};
#endif // CHROME_BROWSER_GPU_CHROME_BROWSER_MAIN_EXTRA_PARTS_GPU_H_
...@@ -110,6 +110,7 @@ class ChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { ...@@ -110,6 +110,7 @@ class ChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor {
friend class ChromePasswordManagerClient; friend class ChromePasswordManagerClient;
friend void welcome::JoinOnboardingGroup(Profile* profile); friend void welcome::JoinOnboardingGroup(Profile* profile);
friend class NavigationMetricsRecorder; friend class NavigationMetricsRecorder;
friend class ChromeBrowserMainExtraPartsGpu;
// Testing related friends. // Testing related friends.
friend class first_run::FirstRunMasterPrefsVariationsSeedTest; friend class first_run::FirstRunMasterPrefsVariationsSeedTest;
......
...@@ -30,6 +30,12 @@ gpu::GPUInfo GpuDataManagerImpl::GetGPUInfo() { ...@@ -30,6 +30,12 @@ gpu::GPUInfo GpuDataManagerImpl::GetGPUInfo() {
return private_->GetGPUInfo(); return private_->GetGPUInfo();
} }
gpu::GpuFeatureStatus GpuDataManagerImpl::GetFeatureStatus(
gpu::GpuFeatureType feature) {
base::AutoLock auto_lock(lock_);
return private_->GetFeatureStatus(feature);
}
bool GpuDataManagerImpl::GpuAccessAllowed(std::string* reason) { bool GpuDataManagerImpl::GpuAccessAllowed(std::string* reason) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
return private_->GpuAccessAllowed(reason); return private_->GpuAccessAllowed(reason);
...@@ -57,12 +63,6 @@ bool GpuDataManagerImpl::IsGpuFeatureInfoAvailable() const { ...@@ -57,12 +63,6 @@ bool GpuDataManagerImpl::IsGpuFeatureInfoAvailable() const {
return private_->IsGpuFeatureInfoAvailable(); return private_->IsGpuFeatureInfoAvailable();
} }
gpu::GpuFeatureStatus GpuDataManagerImpl::GetFeatureStatus(
gpu::GpuFeatureType feature) const {
base::AutoLock auto_lock(lock_);
return private_->GetFeatureStatus(feature);
}
void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate( void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate(
VideoMemoryUsageStatsCallback callback) { VideoMemoryUsageStatsCallback callback) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
......
...@@ -48,6 +48,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager { ...@@ -48,6 +48,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager {
// GpuDataManager implementation. // GpuDataManager implementation.
void BlacklistWebGLForTesting() override; void BlacklistWebGLForTesting() override;
gpu::GPUInfo GetGPUInfo() override; gpu::GPUInfo GetGPUInfo() override;
gpu::GpuFeatureStatus GetFeatureStatus(gpu::GpuFeatureType feature) override;
bool GpuAccessAllowed(std::string* reason) override; bool GpuAccessAllowed(std::string* reason) override;
void RequestDxdiagDx12VulkanGpuInfoIfNeeded(GpuInfoRequest request, void RequestDxdiagDx12VulkanGpuInfoIfNeeded(GpuInfoRequest request,
bool delayed) override; bool delayed) override;
...@@ -70,7 +71,6 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager { ...@@ -70,7 +71,6 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager {
bool IsDx12VulkanVersionAvailable() const; bool IsDx12VulkanVersionAvailable() const;
bool IsGpuFeatureInfoAvailable() const; bool IsGpuFeatureInfoAvailable() const;
gpu::GpuFeatureStatus GetFeatureStatus(gpu::GpuFeatureType feature) const;
void UpdateGpuInfo( void UpdateGpuInfo(
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/process/process.h" #include "base/process/process.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_feature_type.h"
namespace base { namespace base {
class CommandLine; class CommandLine;
...@@ -50,6 +52,9 @@ class GpuDataManager { ...@@ -50,6 +52,9 @@ class GpuDataManager {
virtual gpu::GPUInfo GetGPUInfo() = 0; virtual gpu::GPUInfo GetGPUInfo() = 0;
virtual gpu::GpuFeatureStatus GetFeatureStatus(
gpu::GpuFeatureType feature) = 0;
// This indicator might change because we could collect more GPU info or // This indicator might change because we could collect more GPU info or
// because the GPU blacklist could be updated. // because the GPU blacklist could be updated.
// If this returns false, any further GPU access, including establishing GPU // If this returns false, any further GPU access, including establishing GPU
......
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