#ifndef SYSTEM_WRAPPERS_INCLUDE_METRICS_H_
#define SYSTEM_WRAPPERS_INCLUDE_METRICS_H_
#include <stddef.h>
#include <atomic>
#include <map>
#include <memory>
#include <string>
#include "absl/strings/string_view.h"
#include "rtc_base/checks.h"
#include "rtc_base/string_utils.h"
#if defined(RTC_DISABLE_METRICS)
#define RTC_METRICS_ENABLED …
#else
#define RTC_METRICS_ENABLED …
#endif
namespace webrtc {
namespace metrics_impl {
template <typename... Ts>
void NoOp(const Ts&...) { … }
}
}
#if RTC_METRICS_ENABLED
#define EXPECT_METRIC_EQ(val1, val2) …
#define EXPECT_METRIC_EQ_WAIT(val1, val2, timeout) …
#define EXPECT_METRIC_GT(val1, val2) …
#define EXPECT_METRIC_LE(val1, val2) …
#define EXPECT_METRIC_TRUE(conditon) …
#define EXPECT_METRIC_FALSE(conditon) …
#define EXPECT_METRIC_THAT(value, matcher) …
#else
#define EXPECT_METRIC_EQ …
#define EXPECT_METRIC_EQ_WAIT …
#define EXPECT_METRIC_GT …
#define EXPECT_METRIC_LE …
#define EXPECT_METRIC_TRUE …
#define EXPECT_METRIC_FALSE …
#define EXPECT_METRIC_THAT …
#endif
#if RTC_METRICS_ENABLED
#define RTC_HISTOGRAM_COUNTS_100(name, sample) …
#define RTC_HISTOGRAM_COUNTS_200(name, sample) …
#define RTC_HISTOGRAM_COUNTS_500(name, sample) …
#define RTC_HISTOGRAM_COUNTS_1000(name, sample) …
#define RTC_HISTOGRAM_COUNTS_10000(name, sample) …
#define RTC_HISTOGRAM_COUNTS_100000(name, sample) …
#define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) …
#define RTC_HISTOGRAM_COUNTS_LINEAR(name, sample, min, max, bucket_count) …
#define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) …
#define RTC_HISTOGRAM_COUNTS_SPARSE_200(name, sample) …
#define RTC_HISTOGRAM_COUNTS_SPARSE_500(name, sample) …
#define RTC_HISTOGRAM_COUNTS_SPARSE_1000(name, sample) …
#define RTC_HISTOGRAM_COUNTS_SPARSE_10000(name, sample) …
#define RTC_HISTOGRAM_COUNTS_SPARSE_100000(name, sample) …
#define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) …
#define RTC_HISTOGRAM_PERCENTAGE_SPARSE(name, sample) …
#define RTC_HISTOGRAM_BOOLEAN_SPARSE(name, sample) …
#define RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, boundary) …
#define RTC_HISTOGRAM_PERCENTAGE(name, sample) …
#define RTC_HISTOGRAM_BOOLEAN(name, sample) …
#define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) …
#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \
factory_get_invocation) …
#define RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, factory_get_invocation) …
#define RTC_HISTOGRAMS_COUNTS_100(index, name, sample) …
#define RTC_HISTOGRAMS_COUNTS_200(index, name, sample) …
#define RTC_HISTOGRAMS_COUNTS_500(index, name, sample) …
#define RTC_HISTOGRAMS_COUNTS_1000(index, name, sample) …
#define RTC_HISTOGRAMS_COUNTS_10000(index, name, sample) …
#define RTC_HISTOGRAMS_COUNTS_100000(index, name, sample) …
#define RTC_HISTOGRAMS_ENUMERATION(index, name, sample, boundary) …
#define RTC_HISTOGRAMS_PERCENTAGE(index, name, sample) …
#define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) …
#else
#define RTC_HISTOGRAM_COUNTS_100 …
#define RTC_HISTOGRAM_COUNTS_200 …
#define RTC_HISTOGRAM_COUNTS_500 …
#define RTC_HISTOGRAM_COUNTS_1000 …
#define RTC_HISTOGRAM_COUNTS_10000 …
#define RTC_HISTOGRAM_COUNTS_100000 …
#define RTC_HISTOGRAM_COUNTS …
#define RTC_HISTOGRAM_COUNTS_LINEAR …
#define RTC_HISTOGRAM_COUNTS_SPARSE_100 …
#define RTC_HISTOGRAM_COUNTS_SPARSE_200 …
#define RTC_HISTOGRAM_COUNTS_SPARSE_500 …
#define RTC_HISTOGRAM_COUNTS_SPARSE_1000 …
#define RTC_HISTOGRAM_COUNTS_SPARSE_10000 …
#define RTC_HISTOGRAM_COUNTS_SPARSE_100000 …
#define RTC_HISTOGRAM_COUNTS_SPARSE …
#define RTC_HISTOGRAM_PERCENTAGE_SPARSE …
#define RTC_HISTOGRAM_BOOLEAN_SPARSE …
#define RTC_HISTOGRAM_ENUMERATION_SPARSE …
#define RTC_HISTOGRAM_PERCENTAGE …
#define RTC_HISTOGRAM_BOOLEAN …
#define RTC_HISTOGRAM_ENUMERATION …
#define RTC_HISTOGRAM_COMMON_BLOCK …
#define RTC_HISTOGRAM_COMMON_BLOCK_SLOW …
#define RTC_HISTOGRAMS_COUNTS_100 …
#define RTC_HISTOGRAMS_COUNTS_200 …
#define RTC_HISTOGRAMS_COUNTS_500 …
#define RTC_HISTOGRAMS_COUNTS_1000 …
#define RTC_HISTOGRAMS_COUNTS_10000 …
#define RTC_HISTOGRAMS_COUNTS_100000 …
#define RTC_HISTOGRAMS_ENUMERATION …
#define RTC_HISTOGRAMS_PERCENTAGE …
#define RTC_HISTOGRAMS_COMMON …
#endif
namespace webrtc {
namespace metrics {
constexpr int kMinRunTimeInSeconds = …;
class Histogram;
Histogram* HistogramFactoryGetCounts(absl::string_view name,
int min,
int max,
int bucket_count);
Histogram* HistogramFactoryGetCountsLinear(absl::string_view name,
int min,
int max,
int bucket_count);
Histogram* HistogramFactoryGetEnumeration(absl::string_view name, int boundary);
Histogram* SparseHistogramFactoryGetEnumeration(absl::string_view name,
int boundary);
void HistogramAdd(Histogram* histogram_pointer, int sample);
struct SampleInfo { … };
void Enable();
void GetAndReset(
std::map<std::string, std::unique_ptr<SampleInfo>, rtc::AbslStringViewCmp>*
histograms);
void Reset();
int NumEvents(absl::string_view name, int sample);
int NumSamples(absl::string_view name);
int MinSample(absl::string_view name);
std::map<int, int> Samples(absl::string_view name);
}
}
#endif