diff options
author | cmumford <cmumford@chromium.org> | 2015-06-18 16:53:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-18 23:53:48 +0000 |
commit | f2d78ae3ab737eccbc676142341951ae8dfdc963 (patch) | |
tree | 17e74ae4252b17477102959ecb47e33e05f9a6f5 /content | |
parent | fbeb495115c2474d3d13525e6d06690e10e81c11 (diff) | |
download | chromium_src-f2d78ae3ab737eccbc676142341951ae8dfdc963.zip chromium_src-f2d78ae3ab737eccbc676142341951ae8dfdc963.tar.gz chromium_src-f2d78ae3ab737eccbc676142341951ae8dfdc963.tar.bz2 |
IndexedDB: Added UMA stat to measure time to close backing store.
Close can block on a background compaction, so log to reveal possible
performance issues.
BUG=502025
Review URL: https://codereview.chromium.org/1180803003
Cr-Commit-Position: refs/heads/master@{#335163}
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/indexed_db/leveldb/leveldb_database.cc | 11 | ||||
-rw-r--r-- | content/browser/indexed_db/leveldb/leveldb_database.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/content/browser/indexed_db/leveldb/leveldb_database.cc b/content/browser/indexed_db/leveldb/leveldb_database.cc index 459a16e..2c18f1f 100644 --- a/content/browser/indexed_db/leveldb/leveldb_database.cc +++ b/content/browser/indexed_db/leveldb/leveldb_database.cc @@ -86,11 +86,20 @@ LevelDBDatabase::LevelDBDatabase() {} LevelDBDatabase::~LevelDBDatabase() { // db_'s destructor uses comparator_adapter_; order of deletion is important. - db_.reset(); + CloseDatabase(); comparator_adapter_.reset(); env_.reset(); } +void LevelDBDatabase::CloseDatabase() { + if (db_) { + base::TimeTicks begin_time = base::TimeTicks::Now(); + db_.reset(); + UMA_HISTOGRAM_MEDIUM_TIMES("WebCore.IndexedDB.LevelDB.CloseTime", + base::TimeTicks::Now() - begin_time); + } +} + static leveldb::Status OpenDB( leveldb::Comparator* comparator, leveldb::Env* env, diff --git a/content/browser/indexed_db/leveldb/leveldb_database.h b/content/browser/indexed_db/leveldb/leveldb_database.h index ddc6aa5..60a38ec 100644 --- a/content/browser/indexed_db/leveldb/leveldb_database.h +++ b/content/browser/indexed_db/leveldb/leveldb_database.h @@ -101,6 +101,8 @@ class CONTENT_EXPORT LevelDBDatabase { private: friend class LevelDBSnapshot; + void CloseDatabase(); + scoped_ptr<leveldb::Env> env_; scoped_ptr<leveldb::Comparator> comparator_adapter_; scoped_ptr<leveldb::DB> db_; |