// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // StatisticsRecorder holds all Histograms and BucketRanges that are used by // Histograms in the system. It provides a general place for // Histograms/BucketRanges to register, and supports a global API for accessing // (i.e., dumping, or graphing) the data. #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ #define BASE_METRICS_STATISTICS_RECORDER_H_ #include <stdint.h> #include <atomic> // For std::memory_order_*. #include <memory> #include <string> #include <string_view> #include <unordered_map> #include <vector> #include "base/base_export.h" #include "base/functional/callback.h" #include "base/gtest_prod_util.h" #include "base/lazy_instance.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_base.h" #include "base/metrics/ranges_manager.h" #include "base/metrics/record_histogram_checker.h" #include "base/observer_list_threadsafe.h" #include "base/synchronization/lock.h" #include "base/thread_annotations.h" #include "base/types/pass_key.h" namespace base { class BucketRanges; class HistogramSnapshotManager; // In-memory recorder of usage statistics (aka metrics, aka histograms). // // All the public methods are static and act on a global recorder. This global // recorder is internally synchronized and all the static methods are thread // safe. This is intended to only be run/used in the browser process. // // StatisticsRecorder doesn't have any public constructor. For testing purpose, // you can create a temporary recorder using the factory method // CreateTemporaryForTesting(). This temporary recorder becomes the global one // until deleted. When this temporary recorder is deleted, it restores the // previous global one. class BASE_EXPORT StatisticsRecorder { … }; } // namespace base #endif // BASE_METRICS_STATISTICS_RECORDER_H_