Bug 687081 - Time how long it takes to find (or not) things in the cache. r=jduell

This commit is contained in:
Nick Hurley 2011-10-30 15:39:53 +01:00
Родитель 118f60aa4b
Коммит 1ebc7ebb84
5 изменённых файлов: 11 добавлений и 0 удалений

2
netwerk/cache/nsCacheService.cpp поставляемый
Просмотреть файл

@ -74,6 +74,7 @@
#include <math.h> // for log()
#include "mozilla/Util.h" // for DebugOnly
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "mozilla/FunctionTimer.h"
@ -1764,6 +1765,7 @@ nsCacheService::ActivateEntry(nsCacheRequest * request,
nsCacheEntry *
nsCacheService::SearchCacheDevices(nsCString * key, nsCacheStoragePolicy policy, bool *collision)
{
Telemetry::AutoTimer<Telemetry::CACHE_DEVICE_SEARCH> timer;
nsCacheEntry * entry = nsnull;
CACHE_LOG_DEBUG(("mMemoryDevice: 0x%p\n", mMemoryDevice));

1
netwerk/cache/nsDiskCacheDevice.cpp поставляемый
Просмотреть файл

@ -503,6 +503,7 @@ nsDiskCacheDevice::GetDeviceID()
nsCacheEntry *
nsDiskCacheDevice::FindEntry(nsCString * key, bool *collision)
{
Telemetry::AutoTimer<Telemetry::CACHE_DISK_SEARCH> timer;
if (!Initialized()) return nsnull; // NS_ERROR_NOT_INITIALIZED
nsDiskCacheRecord record;
nsDiskCacheBinding * binding = nsnull;

2
netwerk/cache/nsDiskCacheDeviceSQL.cpp поставляемый
Просмотреть файл

@ -68,6 +68,7 @@
#include "nsISeekableStream.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Telemetry.h"
using namespace mozilla;
@ -1340,6 +1341,7 @@ nsOfflineCacheDevice::GetDeviceID()
nsCacheEntry *
nsOfflineCacheDevice::FindEntry(nsCString *fullKey, bool *collision)
{
mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_OFFLINE_SEARCH> timer;
LOG(("nsOfflineCacheDevice::FindEntry [key=%s]\n", fullKey->get()));
// SELECT * FROM moz_cache WHERE key = ?

2
netwerk/cache/nsMemoryCacheDevice.cpp поставляемый
Просмотреть файл

@ -48,6 +48,7 @@
#include "nsCRT.h"
#include "nsCache.h"
#include "nsReadableUtils.h"
#include "mozilla/Telemetry.h"
// The memory cache implements the "LRU-SP" caching algorithm
// described in "LRU-SP: A Size-Adjusted and Popularity-Aware LRU Replacement
@ -146,6 +147,7 @@ nsMemoryCacheDevice::GetDeviceID()
nsCacheEntry *
nsMemoryCacheDevice::FindEntry(nsCString * key, bool *collision)
{
mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_MEMORY_SEARCH> timer;
nsCacheEntry * entry = mMemCacheEntries.GetEntry(key);
if (!entry) return nsnull;

Просмотреть файл

@ -162,6 +162,10 @@ HISTOGRAM(HTTP_CACHE_DISPOSITION, 1, 5, 5, LINEAR, "HTTP Cache Hit, Reval, Faile
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")
HISTOGRAM(CACHE_DEVICE_SEARCH, 1, 100, 100, LINEAR, "Time to search cache (ms)")
HISTOGRAM(CACHE_MEMORY_SEARCH, 1, 100, 100, LINEAR, "Time to search memory cache (ms)")
HISTOGRAM(CACHE_DISK_SEARCH, 1, 100, 100, LINEAR, "Time to search disk cache (ms)")
HISTOGRAM(CACHE_OFFLINE_SEARCH, 1, 100, 100, LINEAR, "Time to search offline cache (ms)")
HISTOGRAM(FIND_PLUGINS, 1, 3000, 10, EXPONENTIAL, "Time spent scanning filesystem for plugins (ms)")
HISTOGRAM(CHECK_JAVA_ENABLED, 1, 3000, 10, EXPONENTIAL, "Time spent checking if Java is enabled (ms)")