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

Unified Diff: net/sdch/sdch_owner.h

Issue 1051353003: SDCH: add TimeWeightedMemoryUse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change metric denominator Created 5 years, 9 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
« no previous file with comments | « no previous file | net/sdch/sdch_owner.cc » ('j') | net/sdch/sdch_owner.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/sdch/sdch_owner.h
diff --git a/net/sdch/sdch_owner.h b/net/sdch/sdch_owner.h
index 1655275d67a3e8365dc61cf8b01268a5e2884906..8099cd726ba049f550e52179ef9c4fa3ca803b38 100644
--- a/net/sdch/sdch_owner.h
+++ b/net/sdch/sdch_owner.h
@@ -116,6 +116,52 @@ class NET_EXPORT SdchOwner : public net::SdchObserver,
bool IsPersistingDictionaries() const;
+ enum DictionaryFate {
+ // A Get-Dictionary header wasn't acted on.
+ DICTIONARY_FATE_GET_IGNORED = 1,
+
+ // A fetch was attempted, but failed.
+ // TODO(rdsmith): Actually record this case.
+ DICTIONARY_FATE_FETCH_FAILED = 2,
+
+ // A successful fetch was dropped on the floor, no space.
+ DICTIONARY_FATE_FETCH_IGNORED_NO_SPACE = 3,
+
+ // A successful fetch was refused by the SdchManager.
+ DICTIONARY_FATE_FETCH_MANAGER_REFUSED = 4,
+
+ // A dictionary was successfully added based on
+ // a Get-Dictionary header in a response.
+ DICTIONARY_FATE_ADD_RESPONSE_TRIGGERED = 5,
+
+ // A dictionary was evicted by an incoming dict.
+ DICTIONARY_FATE_EVICT_FOR_DICT = 6,
+
+ // A dictionary was evicted by memory pressure.
+ DICTIONARY_FATE_EVICT_FOR_MEMORY = 7,
+
+ // A dictionary was evicted on destruction.
+ DICTIONARY_FATE_EVICT_FOR_DESTRUCTION = 8,
+
+ // A dictionary was successfully added based on
+ // persistence from a previous browser revision.
+ DICTIONARY_FATE_ADD_PERSISTENCE_TRIGGERED = 9,
+
+ // A dictionary was unloaded on destruction, but is still present on disk.
+ DICTIONARY_FATE_UNLOAD_FOR_DESTRUCTION = 10,
+
+ DICTIONARY_FATE_MAX = 11
+ };
+
+ void RecordDictionaryFate(DictionaryFate fate);
+
+ // Record the lifetime memory use of a specified dictionary, identified by
+ // server hash.
+ void RecordDictionaryEvictionOrUnload(
+ const std::string& server_hash,
+ size_t size,
+ int use_count, DictionaryFate fate);
+
// For investigation of http://crbug.com/454198; remove when resolved.
base::WeakPtr<net::SdchManager> manager_;
scoped_ptr<net::SdchDictionaryFetcher> fetcher_;
@@ -158,6 +204,14 @@ class NET_EXPORT SdchOwner : public net::SdchObserver,
// load.
std::map<std::string, int> use_counts_at_load_;
+ // Load times for loaded dictionaries, keyed by server hash. These are used to
+ // track the durations that dictionaries are in memory.
+ std::map<std::string, base::Time> load_times_;
+
+ // Byte-seconds consumed by dictionaries that have been unloaded. These are
+ // stored for later uploading in the SdchOwner destructor.
+ std::vector<int64> consumed_byte_seconds_;
+
DISALLOW_COPY_AND_ASSIGN(SdchOwner);
};
« no previous file with comments | « no previous file | net/sdch/sdch_owner.cc » ('j') | net/sdch/sdch_owner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698