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 #include "components/nacl/renderer/histogram.h" | 5 #include "components/nacl/renderer/histogram.h" |
6 | 6 |
| 7 #include <algorithm> |
| 8 |
7 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
8 | 10 |
9 namespace nacl { | 11 namespace nacl { |
10 | 12 |
11 void HistogramCustomCounts(const std::string& name, | 13 void HistogramCustomCounts(const std::string& name, |
12 int32_t sample, | 14 int32_t sample, |
13 int32_t min, | 15 int32_t min, |
14 int32_t max, | 16 int32_t max, |
15 uint32_t bucket_count) { | 17 uint32_t bucket_count) { |
16 base::HistogramBase* counter = | 18 base::HistogramBase* counter = |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 static const int32_t kRatioMax = 10 * 100; // max of 10x difference. | 207 static const int32_t kRatioMax = 10 * 100; // max of 10x difference. |
206 static const uint32_t kRatioBuckets = 100; | 208 static const uint32_t kRatioBuckets = 100; |
207 if (numerator < 0 || denominator <= 0) | 209 if (numerator < 0 || denominator <= 0) |
208 return; | 210 return; |
209 HistogramCustomCounts(name, | 211 HistogramCustomCounts(name, |
210 static_cast<int32_t>(100 * numerator / denominator), | 212 static_cast<int32_t>(100 * numerator / denominator), |
211 kRatioMin, kRatioMax, kRatioBuckets); | 213 kRatioMin, kRatioMax, kRatioBuckets); |
212 } | 214 } |
213 | 215 |
214 } // namespace nacl | 216 } // namespace nacl |
OLD | NEW |