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