Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1438)

Unified Diff: net/http/http_cache_transaction.h

Issue 10808047: Add HttpCache histograms focussed on blocking and transaction type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to review Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_cache_transaction.h
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index 5b1dc6c5eaa9a7b747aa913a9065ec797038cd2b..e1a7dbc4cb67fd51aa7ed021a7a4b2126ff14598 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -174,6 +174,19 @@ class HttpCache::Transaction : public HttpTransaction {
STATE_CACHE_WRITE_DATA_COMPLETE
};
+ // Used for categorizing transactions for reporting in histograms. Patterns
+ // cover relatively common use cases being measured and considered for
+ // optimization. Many use cases that are more complex or uncommon are binned
+ // as PATTERN_NOT_COVERED, and details are not reported.
+ enum TransactionPattern {
+ PATTERN_UNDEFINED,
+ PATTERN_NOT_COVERED,
+ PATTERN_ENTRY_NOT_CACHED,
+ PATTERN_ENTRY_USED,
+ PATTERN_ENTRY_VALIDATED,
+ PATTERN_ENTRY_UPDATED,
+ };
+
// This is a helper function used to trigger a completion callback. It may
// only be called if callback_ is non-null.
void DoCallback(int rv);
@@ -334,6 +347,11 @@ class HttpCache::Transaction : public HttpTransaction {
// Called to signal completion of asynchronous IO.
void OnIOComplete(int result);
+ void UpdateTransactionPattern(TransactionPattern new_transaction_pattern);
+
+ // Called on completion of a request to record performance.
+ void RecordHistograms();
+
State next_state_;
const HttpRequestInfo* request_;
BoundNetLog net_log_;
@@ -344,7 +362,6 @@ 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.
@@ -371,6 +388,15 @@ class HttpCache::Transaction : public HttpTransaction {
uint64 final_upload_progress_;
base::WeakPtrFactory<Transaction> weak_factory_;
CompletionCallback io_callback_;
+
+ // Members used to track data for histograms.
+ TransactionPattern transaction_pattern_;
+ int bytes_read_from_cache_;
+ int bytes_read_from_network_;
+ base::TimeTicks entry_lock_waiting_since_;
+ base::TimeTicks open_entry_since_;
+ base::TimeTicks doom_entry_since_;
+ base::TimeTicks send_request_since_;
};
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698