summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-23 20:12:10 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-23 20:12:10 +0000
commitb2ea1adfbbceeddb1bd62e6314bae9276ea89aed (patch)
treeba5c72af27712bae464a0beafb3c1e5f70896f53 /net/http
parent8c8fc29e21510bfd89bef9d2e4301270e4aa91a0 (diff)
downloadchromium_src-b2ea1adfbbceeddb1bd62e6314bae9276ea89aed.zip
chromium_src-b2ea1adfbbceeddb1bd62e6314bae9276ea89aed.tar.gz
chromium_src-b2ea1adfbbceeddb1bd62e6314bae9276ea89aed.tar.bz2
Infinite cache comparison histograms.
This simpler version of the apples-to-apples comparison keys from the origin of the data for the first data received, rather than the http transaction pattern. The result is much shorter code. I avoided calling these "hits", since the term hit is used to describe something subtly different throughout the rest of the http code. Instead, I fell back to "strong hit." R=rvargas@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/11416077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/infinite_cache.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/net/http/infinite_cache.cc b/net/http/infinite_cache.cc
index e683509..a89d752 100644
--- a/net/http/infinite_cache.cc
+++ b/net/http/infinite_cache.cc
@@ -451,6 +451,8 @@ class InfiniteCache::Worker : public base::RefCountedThreadSafe<Worker> {
// Bulk of report generation methods.
void RecordHit(const Details& old, Details* details);
void RecordUpdate(const Details& old, Details* details);
+ void RecordComparison(bool infinite_used_or_validated,
+ bool http_used_or_validated) const;
void GenerateHistograms();
// Cache logic methods.
@@ -531,6 +533,11 @@ void InfiniteCache::Worker::Process(
if (data->details.flags & NO_STORE)
UMA_HISTOGRAM_BOOLEAN("InfiniteCache.NoStore", true);
+ // True if the first range of the http request was validated or used
+ // unconditionally, false if it was not found in the cache, was updated,
+ // or was found but was unconditionalizable.
+ bool http_used_or_validated = (data->details.flags & CACHED) == CACHED;
+
header_->num_requests++;
KeyMap::iterator i = map_.find(data->key);
if (i != map_.end()) {
@@ -546,6 +553,8 @@ void InfiniteCache::Worker::Process(
bool data_changed = DataChanged(i->second, data->details);
bool headers_changed = HeadersChanged(i->second, data->details);
+ RecordComparison(reused, http_used_or_validated);
+
if (reused && data_changed)
header_->num_bad_hits++;
@@ -566,6 +575,8 @@ void InfiniteCache::Worker::Process(
map_[data->key] = data->details;
return;
+ } else {
+ RecordComparison(false, http_used_or_validated);
}
if (data->details.flags & NO_STORE)
@@ -883,6 +894,42 @@ void InfiniteCache::Worker::RecordUpdate(const Details& old, Details* details) {
details->use_count = 0;
}
+void InfiniteCache::Worker::RecordComparison(
+ bool infinite_used_or_validated,
+ bool http_used_or_validated) const {
+ enum Comparison {
+ INFINITE_NOT_STRONG_HIT_HTTP_NOT_STRONG_HIT,
+ INFINITE_NOT_STRONG_HIT_HTTP_STRONG_HIT,
+ INFINITE_STRONG_HIT_HTTP_NOT_STRONG_HIT,
+ INFINITE_STRONG_HIT_HTTP_STRONG_HIT,
+ COMPARISON_ENUM_MAX,
+ };
+
+ Comparison comparison;
+ if (infinite_used_or_validated) {
+ if (http_used_or_validated)
+ comparison = INFINITE_STRONG_HIT_HTTP_STRONG_HIT;
+ else
+ comparison = INFINITE_STRONG_HIT_HTTP_NOT_STRONG_HIT;
+ } else {
+ if (http_used_or_validated)
+ comparison = INFINITE_NOT_STRONG_HIT_HTTP_STRONG_HIT;
+ else
+ comparison = INFINITE_NOT_STRONG_HIT_HTTP_NOT_STRONG_HIT;
+ }
+
+ UMA_HISTOGRAM_ENUMERATION("InfiniteCache.Comparison",
+ comparison, COMPARISON_ENUM_MAX);
+ const int size_bucket =
+ static_cast<int>(header_->total_size / kReportSizeStep);
+ const int kComparisonBuckets = 50;
+ UMA_HISTOGRAM_ENUMERATION(
+ "InfiniteCache.ComparisonBySize",
+ comparison * kComparisonBuckets + std::min(size_bucket,
+ kComparisonBuckets-1),
+ kComparisonBuckets * COMPARISON_ENUM_MAX);
+}
+
void InfiniteCache::Worker::GenerateHistograms() {
bool new_size_step = (header_->total_size / kReportSizeStep !=
header_->size_last_report / kReportSizeStep);