#include "components/performance_manager/public/resource_attribution/cpu_measurement_delegate.h"
#include "base/check.h"
#include "base/no_destructor.h"
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "components/performance_manager/public/graph/process_node.h"
#include "components/performance_manager/resource_attribution/cpu_measurement_monitor.h"
#include "components/performance_manager/resource_attribution/performance_manager_aliases.h"
#include "components/performance_manager/resource_attribution/query_scheduler.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/common/process_type.h"
namespace resource_attribution {
namespace {
class CPUMeasurementDelegateImpl final : public CPUMeasurementDelegate { … };
CPUMeasurementDelegateImpl::CPUMeasurementDelegateImpl(
const ProcessNode* process_node) { … }
base::expected<base::TimeDelta, CPUMeasurementDelegate::ProcessCPUUsageError>
CPUMeasurementDelegateImpl::GetCumulativeCPUUsage() { … }
class CPUMeasurementDelegateFactoryImpl final
: public CPUMeasurementDelegate::Factory { … };
bool CPUMeasurementDelegateFactoryImpl::ShouldMeasureProcess(
const ProcessNode* process_node) { … }
std::unique_ptr<CPUMeasurementDelegate>
CPUMeasurementDelegateFactoryImpl::CreateDelegateForProcess(
const ProcessNode* process_node) { … }
}
void CPUMeasurementDelegate::SetDelegateFactoryForTesting(Graph* graph,
Factory* factory) { … }
CPUMeasurementDelegate::Factory* CPUMeasurementDelegate::GetDefaultFactory() { … }
}