summaryrefslogtreecommitdiffstats
path: root/netwerk/cache2/CacheFileUtils.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-09-30 04:39:37 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-09-30 04:39:37 +0200
commitab9edfb54bb985e683c318bbd7e4c3594d8e6df2 (patch)
tree2412275b845353d4f939f6f61c326d488e2d7347 /netwerk/cache2/CacheFileUtils.cpp
parent3343a4b4744b6c78d1f3d0c3f111e1adfddc18a5 (diff)
downloadUXP-ab9edfb54bb985e683c318bbd7e4c3594d8e6df2.tar
UXP-ab9edfb54bb985e683c318bbd7e4c3594d8e6df2.tar.gz
UXP-ab9edfb54bb985e683c318bbd7e4c3594d8e6df2.tar.lz
UXP-ab9edfb54bb985e683c318bbd7e4c3594d8e6df2.tar.xz
UXP-ab9edfb54bb985e683c318bbd7e4c3594d8e6df2.zip
Remove telemetry probes to get detailed disk cache hit rate.
Tag #21.
Diffstat (limited to 'netwerk/cache2/CacheFileUtils.cpp')
-rw-r--r--netwerk/cache2/CacheFileUtils.cpp95
1 files changed, 0 insertions, 95 deletions
diff --git a/netwerk/cache2/CacheFileUtils.cpp b/netwerk/cache2/CacheFileUtils.cpp
index fe1a53b3d..a090a9cb1 100644
--- a/netwerk/cache2/CacheFileUtils.cpp
+++ b/netwerk/cache2/CacheFileUtils.cpp
@@ -401,101 +401,6 @@ ValidityMap::operator[](uint32_t aIdx)
return mMap.ElementAt(aIdx);
}
-StaticMutex DetailedCacheHitTelemetry::sLock;
-uint32_t DetailedCacheHitTelemetry::sRecordCnt = 0;
-DetailedCacheHitTelemetry::HitRate DetailedCacheHitTelemetry::sHRStats[kNumOfRanges];
-
-DetailedCacheHitTelemetry::HitRate::HitRate()
-{
- Reset();
-}
-
-void
-DetailedCacheHitTelemetry::HitRate::AddRecord(ERecType aType)
-{
- if (aType == HIT) {
- ++mHitCnt;
- } else {
- ++mMissCnt;
- }
-}
-
-uint32_t
-DetailedCacheHitTelemetry::HitRate::GetHitRateBucket(uint32_t aNumOfBuckets) const
-{
- uint32_t bucketIdx = (aNumOfBuckets * mHitCnt) / (mHitCnt + mMissCnt);
- if (bucketIdx == aNumOfBuckets) { // make sure 100% falls into the last bucket
- --bucketIdx;
- }
-
- return bucketIdx;
-}
-
-uint32_t
-DetailedCacheHitTelemetry::HitRate::Count()
-{
- return mHitCnt + mMissCnt;
-}
-
-void
-DetailedCacheHitTelemetry::HitRate::Reset()
-{
- mHitCnt = 0;
- mMissCnt = 0;
-}
-
-// static
-void
-DetailedCacheHitTelemetry::AddRecord(ERecType aType, TimeStamp aLoadStart)
-{
- bool isUpToDate = false;
- CacheIndex::IsUpToDate(&isUpToDate);
- if (!isUpToDate) {
- // Ignore the record when the entry file count might be incorrect
- return;
- }
-
- uint32_t entryCount;
- nsresult rv = CacheIndex::GetEntryFileCount(&entryCount);
- if (NS_FAILED(rv)) {
- return;
- }
-
- uint32_t rangeIdx = entryCount / kRangeSize;
- if (rangeIdx >= kNumOfRanges) { // The last range has no upper limit.
- rangeIdx = kNumOfRanges - 1;
- }
-
- uint32_t hitMissValue = 2 * rangeIdx; // 2 values per range
- if (aType == MISS) { // The order is HIT, MISS
- ++hitMissValue;
- }
-
- StaticMutexAutoLock lock(sLock);
-
- sHRStats[rangeIdx].AddRecord(aType);
- ++sRecordCnt;
-
- if (sRecordCnt < kTotalSamplesReportLimit) {
- return;
- }
-
- sRecordCnt = 0;
-
- for (uint32_t i = 0; i < kNumOfRanges; ++i) {
- if (sHRStats[i].Count() >= kHitRateSamplesReportLimit) {
- // The telemetry enums are grouped by buckets as follows:
- // Telemetry value : 0,1,2,3, ... ,19,20,21,22, ... ,398,399
- // Hit rate bucket : 0,0,0,0, ... , 0, 1, 1, 1, ... , 19, 19
- // Cache size range: 0,1,2,3, ... ,19, 0, 1, 2, ... , 18, 19
- uint32_t bucketOffset = sHRStats[i].GetHitRateBucket(kHitRateBuckets) *
- kNumOfRanges;
-
- sHRStats[i].Reset();
- }
- }
-}
-
void
FreeBuffer(void *aBuf) {
#ifndef NS_FREE_PERMANENT_DATA