diff options
author | adeshkp <adeshkp@users.noreply.github.com> | 2019-01-12 06:20:31 -0500 |
---|---|---|
committer | adeshkp <adeshkp@users.noreply.github.com> | 2019-01-12 06:20:31 -0500 |
commit | 5335681cd2ab05ad47e81be7722c9eee19d54065 (patch) | |
tree | eced0f22032c4f01229ac0a18b9ffb6219cea309 /netwerk/cache2/CacheStorageService.cpp | |
parent | f38edc94a31de3bae839cf63ed57c3851908ac46 (diff) | |
download | UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar.gz UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar.lz UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.tar.xz UXP-5335681cd2ab05ad47e81be7722c9eee19d54065.zip |
Telemetry: Remove stubs and related code
Diffstat (limited to 'netwerk/cache2/CacheStorageService.cpp')
-rw-r--r-- | netwerk/cache2/CacheStorageService.cpp | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/netwerk/cache2/CacheStorageService.cpp b/netwerk/cache2/CacheStorageService.cpp index 85f364e4e..3ee1e15cd 100644 --- a/netwerk/cache2/CacheStorageService.cpp +++ b/netwerk/cache2/CacheStorageService.cpp @@ -964,8 +964,6 @@ CacheStorageService::RegisterEntry(CacheEntry* aEntry) if (mShutdown || !aEntry->CanRegister()) return; - TelemetryRecordEntryCreation(aEntry); - LOG(("CacheStorageService::RegisterEntry [entry=%p]", aEntry)); MemoryPool& pool = Pool(aEntry->IsUsingDisk()); @@ -983,8 +981,6 @@ CacheStorageService::UnregisterEntry(CacheEntry* aEntry) if (!aEntry->IsRegistered()) return; - TelemetryRecordEntryRemoval(aEntry); - LOG(("CacheStorageService::UnregisterEntry [entry=%p]", aEntry)); MemoryPool& pool = Pool(aEntry->IsUsingDisk()); @@ -2018,100 +2014,6 @@ uint32_t CacheStorageService::CacheQueueSize(bool highPriority) return thread->QueueSize(highPriority); } -// Telementry collection - -namespace { - -bool TelemetryEntryKey(CacheEntry const* entry, nsAutoCString& key) -{ - nsAutoCString entryKey; - nsresult rv = entry->HashingKey(entryKey); - if (NS_FAILED(rv)) - return false; - - if (entry->GetStorageID().IsEmpty()) { - // Hopefully this will be const-copied, saves some memory - key = entryKey; - } else { - key.Assign(entry->GetStorageID()); - key.Append(':'); - key.Append(entryKey); - } - - return true; -} - -} // namespace - -void -CacheStorageService::TelemetryPrune(TimeStamp &now) -{ - static TimeDuration const oneMinute = TimeDuration::FromSeconds(60); - static TimeStamp dontPruneUntil = now + oneMinute; - if (now < dontPruneUntil) - return; - - static TimeDuration const fifteenMinutes = TimeDuration::FromSeconds(900); - for (auto iter = mPurgeTimeStamps.Iter(); !iter.Done(); iter.Next()) { - if (now - iter.Data() > fifteenMinutes) { - // We are not interested in resurrection of entries after 15 minutes - // of time. This is also the limit for the telemetry. - iter.Remove(); - } - } - dontPruneUntil = now + oneMinute; -} - -void -CacheStorageService::TelemetryRecordEntryCreation(CacheEntry const* entry) -{ - MOZ_ASSERT(CacheStorageService::IsOnManagementThread()); - - nsAutoCString key; - if (!TelemetryEntryKey(entry, key)) - return; - - TimeStamp now = TimeStamp::NowLoRes(); - TelemetryPrune(now); - - // When an entry is craeted (registered actually) we check if there is - // a timestamp marked when this very same cache entry has been removed - // (deregistered) because of over-memory-limit purging. If there is such - // a timestamp found accumulate telemetry on how long the entry was away. - TimeStamp timeStamp; - if (!mPurgeTimeStamps.Get(key, &timeStamp)) - return; - - mPurgeTimeStamps.Remove(key); - -} - -void -CacheStorageService::TelemetryRecordEntryRemoval(CacheEntry const* entry) -{ - MOZ_ASSERT(CacheStorageService::IsOnManagementThread()); - - // Doomed entries must not be considered, we are only interested in purged - // entries. Note that the mIsDoomed flag is always set before deregistration - // happens. - if (entry->IsDoomed()) - return; - - nsAutoCString key; - if (!TelemetryEntryKey(entry, key)) - return; - - // When an entry is removed (deregistered actually) we put a timestamp for this - // entry to the hashtable so that when the entry is created (registered) again - // we know how long it was away. Also accumulate number of AsyncOpen calls on - // the entry, this tells us how efficiently the pool actually works. - - TimeStamp now = TimeStamp::NowLoRes(); - TelemetryPrune(now); - mPurgeTimeStamps.Put(key, now); - -} - // nsIMemoryReporter size_t |