mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1147973 - Detailed disk cache hit rate telemetry is wrong, r=honzab
This commit is contained in:
parent
6d13980c63
commit
45032afa61
@ -337,6 +337,8 @@ bool CacheEntry::Load(bool aTruncate, bool aPriority)
|
|||||||
nsAutoCString fileKey;
|
nsAutoCString fileKey;
|
||||||
rv = HashingKeyWithStorage(fileKey);
|
rv = HashingKeyWithStorage(fileKey);
|
||||||
|
|
||||||
|
bool reportMiss = false;
|
||||||
|
|
||||||
// Check the index under two conditions for two states and take appropriate action:
|
// Check the index under two conditions for two states and take appropriate action:
|
||||||
// 1. When this is a disk entry and not told to truncate, check there is a disk file.
|
// 1. When this is a disk entry and not told to truncate, check there is a disk file.
|
||||||
// If not, set the 'truncate' flag to true so that this entry will open instantly
|
// If not, set the 'truncate' flag to true so that this entry will open instantly
|
||||||
@ -351,6 +353,9 @@ bool CacheEntry::Load(bool aTruncate, bool aPriority)
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case CacheIndex::DOES_NOT_EXIST:
|
case CacheIndex::DOES_NOT_EXIST:
|
||||||
LOG((" entry doesn't exist according information from the index, truncating"));
|
LOG((" entry doesn't exist according information from the index, truncating"));
|
||||||
|
if (!aTruncate && mUseDisk) {
|
||||||
|
reportMiss = true;
|
||||||
|
}
|
||||||
aTruncate = true;
|
aTruncate = true;
|
||||||
break;
|
break;
|
||||||
case CacheIndex::EXISTS:
|
case CacheIndex::EXISTS:
|
||||||
@ -380,6 +385,11 @@ bool CacheEntry::Load(bool aTruncate, bool aPriority)
|
|||||||
{
|
{
|
||||||
mozilla::MutexAutoUnlock unlock(mLock);
|
mozilla::MutexAutoUnlock unlock(mLock);
|
||||||
|
|
||||||
|
if (reportMiss) {
|
||||||
|
CacheFileUtils::DetailedCacheHitTelemetry::AddRecord(
|
||||||
|
CacheFileUtils::DetailedCacheHitTelemetry::MISS, mLoadStart);
|
||||||
|
}
|
||||||
|
|
||||||
LOG((" performing load, file=%p", mFile.get()));
|
LOG((" performing load, file=%p", mFile.get()));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
rv = mFile->Init(fileKey,
|
rv = mFile->Init(fileKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user