// 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. #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_SYSTEM_MONITOR_H_ #define CHROME_BROWSER_PERFORMANCE_MONITOR_SYSTEM_MONITOR_H_ #include <array> #include <memory> #include <optional> #include <vector> #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/process/process_metrics.h" #include "base/sequence_checker.h" #include "base/task/sequenced_task_runner.h" #include "base/timer/timer.h" namespace performance_monitor { class MetricEvaluatorsHelper; // Monitors various various system metrics such as free memory, disk idle time, // etc. // // Must be created and used from the UI thread. // // Users of this class need to subscribe as observers via the // AddOrUpdateObserver method. They need to specify which metrics they're // interested in and at which frequency they should be refreshed. This set of // metrics and frequencies can then be updated at runtime. // // Platforms that want to use this class need to provide a platform specific // implementation of the MetricEvaluatorHelper class. class SystemMonitor { … }; // A builder class used to easily create a MetricRefreshFrequencies object. class SystemMonitor::SystemObserver::MetricRefreshFrequencies::Builder { … }; // An helper class used by the MetricEvaluator object to retrieve the info // they need. class MetricEvaluatorsHelper { … }; } // namespace performance_monitor #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_SYSTEM_MONITOR_H_