xref: /aosp_15_r20/external/cronet/components/metrics/histogram_encoder.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 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 // This file defines an utility function that records any changes in a given
6 // histogram for transmission.
7 
8 #ifndef COMPONENTS_METRICS_HISTOGRAM_ENCODER_H_
9 #define COMPONENTS_METRICS_HISTOGRAM_ENCODER_H_
10 
11 #include <string>
12 
13 #include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h"
14 
15 namespace base {
16 class HistogramSamples;
17 }
18 
19 namespace metrics {
20 
21 // Record any changes (histogram deltas of counts from |snapshot|) into
22 // |uma_proto| for the given histogram (|histogram_name|).
23 void EncodeHistogramDelta(const std::string& histogram_name,
24                           const base::HistogramSamples& snapshot,
25                           ChromeUserMetricsExtension* uma_proto);
26 
27 }  // namespace metrics
28 
29 #endif  // COMPONENTS_METRICS_HISTOGRAM_ENCODER_H_
30