| Index: base/metrics/histogram.cc
|
| diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
|
| index df440851db3af159bac424d0526beafdc48fc022..20613a0b7c451a299204dfc7df8fc93297c75c95 100644
|
| --- a/base/metrics/histogram.cc
|
| +++ b/base/metrics/histogram.cc
|
| @@ -125,7 +125,8 @@ class Histogram::Factory {
|
| // Allocate the correct Histogram object off the heap (in case persistent
|
| // memory is not available).
|
| virtual std::unique_ptr<HistogramBase> HeapAlloc(const BucketRanges* ranges) {
|
| - return WrapUnique(new Histogram(name_, minimum_, maximum_, ranges));
|
| + return WrapUnique(
|
| + new Histogram(GetPermanentName(name_), minimum_, maximum_, ranges));
|
| }
|
|
|
| // Perform any required datafill on the just-created histogram. If
|
| @@ -275,7 +276,7 @@ HistogramBase* Histogram::FactoryTimeGet(const char* name,
|
| }
|
|
|
| std::unique_ptr<HistogramBase> Histogram::PersistentCreate(
|
| - const std::string& name,
|
| + const char* name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| @@ -540,7 +541,7 @@ bool Histogram::SerializeInfoImpl(Pickle* pickle) const {
|
| }
|
|
|
| // TODO(bcwhite): Remove minimum/maximum parameters from here and call chain.
|
| -Histogram::Histogram(const std::string& name,
|
| +Histogram::Histogram(const char* name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges)
|
| @@ -551,7 +552,7 @@ Histogram::Histogram(const std::string& name,
|
| logged_samples_.reset(new SampleVector(unlogged_samples_->id(), ranges));
|
| }
|
|
|
| -Histogram::Histogram(const std::string& name,
|
| +Histogram::Histogram(const char* name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| @@ -720,9 +721,7 @@ double Histogram::GetPeakBucketSize(const SampleVectorBase& samples) const {
|
| void Histogram::WriteAsciiHeader(const SampleVectorBase& samples,
|
| Count sample_count,
|
| std::string* output) const {
|
| - StringAppendF(output,
|
| - "Histogram: %s recorded %d samples",
|
| - histogram_name().c_str(),
|
| + StringAppendF(output, "Histogram: %s recorded %d samples", histogram_name(),
|
| sample_count);
|
| if (sample_count == 0) {
|
| DCHECK_EQ(samples.sum(), 0);
|
| @@ -803,7 +802,8 @@ class LinearHistogram::Factory : public Histogram::Factory {
|
|
|
| std::unique_ptr<HistogramBase> HeapAlloc(
|
| const BucketRanges* ranges) override {
|
| - return WrapUnique(new LinearHistogram(name_, minimum_, maximum_, ranges));
|
| + return WrapUnique(new LinearHistogram(GetPermanentName(name_), minimum_,
|
| + maximum_, ranges));
|
| }
|
|
|
| void FillHistogram(HistogramBase* base_histogram) override {
|
| @@ -863,7 +863,7 @@ HistogramBase* LinearHistogram::FactoryTimeGet(const char* name,
|
| }
|
|
|
| std::unique_ptr<HistogramBase> LinearHistogram::PersistentCreate(
|
| - const std::string& name,
|
| + const char* name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| @@ -894,15 +894,14 @@ HistogramType LinearHistogram::GetHistogramType() const {
|
| return LINEAR_HISTOGRAM;
|
| }
|
|
|
| -LinearHistogram::LinearHistogram(const std::string& name,
|
| +LinearHistogram::LinearHistogram(const char* name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges)
|
| - : Histogram(name, minimum, maximum, ranges) {
|
| -}
|
| + : Histogram(name, minimum, maximum, ranges) {}
|
|
|
| LinearHistogram::LinearHistogram(
|
| - const std::string& name,
|
| + const char* name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| @@ -999,7 +998,7 @@ class BooleanHistogram::Factory : public Histogram::Factory {
|
|
|
| std::unique_ptr<HistogramBase> HeapAlloc(
|
| const BucketRanges* ranges) override {
|
| - return WrapUnique(new BooleanHistogram(name_, ranges));
|
| + return WrapUnique(new BooleanHistogram(GetPermanentName(name_), ranges));
|
| }
|
|
|
| private:
|
| @@ -1016,7 +1015,7 @@ HistogramBase* BooleanHistogram::FactoryGet(const char* name, int32_t flags) {
|
| }
|
|
|
| std::unique_ptr<HistogramBase> BooleanHistogram::PersistentCreate(
|
| - const std::string& name,
|
| + const char* name,
|
| const BucketRanges* ranges,
|
| const DelayedPersistentAllocation& counts,
|
| const DelayedPersistentAllocation& logged_counts,
|
| @@ -1030,12 +1029,11 @@ HistogramType BooleanHistogram::GetHistogramType() const {
|
| return BOOLEAN_HISTOGRAM;
|
| }
|
|
|
| -BooleanHistogram::BooleanHistogram(const std::string& name,
|
| - const BucketRanges* ranges)
|
| +BooleanHistogram::BooleanHistogram(const char* name, const BucketRanges* ranges)
|
| : LinearHistogram(name, 1, 2, ranges) {}
|
|
|
| BooleanHistogram::BooleanHistogram(
|
| - const std::string& name,
|
| + const char* name,
|
| const BucketRanges* ranges,
|
| const DelayedPersistentAllocation& counts,
|
| const DelayedPersistentAllocation& logged_counts,
|
| @@ -1104,7 +1102,7 @@ class CustomHistogram::Factory : public Histogram::Factory {
|
|
|
| std::unique_ptr<HistogramBase> HeapAlloc(
|
| const BucketRanges* ranges) override {
|
| - return WrapUnique(new CustomHistogram(name_, ranges));
|
| + return WrapUnique(new CustomHistogram(GetPermanentName(name_), ranges));
|
| }
|
|
|
| private:
|
| @@ -1130,7 +1128,7 @@ HistogramBase* CustomHistogram::FactoryGet(
|
| }
|
|
|
| std::unique_ptr<HistogramBase> CustomHistogram::PersistentCreate(
|
| - const std::string& name,
|
| + const char* name,
|
| const BucketRanges* ranges,
|
| const DelayedPersistentAllocation& counts,
|
| const DelayedPersistentAllocation& logged_counts,
|
| @@ -1159,15 +1157,14 @@ std::vector<Sample> CustomHistogram::ArrayToCustomRanges(
|
| return all_values;
|
| }
|
|
|
| -CustomHistogram::CustomHistogram(const std::string& name,
|
| - const BucketRanges* ranges)
|
| +CustomHistogram::CustomHistogram(const char* name, const BucketRanges* ranges)
|
| : Histogram(name,
|
| ranges->range(1),
|
| ranges->range(ranges->bucket_count() - 1),
|
| ranges) {}
|
|
|
| CustomHistogram::CustomHistogram(
|
| - const std::string& name,
|
| + const char* name,
|
| const BucketRanges* ranges,
|
| const DelayedPersistentAllocation& counts,
|
| const DelayedPersistentAllocation& logged_counts,
|
|
|