summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorgavinp@google.com <gavinp@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 17:23:23 +0000
committergavinp@google.com <gavinp@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 17:23:23 +0000
commit3fc1df57120d98466f4fce571a80b037b59cec3a (patch)
tree83d10a7ee814027d5e7ad50383d41d49889a10e1 /net/http
parent1d6c9590e69c85bb4e704a35abb6a45bd6a0e367 (diff)
downloadchromium_src-3fc1df57120d98466f4fce571a80b037b59cec3a.zip
chromium_src-3fc1df57120d98466f4fce571a80b037b59cec3a.tar.gz
chromium_src-3fc1df57120d98466f4fce571a80b037b59cec3a.tar.bz2
Time cache lock waits
Chrome has a limitation that exclusive writers block all other readers or writers from accessing the cache. This CL creates an histogram so that I can track if this is actually a performance hit as prefetch starts arriving in the tree. BUG=none TEST=about:histograms Review URL: http://codereview.chromium.org/2831026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_cache_transaction.cc5
-rw-r--r--net/http/http_cache_transaction.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 3383909..f2257da 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -808,11 +808,16 @@ int HttpCache::Transaction::DoAddToEntry() {
cache_pending_ = true;
next_state_ = STATE_ADD_TO_ENTRY_COMPLETE;
net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
+ DCHECK(entry_lock_waiting_since_.is_null());
+ entry_lock_waiting_since_ = base::TimeTicks::Now();
return cache_->AddTransactionToEntry(new_entry_, this);
}
int HttpCache::Transaction::DoAddToEntryComplete(int result) {
net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
+ UMA_HISTOGRAM_TIMES("HttpCache.EntryLockWait",
+ base::TimeTicks::Now() - entry_lock_waiting_since_);
+ entry_lock_waiting_since_ = base::TimeTicks();
DCHECK(new_entry_);
cache_pending_ = false;
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index a3cb906..a458379 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -9,6 +9,7 @@
#define NET_HTTP_HTTP_CACHE_TRANSACTION_H_
#include "net/base/net_log.h"
+#include "base/time.h"
#include "net/http/http_cache.h"
#include "net/http/http_response_info.h"
#include "net/http/http_transaction.h"
@@ -312,6 +313,7 @@ class HttpCache::Transaction : public HttpTransaction {
ValidationHeaders external_validation_;
base::WeakPtr<HttpCache> cache_;
HttpCache::ActiveEntry* entry_;
+ base::TimeTicks entry_lock_waiting_since_;
HttpCache::ActiveEntry* new_entry_;
scoped_ptr<HttpTransaction> network_trans_;
CompletionCallback* callback_; // Consumer's callback.