summaryrefslogtreecommitdiffstats
path: root/netwerk/cache2
diff options
context:
space:
mode:
Diffstat (limited to 'netwerk/cache2')
-rw-r--r--netwerk/cache2/CacheStorageService.cpp98
-rw-r--r--netwerk/cache2/CacheStorageService.h12
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
{