diff options
author | ellyjones <ellyjones@chromium.org> | 2015-04-28 11:55:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-28 18:56:58 +0000 |
commit | d5809f856236b6c7273470b4b7721269a083b148 (patch) | |
tree | 00d0c7fecbb299b0e620ab8554f2c5830063221c /net/sdch/sdch_owner.h | |
parent | 213a4dbd5994d5aad53acb08e8960804bbffbc07 (diff) | |
download | chromium_src-d5809f856236b6c7273470b4b7721269a083b148.zip chromium_src-d5809f856236b6c7273470b4b7721269a083b148.tar.gz chromium_src-d5809f856236b6c7273470b4b7721269a083b148.tar.bz2 |
SDCH: add TimeWeightedMemoryUse
This histogram tracks the time-weighted memory use incurred by SDCH
dictionaries. This histogram is measured in units of byte-seconds per
second.
BUG=465873
Review URL: https://codereview.chromium.org/1051353003
Cr-Commit-Position: refs/heads/master@{#327342}
Diffstat (limited to 'net/sdch/sdch_owner.h')
-rw-r--r-- | net/sdch/sdch_owner.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/net/sdch/sdch_owner.h b/net/sdch/sdch_owner.h index a600ac8..04b83a1 100644 --- a/net/sdch/sdch_owner.h +++ b/net/sdch/sdch_owner.h @@ -115,6 +115,52 @@ class NET_EXPORT SdchOwner : public SdchObserver, public PrefStore::Observer { 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<SdchManager> manager_; scoped_ptr<SdchDictionaryFetcher> fetcher_; @@ -157,6 +203,18 @@ class NET_EXPORT SdchOwner : public SdchObserver, public PrefStore::Observer { // 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_; + + // Creation time for this SdchOwner object, used for reporting temporal memory + // pressure. + base::Time creation_time_; + DISALLOW_COPY_AND_ASSIGN(SdchOwner); }; |