Also ran 'git cl format' on this file since I was touching a lot of it anyway.
[chromium-blink-merge.git] / components / rappor / rappor_parameters.h
blob814ed2ffca51b60d478d22f24b4115f16e5b8a0e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
6 #define COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
8 #include <string>
10 namespace rappor {
12 enum Probability {
13 PROBABILITY_75, // 75%
14 PROBABILITY_50, // 50%
15 PROBABILITY_25, // 25%
19 // A metric is reported when it's reporting level is >= the reporting level
20 // passed in to RapporService::Start()
21 enum RecordingLevel {
22 // No metrics are reported at this level.
23 RECORDING_DISABLED = 0,
24 // Metrics suitable for broader populations.
25 COARSE_LEVEL,
26 // Metrics suitable for UMA opt-in users.
27 FINE_LEVEL,
30 // An object describing a rappor metric and the parameters used to generate it.
32 // For a full description of the rappor metrics, see
33 // http://www.chromium.org/developers/design-documents/rappor
34 struct RapporParameters {
35 // Get a string representing the parameters, for DCHECK_EQ.
36 std::string ToString() const;
38 // The maximum number of cohorts we divide clients into.
39 static const int kMaxCohorts;
41 // The number of cohorts to divide the reports for this metric into.
42 // This should divide kMaxCohorts evenly so that each cohort has an equal
43 // probability of being assigned users.
44 int num_cohorts;
46 // The number of bytes stored in the Bloom filter.
47 int bloom_filter_size_bytes;
48 // The number of hash functions used in the Bloom filter.
49 int bloom_filter_hash_function_count;
51 // The probability that a bit will be redacted with fake data.
52 Probability fake_prob;
53 // The probability that a fake bit will be a one.
54 Probability fake_one_prob;
56 // The probability that a one bit in the redacted data reports as one.
57 Probability one_coin_prob;
58 // The probability that a zero bit in the redacted data reports as one.
59 Probability zero_coin_prob;
61 // The reporting level this metric is reported at.
62 RecordingLevel recording_level;
65 } // namespace rappor
67 #endif // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_