Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: third_party/leveldatabase/env_chromium.cc

Issue 862723002: leveldb: Moved to LevelDBEnv.IOError.BFE histogram entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back in IndexedDBLevelDBPFEMethods, fixed dates, misc. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/leveldatabase/env_chromium.cc
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index 42bdb42269373db25644e415dc94d8b5e907741b..e625887545336253e720716002b1e6b39a2b0fea 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -15,6 +15,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 "base/trace_event/trace_event.h"
#include "third_party/leveldatabase/chromium_logger.h"
@@ -326,6 +327,7 @@ class IDBEnv : public ChromiumEnv {
public:
IDBEnv() : ChromiumEnv() {
name_ = "LevelDBEnv.IDB";
+ uma_ioerror_base_name_ = name_ + ".IOError.BFE";
make_backup_ = true;
}
};
@@ -396,7 +398,7 @@ Status MakeIOError(Slice filename,
base::File::Error error) {
DCHECK_LT(error, 0);
char buf[512];
- snprintf(buf, sizeof(buf), "%s (ChromeMethodPFE: %d::%s::%d)",
+ snprintf(buf, sizeof(buf), "%s (ChromeMethodBFE: %d::%s::%d)",
message.c_str(), method, MethodIDToString(method), -error);
return Status::IOError(filename, buf);
}
@@ -422,13 +424,13 @@ ErrorParsingResult ParseMethodAndError(const leveldb::Status& status,
}
int parsed_error;
if (RE2::PartialMatch(status_string.c_str(),
- "ChromeMethodPFE: (\\d+)::.*::(\\d+)", &method,
+ "ChromeMethodBFE: (\\d+)::.*::(\\d+)", &method,
&parsed_error)) {
*method_param = static_cast<MethodID>(method);
*error = static_cast<base::File::Error>(-parsed_error);
DCHECK_LT(*error, base::File::FILE_OK);
DCHECK_GT(*error, base::File::FILE_ERROR_MAX);
- return METHOD_AND_PFE;
+ return METHOD_AND_BFE;
}
return NONE;
}
@@ -507,7 +509,7 @@ bool IndicatesDiskFull(const leveldb::Status& status) {
base::File::Error error = base::File::FILE_OK;
leveldb_env::ErrorParsingResult result =
leveldb_env::ParseMethodAndError(status, &method, &error);
- return (result == leveldb_env::METHOD_AND_PFE &&
+ return (result == leveldb_env::METHOD_AND_BFE &&
static_cast<base::File::Error>(error) ==
base::File::FILE_ERROR_NO_SPACE);
}
@@ -525,6 +527,7 @@ ChromiumEnv::ChromiumEnv()
bgsignal_(&mu_),
started_bgthread_(false),
kMaxRetryTimeMillis(1000) {
+ uma_ioerror_base_name_ = name_ + ".IOError.BFE";
}
ChromiumEnv::~ChromiumEnv() {
@@ -951,9 +954,9 @@ 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);
}

Powered by Google App Engine
This is Rietveld 408576698