OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ | 5 #ifndef COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ |
6 #define COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ | 6 #define COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ |
ncarter (slow)
2016/12/01 22:33:32
Update this guard (PSA: when moving files around,
Navid Zolghadr
2016/12/02 20:47:35
Oops. I wish I knew this before. Thanks for lettin
| |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace rappor { | 10 namespace rappor { |
11 | 11 |
12 // Levels of noise added to a sample. | 12 // Levels of noise added to a sample. |
13 enum NoiseLevel { | 13 enum NoiseLevel { |
14 NO_NOISE = 0, | 14 NO_NOISE = 0, |
15 NORMAL_NOISE, | 15 NORMAL_NOISE, |
16 SPARSE_NOISE, | 16 SPARSE_NOISE, |
(...skipping 16 matching lines...) Expand all Loading... | |
33 // Type for low-frequency metrics from SafeBrowsing users. | 33 // Type for low-frequency metrics from SafeBrowsing users. |
34 LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE, | 34 LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE, |
35 // Type for low-frequency metrics from UMA opt-in users. Do not use for new | 35 // Type for low-frequency metrics from UMA opt-in users. Do not use for new |
36 // metrics. | 36 // metrics. |
37 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 37 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
38 NUM_RAPPOR_TYPES, | 38 NUM_RAPPOR_TYPES, |
39 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE, | 39 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE, |
40 }; | 40 }; |
41 | 41 |
42 enum Probability { | 42 enum Probability { |
43 PROBABILITY_100, // 100% | 43 PROBABILITY_100, // 100% |
44 PROBABILITY_75, // 75% | 44 PROBABILITY_75, // 75% |
45 PROBABILITY_50, // 50% | 45 PROBABILITY_50, // 50% |
46 PROBABILITY_25, // 25% | 46 PROBABILITY_25, // 25% |
47 PROBABILITY_0, // 0% | 47 PROBABILITY_0, // 0% |
48 }; | 48 }; |
49 | 49 |
50 | |
51 // A metric is reported when its reporting group is in the set of groups | 50 // A metric is reported when its reporting group is in the set of groups |
52 // passed in to RapporService::Start() | 51 // passed in to RapporService::Start() |
53 enum RecordingGroup { | 52 enum RecordingGroup { |
54 // Metrics for UMA users. | 53 // Metrics for UMA users. |
55 UMA_RAPPOR_GROUP = 1 << 0, | 54 UMA_RAPPOR_GROUP = 1 << 0, |
56 // Metrics related to SafeBrowsing, for SafeBrowsing users. | 55 // Metrics related to SafeBrowsing, for SafeBrowsing users. |
57 SAFEBROWSING_RAPPOR_GROUP = 1 << 1, | 56 SAFEBROWSING_RAPPOR_GROUP = 1 << 1, |
58 }; | 57 }; |
59 | 58 |
60 | |
61 // An object describing noise probabilities for a noise level | 59 // An object describing noise probabilities for a noise level |
62 struct NoiseParameters { | 60 struct NoiseParameters { |
63 // The probability that a bit will be redacted with fake data. This | 61 // The probability that a bit will be redacted with fake data. This |
64 // corresponds to the F privacy parameter. | 62 // corresponds to the F privacy parameter. |
65 Probability fake_prob; | 63 Probability fake_prob; |
66 // The probability that a fake bit will be a one. | 64 // The probability that a fake bit will be a one. |
67 Probability fake_one_prob; | 65 Probability fake_one_prob; |
68 // The probability that a one bit in the redacted data reports as one. This | 66 // The probability that a one bit in the redacted data reports as one. This |
69 // corresponds to the Q privacy parameter | 67 // corresponds to the Q privacy parameter |
70 Probability one_coin_prob; | 68 Probability one_coin_prob; |
(...skipping 28 matching lines...) Expand all Loading... | |
99 | 97 |
100 // The reporting level this metric is reported at. | 98 // The reporting level this metric is reported at. |
101 RecordingGroup recording_group; | 99 RecordingGroup recording_group; |
102 }; | 100 }; |
103 | 101 |
104 namespace internal { | 102 namespace internal { |
105 | 103 |
106 const NoiseParameters kNoiseParametersForLevel[NUM_NOISE_LEVELS] = { | 104 const NoiseParameters kNoiseParametersForLevel[NUM_NOISE_LEVELS] = { |
107 // NO_NOISE | 105 // NO_NOISE |
108 { | 106 { |
109 rappor::PROBABILITY_0 /* Fake data probability */, | 107 rappor::PROBABILITY_0 /* Fake data probability */, |
110 rappor::PROBABILITY_0 /* Fake one probability */, | 108 rappor::PROBABILITY_0 /* Fake one probability */, |
111 rappor::PROBABILITY_100 /* One coin probability */, | 109 rappor::PROBABILITY_100 /* One coin probability */, |
112 rappor::PROBABILITY_0 /* Zero coin probability */, | 110 rappor::PROBABILITY_0 /* Zero coin probability */, |
113 }, | 111 }, |
114 // NORMAL_NOISE | 112 // NORMAL_NOISE |
115 { | 113 { |
116 rappor::PROBABILITY_50 /* Fake data probability */, | 114 rappor::PROBABILITY_50 /* Fake data probability */, |
117 rappor::PROBABILITY_50 /* Fake one probability */, | 115 rappor::PROBABILITY_50 /* Fake one probability */, |
118 rappor::PROBABILITY_75 /* One coin probability */, | 116 rappor::PROBABILITY_75 /* One coin probability */, |
119 rappor::PROBABILITY_25 /* Zero coin probability */, | 117 rappor::PROBABILITY_25 /* Zero coin probability */, |
120 }, | 118 }, |
121 // SPARSE_NOISE | 119 // SPARSE_NOISE |
122 { | 120 { |
123 rappor::PROBABILITY_25 /* Fake data probability */, | 121 rappor::PROBABILITY_25 /* Fake data probability */, |
124 rappor::PROBABILITY_50 /* Fake one probability */, | 122 rappor::PROBABILITY_50 /* Fake one probability */, |
125 rappor::PROBABILITY_75 /* One coin probability */, | 123 rappor::PROBABILITY_75 /* One coin probability */, |
126 rappor::PROBABILITY_25 /* Zero coin probability */, | 124 rappor::PROBABILITY_25 /* Zero coin probability */, |
127 }, | 125 }, |
128 }; | 126 }; |
129 | 127 |
130 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { | 128 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { |
131 // UMA_RAPPOR_TYPE | 129 // UMA_RAPPOR_TYPE |
132 {128 /* Num cohorts */, | 130 {128 /* Num cohorts */, 4 /* Bloom filter size bytes */, |
ncarter (slow)
2016/12/01 22:33:32
totally optional: if you want to preserve the old
Navid Zolghadr
2016/12/02 20:47:35
I guess git cl format made it like this. I changed
| |
133 4 /* Bloom filter size bytes */, | 131 2 /* Bloom filter hash count */, rappor::NORMAL_NOISE /* Noise level */, |
134 2 /* Bloom filter hash count */, | |
135 rappor::NORMAL_NOISE /* Noise level */, | |
136 UMA_RAPPOR_GROUP /* Recording group */}, | 132 UMA_RAPPOR_GROUP /* Recording group */}, |
137 // SAFEBROWSING_RAPPOR_TYPE | 133 // SAFEBROWSING_RAPPOR_TYPE |
138 {128 /* Num cohorts */, | 134 {128 /* Num cohorts */, 1 /* Bloom filter size bytes */, |
139 1 /* Bloom filter size bytes */, | 135 2 /* Bloom filter hash count */, rappor::NORMAL_NOISE /* Noise level */, |
140 2 /* Bloom filter hash count */, | |
141 rappor::NORMAL_NOISE /* Noise level */, | |
142 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, | 136 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, |
143 // ETLD_PLUS_ONE_RAPPOR_TYPE | 137 // ETLD_PLUS_ONE_RAPPOR_TYPE |
144 {128 /* Num cohorts */, | 138 {128 /* Num cohorts */, 16 /* Bloom filter size bytes */, |
145 16 /* Bloom filter size bytes */, | 139 2 /* Bloom filter hash count */, rappor::NORMAL_NOISE /* Noise level */, |
146 2 /* Bloom filter hash count */, | |
147 rappor::NORMAL_NOISE /* Noise level */, | |
148 UMA_RAPPOR_GROUP /* Recording group */}, | 140 UMA_RAPPOR_GROUP /* Recording group */}, |
149 // LOW_FREQUENCY_UMA_RAPPOR_TYPE | 141 // LOW_FREQUENCY_UMA_RAPPOR_TYPE |
150 {128 /* Num cohorts */, | 142 {128 /* Num cohorts */, 4 /* Bloom filter size bytes */, |
151 4 /* Bloom filter size bytes */, | 143 2 /* Bloom filter hash count */, rappor::SPARSE_NOISE /* Noise level */, |
152 2 /* Bloom filter hash count */, | |
153 rappor::SPARSE_NOISE /* Noise level */, | |
154 UMA_RAPPOR_GROUP /* Recording group */}, | 144 UMA_RAPPOR_GROUP /* Recording group */}, |
155 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE | 145 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE |
156 {128 /* Num cohorts */, | 146 {128 /* Num cohorts */, 1 /* Bloom filter size bytes */, |
157 1 /* Bloom filter size bytes */, | 147 2 /* Bloom filter hash count */, rappor::SPARSE_NOISE /* Noise level */, |
158 2 /* Bloom filter hash count */, | |
159 rappor::SPARSE_NOISE /* Noise level */, | |
160 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, | 148 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, |
161 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE | 149 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE |
162 {128 /* Num cohorts */, | 150 {128 /* Num cohorts */, 16 /* Bloom filter size bytes */, |
163 16 /* Bloom filter size bytes */, | 151 2 /* Bloom filter hash count */, rappor::SPARSE_NOISE /* Noise level */, |
164 2 /* Bloom filter hash count */, | |
165 rappor::SPARSE_NOISE /* Noise level */, | |
166 UMA_RAPPOR_GROUP /* Recording group */}, | 152 UMA_RAPPOR_GROUP /* Recording group */}, |
167 }; | 153 }; |
168 | 154 |
169 } // namespace internal | 155 } // namespace internal |
170 | 156 |
171 } // namespace rappor | 157 } // namespace rappor |
172 | 158 |
173 #endif // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ | 159 #endif // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ |
OLD | NEW |