summaryrefslogtreecommitdiffstats
path: root/third_party/leveldatabase/env_chromium.cc
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-14 05:59:35 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-14 05:59:35 +0000
commite0b4c627baae8e17905d40195b1168d1f206c8e0 (patch)
tree871628b7006ed691404f1512f125223e6e84e0c8 /third_party/leveldatabase/env_chromium.cc
parentd68d318078d07c351c926a4788873bdc7102e448 (diff)
downloadchromium_src-e0b4c627baae8e17905d40195b1168d1f206c8e0.zip
chromium_src-e0b4c627baae8e17905d40195b1168d1f206c8e0.tar.gz
chromium_src-e0b4c627baae8e17905d40195b1168d1f206c8e0.tar.bz2
Record number of non-existing path components of LockFile path
When LevelDB's lock file can't be created because the directory is not found, histogram the number of directories needed to be stripped before an existent directory is found. BUG=239999 Review URL: https://chromiumcodereview.appspot.com/15104002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/leveldatabase/env_chromium.cc')
-rw-r--r--third_party/leveldatabase/env_chromium.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index 68f4f6e..46915e2 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -622,6 +622,20 @@ class ChromiumEnv : public Env, public UMALogger {
} while (error_code != ::base::PLATFORM_FILE_OK &&
retrier.ShouldKeepTrying());
+ if (error_code == ::base::PLATFORM_FILE_ERROR_NOT_FOUND) {
+ ::base::FilePath parent = CreateFilePath(fname).DirName();
+ ::base::FilePath last_parent;
+ int num_missing_ancestors = 0;
+ do {
+ if (file_util::DirectoryExists(parent))
+ break;
+ ++num_missing_ancestors;
+ last_parent = parent;
+ parent = parent.DirName();
+ } while (parent != last_parent);
+ RecordLockFileAncestors(num_missing_ancestors);
+ }
+
if (error_code != ::base::PLATFORM_FILE_OK) {
result = Status::IOError(fname, PlatformFileErrorString(error_code));
RecordOSError(kLockFile, error_code);
@@ -693,6 +707,10 @@ class ChromiumEnv : public Env, public UMALogger {
GetMethodIOErrorHistogram()->Add(method);
}
+ void RecordLockFileAncestors(int num_missing_ancestors) const {
+ GetLockFileAncestorHistogram()->Add(num_missing_ancestors);
+ }
+
void RecordOSError(MethodID method, base::PlatformFileError error) const {
DCHECK(error < 0);
RecordErrorAt(method);
@@ -720,7 +738,8 @@ class ChromiumEnv : public Env, public UMALogger {
base::HistogramBase* GetOSErrorHistogram(MethodID method, int limit) const;
base::HistogramBase* GetRetryTimeHistogram(MethodID method) const;
base::HistogramBase* GetMethodIOErrorHistogram() const;
- base::HistogramBase* GetMaxFDHistogram(const std::string& type);
+ base::HistogramBase* GetMaxFDHistogram(const std::string& type) const;
+ base::HistogramBase* GetLockFileAncestorHistogram() const;
base::FilePath test_directory_;
::base::Lock mu_;
@@ -772,7 +791,7 @@ base::HistogramBase* ChromiumEnv::GetMethodIOErrorHistogram() const {
}
base::HistogramBase* ChromiumEnv::GetMaxFDHistogram(
- const std::string& type) {
+ const std::string& type) const {
std::string uma_name(name_);
uma_name.append(".MaxFDs.").append(type);
// These numbers make each bucket twice as large as the previous bucket.
@@ -784,6 +803,17 @@ base::HistogramBase* ChromiumEnv::GetMaxFDHistogram(
base::Histogram::kUmaTargetedHistogramFlag);
}
+base::HistogramBase* ChromiumEnv::GetLockFileAncestorHistogram() const {
+ std::string uma_name(name_);
+ uma_name.append(".LockFileAncestorsNotFound");
+ const int kMin = 1;
+ const int kMax = 10;
+ const int kNumBuckets = 11;
+ return base::LinearHistogram::FactoryGet(
+ uma_name, kMin, kMax, kNumBuckets,
+ base::Histogram::kUmaTargetedHistogramFlag);
+}
+
class Thread : public ::base::PlatformThread::Delegate {
public:
Thread(void (*function)(void* arg), void* arg)