diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 23:05:46 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 23:05:46 +0000 |
commit | 447baadf9dd279ae3dfb226ba34c75c48f3da930 (patch) | |
tree | 59a025fb0ec67ccc35cac98182fda81d64cab619 /net/disk_cache | |
parent | fda418552b5a32755b4414c172f4b5c52615e502 (diff) | |
download | chromium_src-447baadf9dd279ae3dfb226ba34c75c48f3da930.zip chromium_src-447baadf9dd279ae3dfb226ba34c75c48f3da930.tar.gz chromium_src-447baadf9dd279ae3dfb226ba34c75c48f3da930.tar.bz2 |
Disk cache: Add a histogram to measure the latency of
asynchronous IO.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/178023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24829 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/entry_impl.cc | 12 | ||||
-rw-r--r-- | net/disk_cache/entry_impl.h | 21 |
2 files changed, 20 insertions, 13 deletions
diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 0f25684..4b650d9 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -29,7 +29,7 @@ class SyncCallback: public disk_cache::FileIOCallback { public: SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, net::CompletionCallback* callback ) - : entry_(entry), callback_(callback), buf_(buffer) { + : entry_(entry), callback_(callback), buf_(buffer), start_(Time::Now()) { entry->AddRef(); entry->IncrementIoCount(); } @@ -41,15 +41,18 @@ class SyncCallback: public disk_cache::FileIOCallback { disk_cache::EntryImpl* entry_; net::CompletionCallback* callback_; scoped_refptr<net::IOBuffer> buf_; + Time start_; DISALLOW_EVIL_CONSTRUCTORS(SyncCallback); }; void SyncCallback::OnFileIOComplete(int bytes_copied) { entry_->DecrementIoCount(); - entry_->Release(); - if (callback_) + if (callback_) { + entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); callback_->Run(bytes_copied); + } + entry_->Release(); delete this; } @@ -880,6 +883,9 @@ void EntryImpl::ReportIOTime(Operation op, const base::Time& start) { case kSparseWrite: CACHE_UMA(AGE_MS, "SparseWriteTime", 0, start); break; + case kAsyncIO: + CACHE_UMA(AGE_MS, "AsyncIOTime", group, start); + break; default: NOTREACHED(); } diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index 4bb4d04..f5961f9 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -21,6 +21,14 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { friend class base::RefCounted<EntryImpl>; friend class SparseControl; public: + enum Operation { + kRead, + kWrite, + kSparseRead, + kSparseWrite, + kAsyncIO + }; + EntryImpl(BackendImpl* backend, Addr address); // Entry interface. @@ -99,18 +107,14 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { // the upgrade tool. void SetTimes(base::Time last_used, base::Time last_modified); + // Generates a histogram for the time spent working on this operation. + void ReportIOTime(Operation op, const base::Time& start); + private: enum { kNumStreams = 3 }; - enum Operation { - kRead, - kWrite, - kSparseRead, - kSparseWrite - }; - ~EntryImpl(); // Initializes the storage for an internal or external data block. @@ -166,9 +170,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { // actual cleanup. void GetData(int index, char** buffer, Addr* address); - // Generates a histogram for the time spent working on this operation. - void ReportIOTime(Operation op, const base::Time& start); - // Logs this entry to the internal trace buffer. void Log(const char* msg); |