Index: base/metrics/histogram.cc |
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc |
index 4262853a80fd65c322c04da55bb8ef766df77a93..6fd30be87ab8d8da79163fb7ab10d53e42f0d553 100644 |
--- a/base/metrics/histogram.cc |
+++ b/base/metrics/histogram.cc |
@@ -940,6 +940,21 @@ Histogram::ClassType CustomHistogram::histogram_type() const { |
return CUSTOM_HISTOGRAM; |
} |
+// static |
+std::vector<Histogram::Sample> CustomHistogram::ArrayToCustomRanges( |
+ const Sample* values, size_t num_values) { |
+ std::vector<Sample> all_values; |
+ for (size_t i = 0; i < num_values; ++i) { |
+ Sample value = values[i]; |
+ all_values.push_back(value); |
+ |
+ // Ensure that a guard bucket is added. If we end up with duplicate |
+ // values, FactoryGet will take care of removing them. |
+ all_values.push_back(value + 1); |
+ } |
+ return all_values; |
+} |
+ |
CustomHistogram::CustomHistogram(const std::string& name, |
const std::vector<Sample>& custom_ranges) |
: Histogram(name, custom_ranges[1], custom_ranges.back(), |