1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_CLIENT_STATS_IMPL_H_
6 #define NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_CLIENT_STATS_IMPL_H_
7
8 #include "base/metrics/histogram_functions.h"
9 #include "base/metrics/histogram_macros.h"
10
11 namespace quiche {
12
13 // By convention, all QUIC histograms are prefixed by "Net.".
14 #define QUICHE_HISTOGRAM_NAME(raw_name) "Net." raw_name
15
16 #define QUICHE_CLIENT_HISTOGRAM_ENUM_IMPL(name, sample, enum_size, docstring) \
17 UMA_HISTOGRAM_ENUMERATION(QUICHE_HISTOGRAM_NAME(name), sample, enum_size)
18
19 #define QUICHE_CLIENT_HISTOGRAM_BOOL_IMPL(name, sample, docstring) \
20 UMA_HISTOGRAM_BOOLEAN(QUICHE_HISTOGRAM_NAME(name), sample)
21
22 #define QUICHE_CLIENT_HISTOGRAM_TIMES_IMPL(name, sample, min, max, \
23 bucket_count, docstring) \
24 UMA_HISTOGRAM_CUSTOM_TIMES(QUICHE_HISTOGRAM_NAME(name), \
25 base::Microseconds(sample.ToMicroseconds()), \
26 base::Microseconds(min.ToMicroseconds()), \
27 base::Microseconds(max.ToMicroseconds()), \
28 bucket_count)
29
30 #define QUICHE_CLIENT_HISTOGRAM_COUNTS_IMPL(name, sample, min, max, \
31 bucket_count, docstring) \
32 UMA_HISTOGRAM_CUSTOM_COUNTS(QUICHE_HISTOGRAM_NAME(name), sample, min, max, \
33 bucket_count)
34
QuicheClientSparseHistogramImpl(const std::string & name,int sample)35 inline void QuicheClientSparseHistogramImpl(const std::string& name,
36 int sample) {
37 base::UmaHistogramSparse(name, sample);
38 }
39
40 } // namespace quiche
41
42 #endif // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_CLIENT_STATS_IMPL_H_
43