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 | af29df9d80d70163d9ace8fbdd1cd3723f93bd6e (patch) | |
tree | eced0f22032c4f01229ac0a18b9ffb6219cea309 /netwerk/cache2 | |
parent | 571457967f39d2d59abf93e73bccfff0449fcf4f (diff) | |
download | aura-central-af29df9d80d70163d9ace8fbdd1cd3723f93bd6e.tar.gz |
Telemetry: Remove stubs and related code
Diffstat (limited to 'netwerk/cache2')
-rw-r--r-- | netwerk/cache2/CacheStorageService.cpp | 98 | ||||
-rw-r--r-- | netwerk/cache2/CacheStorageService.h | 12 |
2 files changed, 0 insertions, 110 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 diff --git a/netwerk/cache2/CacheStorageService.h b/netwerk/cache2/CacheStorageService.h index f40459d84..7e968e359 100644 --- a/netwerk/cache2/CacheStorageService.h +++ b/netwerk/cache2/CacheStorageService.h @@ -188,12 +188,6 @@ private: bool IsForcedValidEntry(nsACString const &aEntryKeyWithContext); private: - // These are helpers for telemetry monitoring of the memory pools. - void TelemetryPrune(TimeStamp &now); - void TelemetryRecordEntryCreation(CacheEntry const* entry); - void TelemetryRecordEntryRemoval(CacheEntry const* entry); - -private: // Following methods are thread safe to call. friend class CacheStorage; @@ -370,12 +364,6 @@ private: uint32_t mWhat; }; - // Used just for telemetry purposes, accessed only on the management thread. - // Note: not included in the memory reporter, this is not expected to be huge - // and also would be complicated to report since reporting happens on the main - // thread but this table is manipulated on the management thread. - nsDataHashtable<nsCStringHashKey, mozilla::TimeStamp> mPurgeTimeStamps; - // nsICacheTesting class IOThreadSuspender : public Runnable { |