| Index: base/metrics/histogram.cc
|
| diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
|
| index fdc4c1a2c3390ec9da85bf649b0c44d4abccc0ab..daa4654c84a931d89360cc32d57a8cd39e3255b8 100644
|
| --- a/base/metrics/histogram.cc
|
| +++ b/base/metrics/histogram.cc
|
| @@ -137,7 +137,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
|
| @@ -287,7 +288,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,
|
| @@ -398,7 +399,7 @@ uint32_t Histogram::bucket_count() const {
|
| }
|
|
|
| // static
|
| -bool Histogram::InspectConstructionArguments(const std::string& name,
|
| +bool Histogram::InspectConstructionArguments(StringPiece name,
|
| Sample* minimum,
|
| Sample* maximum,
|
| uint32_t* bucket_count) {
|
| @@ -584,7 +585,7 @@ bool Histogram::ValidateHistogramContents(bool crash_if_invalid,
|
|
|
| // Abort if a problem is found (except "flags", which could legally be zero).
|
| const std::string debug_string = base::StringPrintf(
|
| - "%s/%" PRIu32 "#%d", histogram_name().c_str(), bad_fields, identifier);
|
| + "%s/%" PRIu32 "#%d", histogram_name(), bad_fields, identifier);
|
| #if !defined(OS_NACL)
|
| // Temporary for https://crbug.com/736675.
|
| base::debug::ScopedCrashKey crash_key("bad_histogram", debug_string);
|
| @@ -605,7 +606,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)
|
| @@ -616,7 +617,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,
|
| @@ -787,9 +788,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);
|
| @@ -870,7 +869,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 {
|
| @@ -898,8 +898,8 @@ HistogramBase* LinearHistogram::FactoryGet(const std::string& name,
|
| Sample maximum,
|
| uint32_t bucket_count,
|
| int32_t flags) {
|
| - return FactoryGetWithRangeDescription(name, minimum, maximum, bucket_count,
|
| - flags, nullptr);
|
| + return FactoryGetWithRangeDescription(
|
| + name, minimum, maximum, bucket_count, flags, NULL);
|
| }
|
|
|
| HistogramBase* LinearHistogram::FactoryTimeGet(const std::string& name,
|
| @@ -930,7 +930,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,
|
| @@ -961,15 +961,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,
|
| @@ -1069,7 +1068,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:
|
| @@ -1086,7 +1085,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,
|
| @@ -1100,12 +1099,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,
|
| @@ -1177,7 +1175,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:
|
| @@ -1203,7 +1201,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,
|
| @@ -1232,15 +1230,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,
|
|
|