Chromium Code Reviews| Index: third_party/leveldatabase/env_chromium.cc |
| diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc |
| index a12edf486182b04c2d58490300a67a9d72c541f0..6aa55ce9fdadba85e9c6d3849454d4cac250ebd2 100644 |
| --- a/third_party/leveldatabase/env_chromium.cc |
| +++ b/third_party/leveldatabase/env_chromium.cc |
| @@ -16,6 +16,7 @@ |
| #include "base/metrics/histogram.h" |
| #include "base/process/process_metrics.h" |
| #include "base/stl_util.h" |
| +#include "base/strings/stringprintf.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "third_party/leveldatabase/chromium_logger.h" |
| #include "third_party/re2/re2/re2.h" |
| @@ -326,6 +327,7 @@ class IDBEnv : public ChromiumEnv { |
| public: |
| IDBEnv() : ChromiumEnv() { |
| name_ = "LevelDBEnv.IDB"; |
| + uma_ioerror_base_name_ = name_ + ".IOError.PFE"; |
| make_backup_ = true; |
| } |
| }; |
| @@ -529,6 +531,7 @@ ChromiumEnv::ChromiumEnv() |
| bgsignal_(&mu_), |
| started_bgthread_(false), |
| kMaxRetryTimeMillis(1000) { |
| + uma_ioerror_base_name_ = name_ + ".IOError.PFE"; |
|
dgrogan
2015/01/21 01:47:56
maybe use bFE to indicate base::File::Error instea
cmumford
2015/02/13 22:15:52
I started with that originally, but eventually got
|
| } |
| ChromiumEnv::~ChromiumEnv() { |
| @@ -931,18 +934,17 @@ void ChromiumEnv::RecordBackupResult(bool result) const { |
| base::HistogramBase* ChromiumEnv::GetOSErrorHistogram(MethodID method, |
| int limit) const { |
| - std::string uma_name(name_); |
| - // TODO(dgrogan): This is probably not the best way to concatenate strings. |
| - uma_name.append(".IOError.").append(MethodIDToString(method)); |
| + std::string uma_name; |
| + base::StringAppendF(&uma_name, "%s.%s", uma_ioerror_base_name_.c_str(), |
| + MethodIDToString(method)); |
| return base::LinearHistogram::FactoryGet(uma_name, 1, limit, limit + 1, |
| base::Histogram::kUmaTargetedHistogramFlag); |
| } |
| base::HistogramBase* ChromiumEnv::GetMethodIOErrorHistogram() const { |
| - std::string uma_name(name_); |
| - uma_name.append(".IOError"); |
| - return base::LinearHistogram::FactoryGet(uma_name, 1, kNumEntries, |
| - kNumEntries + 1, base::Histogram::kUmaTargetedHistogramFlag); |
| + return base::LinearHistogram::FactoryGet( |
| + uma_ioerror_base_name_, 1, kNumEntries, kNumEntries + 1, |
| + base::Histogram::kUmaTargetedHistogramFlag); |
| } |
| base::HistogramBase* ChromiumEnv::GetMaxFDHistogram( |