diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 22:17:57 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 22:17:57 +0000 |
commit | 6e3b12ff2cbbe8c481f986c8f0dd230bb50add2a (patch) | |
tree | 26be18d9402ef664c3bca61819667bbc64a86fd9 /chrome | |
parent | c157279b239fe6ece8bab2ddcec43ef200aeb3ea (diff) | |
download | chromium_src-6e3b12ff2cbbe8c481f986c8f0dd230bb50add2a.zip chromium_src-6e3b12ff2cbbe8c481f986c8f0dd230bb50add2a.tar.gz chromium_src-6e3b12ff2cbbe8c481f986c8f0dd230bb50add2a.tar.bz2 |
Add histograms to track the size of SafeBrowsing Updates.
We will now measure:
- the number of chunk URLs in an update
- the size of each chunk URL
- the total size of an update
Review URL: http://codereview.chromium.org/17213
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7622 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.cc | 18 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.h | 6 |
2 files changed, 20 insertions, 4 deletions
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index cd2c1be..13b4968 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -68,7 +68,8 @@ SafeBrowsingProtocolManager::SafeBrowsingProtocolManager( chunk_pending_to_write_(false), notify_loop_(notify_loop), client_key_(client_key), - wrapped_key_(wrapped_key) { + wrapped_key_(wrapped_key), + update_size_(0) { // Set the backoff multiplier fuzz to a random value between 0 and 1. back_off_fuzz_ = static_cast<float>(base::RandDouble()); @@ -218,7 +219,7 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete( << "failed parse."; must_back_off = true; chunk_request_urls_.clear(); - sb_service_->UpdateFinished(false); + UpdateFinished(false); } if (request_type_ == CHUNK_REQUEST && parsed_ok) { @@ -235,7 +236,7 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete( must_back_off = true; if (request_type_ == CHUNK_REQUEST) chunk_request_urls_.clear(); - sb_service_->UpdateFinished(false); + UpdateFinished(false); SB_DLOG(INFO) << "SafeBrowsing request for: " << source->url() << ", failed with error: " << response_code; } @@ -292,6 +293,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url, // New chunks to download. if (!chunk_urls.empty()) { + UMA_HISTOGRAM_COUNTS(L"SB2.UpdateUrls", chunk_urls.size()); for (size_t i = 0; i < chunk_urls.size(); ++i) chunk_request_urls_.push_back(chunk_urls[i]); } @@ -320,6 +322,8 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url, const ChunkUrl chunk_url = chunk_request_urls_.front(); bool re_key = false; std::deque<SBChunk>* chunks = new std::deque<SBChunk>; + UMA_HISTOGRAM_COUNTS(L"SB2.ChunkSize", length); + update_size_ += length; if (!parser.ParseChunk(data, length, client_key_, chunk_url.mac, &re_key, chunks)) { @@ -528,7 +532,7 @@ void SafeBrowsingProtocolManager::OnChunkInserted() { UMA_HISTOGRAM_LONG_TIMES(L"SB2.Update", Time::Now() - last_update_); else UMA_HISTOGRAM_LONG_TIMES(L"SB.Update", Time::Now() - last_update_); - sb_service_->UpdateFinished(true); + UpdateFinished(true); } else { IssueChunkRequest(); } @@ -567,3 +571,9 @@ void SafeBrowsingProtocolManager::HandleGetHashError() { int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); } + +void SafeBrowsingProtocolManager::UpdateFinished(bool success) { + UMA_HISTOGRAM_COUNTS(L"SB2.UpdateSize", update_size_); + update_size_ = 0; + sb_service_->UpdateFinished(success); +}
\ No newline at end of file diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h index bb64f67..62c392f 100644 --- a/chrome/browser/safe_browsing/protocol_manager.h +++ b/chrome/browser/safe_browsing/protocol_manager.h @@ -131,6 +131,9 @@ class SafeBrowsingProtocolManager : public URLFetcher::Delegate { // Update internal state for each GetHash response error. void HandleGetHashError(); + // Helper function for update completion. + void UpdateFinished(bool success); + private: // Main SafeBrowsing interface object. SafeBrowsingService* sb_service_; @@ -207,6 +210,9 @@ class SafeBrowsingProtocolManager : public URLFetcher::Delegate { // Used for measuring chunk request latency. base::Time chunk_request_start_; + // Track the size of each update (in bytes). + int update_size_; + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); }; |