// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/cpu_reduction_experiment.h" #include <atomic> #include "base/check.h" #include "base/dcheck_is_on.h" #include "base/feature_list.h" #include "base/rand_util.h" namespace base { namespace { // Whether to enable a series of optimizations that reduce total CPU // utilization. BASE_FEATURE(…); class CpuReductionExperimentSubSampler { … }; // Singleton instance of CpuReductionExperimentSubSampler. This is only set when // the ReduceCpuUtilization experiment is enabled -- as a result, it's ok to // assume that the experiment is disabled when this is not set. CpuReductionExperimentSubSampler* g_subsampler = …; #if DCHECK_IS_ON() // Atomic to support concurrent writes from IsRunningCpuReductionExperiment(). std::atomic_bool g_accessed_subsampler = …; #endif } // namespace bool IsRunningCpuReductionExperiment() { … } void InitializeCpuReductionExperiment() { … } bool ShouldLogHistogramForCpuReductionExperiment() { … } } // namespace base