Bug 705796 - telemetry data on how often cache is corrupt at startup. r=michal

This commit is contained in:
Jason Duell 2012-04-06 13:10:32 -07:00
parent 0dbfd85588
commit d8e747c9ba
2 changed files with 9 additions and 3 deletions

View File

@ -1020,15 +1020,20 @@ nsDiskCacheDevice::OpenDiskCache()
// Try opening cache map file.
rv = mCacheMap.Open(mCacheDirectory);
// move "corrupt" caches to trash
if (rv == NS_ERROR_FILE_CORRUPTED) {
if (NS_SUCCEEDED(rv)) {
Telemetry::Accumulate(Telemetry::DISK_CACHE_CORRUPT, 0);
} else if (rv == NS_ERROR_FILE_CORRUPTED) {
Telemetry::Accumulate(Telemetry::DISK_CACHE_CORRUPT, 1);
// delay delete by 1 minute to avoid IO thrash at startup
rv = nsDeleteDir::DeleteDir(mCacheDirectory, true, 60000);
if (NS_FAILED(rv))
return rv;
exists = false;
}
else if (NS_FAILED(rv))
} else {
// don't gather telemetry for "corrupt cache" for new profile
// where cache doesn't exist (most likely case if we're here).
return rv;
}
}
// if we don't have a cache directory, create one and open it

View File

@ -226,6 +226,7 @@ HISTOGRAM(SPDY_SETTINGS_IW, 1, 1000, 50, EXPONENTIAL, "SPDY: Settings IW (round
#undef HTTP_HISTOGRAMS
HISTOGRAM(HTTP_CACHE_DISPOSITION, 1, 5, 5, LINEAR, "HTTP Cache Hit, Reval, Failed-Reval, Miss")
HISTOGRAM(DISK_CACHE_CORRUPT, 0, 1, 2, BOOLEAN, "Was the HTTP disk cache corrupt at startup?")
HISTOGRAM(HTTP_DISK_CACHE_DISPOSITION, 1, 5, 5, LINEAR, "HTTP Disk Cache Hit, Reval, Failed-Reval, Miss")
HISTOGRAM(HTTP_MEMORY_CACHE_DISPOSITION, 1, 5, 5, LINEAR, "HTTP Memory Cache Hit, Reval, Failed-Reval, Miss")
HISTOGRAM(HTTP_OFFLINE_CACHE_DISPOSITION, 1, 5, 5, LINEAR, "HTTP Offline Cache Hit, Reval, Failed-Reval, Miss")