chromium/chrome/browser/performance_monitor/system_monitor.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/performance_monitor/system_monitor.h"

#include <algorithm>
#include <utility>

#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"

#if BUILDFLAG(IS_WIN)
#include "chrome/browser/performance_monitor/metric_evaluator_helper_win.h"
#elif BUILDFLAG(IS_POSIX)
#include "chrome/browser/performance_monitor/metric_evaluator_helper_posix.h"
#endif

namespace performance_monitor {

namespace {

MetricRefreshFrequencies;

// The global instance.
SystemMonitor* g_system_metrics_monitor =;

// The default interval at which the metrics are refreshed.
constexpr base::TimeDelta kDefaultRefreshInterval =;

}  // namespace

SystemMonitor::SystemMonitor(
    std::unique_ptr<MetricEvaluatorsHelper> metric_evaluators_helper)
    :{}

SystemMonitor::~SystemMonitor() {}

// static
std::unique_ptr<SystemMonitor> SystemMonitor::Create() {}

// static
std::unique_ptr<SystemMonitor> SystemMonitor::CreateForTesting(
    std::unique_ptr<MetricEvaluatorsHelper> helper) {}

// static
SystemMonitor* SystemMonitor::Get() {}

MetricRefreshFrequencies::Builder&
MetricRefreshFrequencies::Builder::SetFreePhysMemoryMbFrequency(
    SamplingFrequency freq) {}

MetricRefreshFrequencies::Builder&
MetricRefreshFrequencies::Builder::SetSystemMetricsSamplingFrequency(
    SamplingFrequency freq) {}

MetricRefreshFrequencies MetricRefreshFrequencies::Builder::Build() {}

SystemMonitor::SystemObserver::~SystemObserver() {}

void SystemMonitor::SystemObserver::OnFreePhysicalMemoryMbSample(
    int free_phys_memory_mb) {}

void SystemMonitor::SystemObserver::OnSystemMetricsStruct(
    const base::SystemMetrics& system_metrics) {}

void SystemMonitor::AddOrUpdateObserver(
    SystemMonitor::SystemObserver* observer,
    MetricRefreshFrequencies metrics_and_frequencies) {}

void SystemMonitor::RemoveObserver(SystemMonitor::SystemObserver* observer) {}

SystemMonitor::MetricVector SystemMonitor::GetMetricsToEvaluate() const {}

// static
SystemMonitor::MetricVector SystemMonitor::EvaluateMetrics(
    SystemMonitor::MetricVector metrics_to_evaluate) {}

SystemMonitor::MetricMetadataArray SystemMonitor::CreateMetricMetadataArray() {}  // namespace performance_monitor

void SystemMonitor::UpdateObservedMetrics() {}

void SystemMonitor::RefreshCallback() {}

void SystemMonitor::NotifyObservers(SystemMonitor::MetricVector metrics) {}

// static
std::unique_ptr<MetricEvaluatorsHelper>
SystemMonitor::CreateMetricEvaluatorsHelper() {}

SystemMonitor::MetricEvaluator::MetricEvaluator(Type type) :{}
SystemMonitor::MetricEvaluator::~MetricEvaluator() = default;

template <typename T>
SystemMonitor::MetricEvaluatorImpl<T>::MetricEvaluatorImpl(
    Type type,
    base::OnceCallback<std::optional<T>()> evaluate_function,
    void (SystemObserver::*notify_function)(ObserverArgType))
    :{}

template <typename T>
SystemMonitor::MetricEvaluatorImpl<T>::~MetricEvaluatorImpl() = default;

SystemMonitor::MetricMetadata::MetricMetadata(
    std::unique_ptr<MetricEvaluator> (*create_function)(
        MetricEvaluatorsHelper* helper),
    SamplingFrequency (*get_refresh_field_function)(
        const SystemMonitor::SystemObserver::MetricRefreshFrequencies&))
    :{}

template <typename T>
void SystemMonitor::MetricEvaluatorImpl<T>::NotifyObserver(
    SystemObserver* observer) {}

template <typename T>
void SystemMonitor::MetricEvaluatorImpl<T>::Evaluate() {}

std::optional<base::SystemMetrics>
MetricEvaluatorsHelper::GetSystemMetricsStruct() {}

}  // namespace performance_monitor