summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/disk_cache/entry_impl.cc12
-rw-r--r--net/disk_cache/entry_impl.h21
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);