// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_PUBLIC_BROWSER_SWAP_METRICS_DRIVER_H_ #define CONTENT_PUBLIC_BROWSER_SWAP_METRICS_DRIVER_H_ #include <memory> #include "base/time/time.h" #include "content/common/content_export.h" namespace content { // This class collects metrics about the system's swapping behavior and provides // these metrics to an associated delegate. Metrics can be platform-specific. // // Updated swap metrics can be obtained through Delegate methods in either a // push-based manner, driven by a periodic base::Timer, or in a synchronous, // pull-based manner. For receiving periodic updates at a regular frequency, use // Start() to begin recieiving updates, and Stop() to end them. For obtaining // updates at specified times, for example over a specific interval or event, // use InitializeMetrics() at the start, and UpdateMetrics() at any subsequent // time to immediately and synchronously receive updates. In the case of // periodic updates, UpdateMetrics() can also be called after Stop() to retrieve // updated metrics since the last update. // // The SwapMetricsDriver API is not thread safe. The Delegate methods run on // either the sequence on which Start() was called, in the case of periodic // updates, or the sequence InitializeMetrics() is called on in the case of // using pull-based updates. In either case, metrics must always be updated on // the same sequence and subsequent invocations of this API's methods must be // made on that sequence. class CONTENT_EXPORT SwapMetricsDriver { … }; } // namespace content #endif // CONTENT_PUBLIC_BROWSER_SWAP_METRICS_DRIVER_H_