Remove all C++ telemetry autotimers

This commit is contained in:
wolfbeast
2018-09-04 09:41:24 +02:00
committed by Roy Tam
parent 8c8145e620
commit ad782894c8
28 changed files with 36 additions and 118 deletions
@@ -591,7 +591,6 @@ void
NotificationController::WillRefresh(mozilla::TimeStamp aTime)
{
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
Telemetry::AutoTimer<Telemetry::A11Y_UPDATE_TIME> updateTimer;
// If the document accessible that notification collector was created for is
// now shut down, don't process notifications anymore.
-2
View File
@@ -684,8 +684,6 @@ Navigator::GetDoNotTrack(nsAString &aResult)
bool
Navigator::JavaEnabled(ErrorResult& aRv)
{
Telemetry::AutoTimer<Telemetry::CHECK_JAVA_ENABLED> telemetryTimer;
// Return true if we have a handler for the java mime
nsAdoptingString javaMIME = Preferences::GetString("plugin.java.mime");
NS_ENSURE_TRUE(!javaMIME.IsEmpty(), false);
-1
View File
@@ -2395,7 +2395,6 @@ TabChild::RecvSetDocShellIsActive(const bool& aIsActive,
root->SchedulePaint();
}
Telemetry::AutoTimer<Telemetry::TABCHILD_PAINT_TIME> timer;
// If we need to repaint, let's do that right away. No sense waiting until
// we get back to the event loop again. We suppress the display port so that
// we only paint what's visible. This ensures that the tab we're switching
+1 -8
View File
@@ -2148,11 +2148,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
nsPluginInfo info;
memset(&info, 0, sizeof(info));
nsresult res;
// Opening a block for the telemetry AutoTimer
{
Telemetry::AutoTimer<Telemetry::PLUGIN_LOAD_METADATA> telemetry;
res = pluginFile.GetPluginInfo(info, &library);
}
res = pluginFile.GetPluginInfo(info, &library);
// if we don't have mime type don't proceed, this is not a plugin
if (NS_FAILED(res) || !info.fMimeTypeArray) {
RefPtr<nsInvalidPluginTag> invalidTag = new nsInvalidPluginTag(filePath.get(),
@@ -2410,8 +2406,6 @@ nsPluginHost::FindPluginsInContent(bool aCreatePluginList, bool* aPluginsChanged
// This is needed in ReloadPlugins to prevent possible recursive reloads
nsresult nsPluginHost::FindPlugins(bool aCreatePluginList, bool * aPluginsChanged)
{
Telemetry::AutoTimer<Telemetry::FIND_PLUGINS> telemetry;
NS_ENSURE_ARG_POINTER(aPluginsChanged);
*aPluginsChanged = false;
@@ -3412,7 +3406,6 @@ nsPluginHost::StopPluginInstance(nsNPAPIPluginInstance* aInstance)
return NS_OK;
}
Telemetry::AutoTimer<Telemetry::PLUGIN_SHUTDOWN_MS> timer;
aInstance->Stop();
// if the instance does not want to be 'cached' just remove it
-2
View File
@@ -504,8 +504,6 @@ PluginAsyncSurrogate::WaitForInit()
if (mAcceptCalls) {
return true;
}
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGINASYNCSURROGATE_WAITFORINIT_MS>
timer(mParent->GetHistogramKey());
bool result = false;
MOZ_ASSERT(mParent);
if (mParent->IsChrome()) {
+2 -9
View File
@@ -205,12 +205,8 @@ NPError
PluginInstanceParent::Destroy()
{
NPError retval;
{ // Scope for timer
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGIN_INSTANCE_DESTROY_MS>
timer(Module()->GetHistogramKey());
if (!CallNPP_Destroy(&retval)) {
retval = NPERR_GENERIC_ERROR;
}
if (!CallNPP_Destroy(&retval)) {
retval = NPERR_GENERIC_ERROR;
}
#if defined(OS_WIN)
@@ -1785,9 +1781,6 @@ PluginInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
return NPERR_GENERIC_ERROR;
}
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGIN_STREAM_INIT_MS>
timer(Module()->GetHistogramKey());
NPError err = NPERR_NO_ERROR;
if (mParent->IsStartingAsync()) {
MOZ_ASSERT(mSurrogate);
+15 -19
View File
@@ -2284,27 +2284,23 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
return NS_ERROR_FAILURE;
}
{ // Scope for timer
Telemetry::AutoTimer<Telemetry::BLOCKED_ON_PLUGIN_INSTANCE_INIT_MS>
timer(GetHistogramKey());
if (mIsStartingAsync) {
MOZ_ASSERT(surrogate);
surrogate->AsyncCallDeparting();
if (!SendAsyncNPP_New(parentInstance)) {
if (mIsStartingAsync) {
MOZ_ASSERT(surrogate);
surrogate->AsyncCallDeparting();
if (!SendAsyncNPP_New(parentInstance)) {
*error = NPERR_GENERIC_ERROR;
return NS_ERROR_FAILURE;
}
*error = NPERR_NO_ERROR;
} else {
if (!CallSyncNPP_New(parentInstance, error)) {
// if IPC is down, we'll get an immediate "failed" return, but
// without *error being set. So make sure that the error
// condition is signaled to nsNPAPIPluginInstance
if (NPERR_NO_ERROR == *error) {
*error = NPERR_GENERIC_ERROR;
return NS_ERROR_FAILURE;
}
*error = NPERR_NO_ERROR;
} else {
if (!CallSyncNPP_New(parentInstance, error)) {
// if IPC is down, we'll get an immediate "failed" return, but
// without *error being set. So make sure that the error
// condition is signaled to nsNPAPIPluginInstance
if (NPERR_NO_ERROR == *error) {
*error = NPERR_GENERIC_ERROR;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_FAILURE;
}
}
-2
View File
@@ -163,8 +163,6 @@ DOMStorageDBThread::Shutdown()
return NS_ERROR_NOT_INITIALIZED;
}
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS> timer;
{
MonitorAutoLock monitor(mThreadObserver->GetMonitor());
-2
View File
@@ -654,8 +654,6 @@ gfxGDIFontList::GetFontSubstitutes()
nsresult
gfxGDIFontList::InitFontListForPlatform()
{
Telemetry::AutoTimer<Telemetry::GDI_INITFONTLIST_TOTAL> timer;
mFontSubstitutes.Clear();
mNonExistingFonts.Clear();
-2
View File
@@ -737,8 +737,6 @@ gfxMacPlatformFontList::InitFontListForPlatform()
{
nsAutoreleasePool localPool;
Telemetry::AutoTimer<Telemetry::MAC_INITFONTLIST_TOTAL> timer;
// reset system font list
mSystemFontFamilies.Clear();
-1
View File
@@ -2516,7 +2516,6 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
PROFILER_LABEL("nsCSSRendering", "PaintGradient",
js::ProfileEntry::Category::GRAPHICS);
Telemetry::AutoTimer<Telemetry::GRADIENT_DURATION, Telemetry::Microsecond> gradientTimer;
if (aDest.IsEmpty() || aFillArea.IsEmpty()) {
return;
}
+2 -8
View File
@@ -1206,11 +1206,8 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
nsIDocument::PageUnloadingEventTimeStamp timestamp(mDocument);
mInPermitUnload = true;
{
Telemetry::AutoTimer<Telemetry::HANDLE_BEFOREUNLOAD_MS> telemetryTimer;
EventDispatcher::DispatchDOMEvent(window, nullptr, event, mPresContext,
EventDispatcher::DispatchDOMEvent(window, nullptr, event, mPresContext,
nullptr);
}
mInPermitUnload = false;
}
@@ -1389,10 +1386,7 @@ nsDocumentViewer::PageHide(bool aIsUnload)
nsIDocument::PageUnloadingEventTimeStamp timestamp(mDocument);
{
Telemetry::AutoTimer<Telemetry::HANDLE_UNLOAD_MS> telemetryTimer;
EventDispatcher::Dispatch(window, mPresContext, &event, nullptr, &status);
}
EventDispatcher::Dispatch(window, mPresContext, &event, nullptr, &status);
}
#ifdef MOZ_XUL
-4
View File
@@ -1184,7 +1184,6 @@ nsCacheService::Shutdown()
}
nsCOMPtr<nsIThread> cacheIOThread;
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_SHUTDOWN> totalTimer;
bool shouldSanitize = false;
nsCOMPtr<nsIFile> parentDir;
@@ -1261,10 +1260,8 @@ nsCacheService::Shutdown()
if (NS_SUCCEEDED(parentDir->Exists(&exists)) && exists)
nsDeleteDir::DeleteDir(parentDir, false);
}
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_SHUTDOWN_CLEAR_PRIVATE> timer;
nsDeleteDir::Shutdown(shouldSanitize);
} else {
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_DELETEDIR_SHUTDOWN> timer;
nsDeleteDir::Shutdown(shouldSanitize);
}
}
@@ -2175,7 +2172,6 @@ nsCacheService::ActivateEntry(nsCacheRequest * request,
nsCacheEntry *
nsCacheService::SearchCacheDevices(nsCString * key, nsCacheStoragePolicy policy, bool *collision)
{
Telemetry::AutoTimer<Telemetry::CACHE_DEVICE_SEARCH_2> timer;
nsCacheEntry * entry = nullptr;
CACHE_LOG_DEBUG(("mMemoryDevice: 0x%p\n", mMemoryDevice));
-3
View File
@@ -155,7 +155,6 @@ nsDeleteDir::DestroyThread()
void
nsDeleteDir::TimerCallback(nsITimer *aTimer, void *arg)
{
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_DELETEDIR> timer;
{
MutexAutoLock lock(gInstance->mLock);
@@ -193,8 +192,6 @@ nsDeleteDir::TimerCallback(nsITimer *aTimer, void *arg)
nsresult
nsDeleteDir::DeleteDir(nsIFile *dirIn, bool moveToTrash, uint32_t delay)
{
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_TRASHRENAME> timer;
if (!gInstance)
return NS_ERROR_NOT_INITIALIZED;
-2
View File
@@ -457,7 +457,6 @@ nsDiskCacheDevice::GetDeviceID()
nsCacheEntry *
nsDiskCacheDevice::FindEntry(nsCString * key, bool *collision)
{
Telemetry::AutoTimer<Telemetry::CACHE_DISK_SEARCH_2> timer;
if (!Initialized()) return nullptr; // NS_ERROR_NOT_INITIALIZED
if (mClearingDiskCache) return nullptr;
nsDiskCacheRecord record;
@@ -955,7 +954,6 @@ nsDiskCacheDevice::EvictEntries(const char * clientID)
nsresult
nsDiskCacheDevice::OpenDiskCache()
{
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_OPEN> timer;
// if we don't have a cache directory, create one and open it
bool exists;
nsresult rv = mCacheDirectory->Exists(&exists);
-1
View File
@@ -1523,7 +1523,6 @@ nsOfflineCacheDevice::FindEntry(nsCString *fullKey, bool *collision)
{
NS_ENSURE_TRUE(Initialized(), nullptr);
mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_OFFLINE_SEARCH_2> timer;
LOG(("nsOfflineCacheDevice::FindEntry [key=%s]\n", fullKey->get()));
// SELECT * FROM moz_cache WHERE key = ?
-1
View File
@@ -113,7 +113,6 @@ nsMemoryCacheDevice::GetDeviceID()
nsCacheEntry *
nsMemoryCacheDevice::FindEntry(nsCString * key, bool *collision)
{
mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_MEMORY_SEARCH_2> timer;
nsCacheEntry * entry = mMemCacheEntries.GetEntry(key);
if (!entry) return nullptr;
-3
View File
@@ -1172,8 +1172,6 @@ CacheFileIOManager::Shutdown()
return NS_ERROR_NOT_INITIALIZED;
}
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_SHUTDOWN_V2> shutdownTimer;
CacheIndex::PreShutdown();
ShutdownMetadataWriteScheduling();
@@ -1191,7 +1189,6 @@ CacheFileIOManager::Shutdown()
CacheIndex::Shutdown();
if (CacheObserver::ClearCacheOnShutdown()) {
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE2_SHUTDOWN_CLEAR_PRIVATE> totalTimer;
gInstance->SyncRemoveAllCacheFiles();
}
+7 -12
View File
@@ -954,19 +954,14 @@ nsCookieService::TryInitDB(bool aRecreateDB)
NS_ENSURE_SUCCESS(rv, RESULT_FAILURE);
}
// This block provides scope for the Telemetry AutoTimer
{
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS>
telemetry;
ReadAheadFile(mDefaultDBState->cookieFile);
ReadAheadFile(mDefaultDBState->cookieFile);
// open a connection to the cookie database, and only cache our connection
// and statements upon success. The connection is opened unshared to eliminate
// cache contention between the main and background threads.
rv = mStorageService->OpenUnsharedDatabase(mDefaultDBState->cookieFile,
getter_AddRefs(mDefaultDBState->dbConn));
NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
}
// open a connection to the cookie database, and only cache our connection
// and statements upon success. The connection is opened unshared to eliminate
// cache contention between the main and background threads.
rv = mStorageService->OpenUnsharedDatabase(mDefaultDBState->cookieFile,
getter_AddRefs(mDefaultDBState->dbConn));
NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
// Set up our listeners.
mDefaultDBState->insertListener = new InsertCookieDBListener(mDefaultDBState);
-2
View File
@@ -407,7 +407,6 @@ xTruncate(sqlite3_file *pFile, sqlite_int64 size)
IOThreadAutoTimer ioTimer(Telemetry::MOZ_SQLITE_TRUNCATE_MS);
telemetry_file *p = (telemetry_file *)pFile;
int rc;
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_TRUNCATE_MS> timer;
if (p->quotaObject) {
if (p->fileChunkSize > 0) {
// Round up to the smallest multiple of the chunk size that will hold all
@@ -609,7 +608,6 @@ xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
{
IOThreadAutoTimer ioTimer(Telemetry::MOZ_SQLITE_OPEN_MS,
IOInterposeObserver::OpCreateOrOpen);
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_OPEN_MS> timer;
sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
int rc;
telemetry_file *p = (telemetry_file *)pFile;
@@ -226,7 +226,6 @@ bool
AsyncExecuteStatements::executeStatement(sqlite3_stmt *aStatement)
{
mMutex.AssertNotCurrentThreadOwns();
Telemetry::AutoTimer<Telemetry::MOZ_STORAGE_ASYNC_REQUESTS_MS> finallySendExecutionDuration(mRequestStartDate);
while (true) {
// lock the sqlite mutex so sqlite3_errmsg cannot change
SQLiteMutexAutoLock lockedScope(mDBMutex);
@@ -412,8 +412,6 @@ Classifier::Check(const nsACString& aSpec,
uint32_t aFreshnessGuarantee,
LookupResultArray& aResults)
{
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_CHECK_TIME> timer;
// Get the set of fragments based on the url. This is necessary because we
// only look up at most 5 URLs per aSpec, even if aSpec has more than 5
// components.
@@ -505,8 +503,6 @@ Classifier::Check(const nsACString& aSpec,
nsresult
Classifier::ApplyUpdates(nsTArray<TableUpdate*>* aUpdates)
{
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_UPDATE_TIME> timer;
PRIntervalTime clockStart = 0;
if (LOG_ENABLED()) {
clockStart = PR_IntervalNow();
@@ -541,8 +541,6 @@ static void EnsureSorted(T* aArray)
nsresult
LookupCacheV2::ConstructPrefixSet(AddPrefixArray& aAddPrefixes)
{
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_CONSTRUCT_TIME> timer;
nsTArray<uint32_t> array;
if (!array.SetCapacity(aAddPrefixes.Length(), fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
@@ -209,8 +209,6 @@ VariableLengthPrefixSet::LoadFromFile(nsIFile* aFile)
NS_ENSURE_ARG_POINTER(aFile);
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_VLPS_FILELOAD_TIME> timer;
nsCOMPtr<nsIInputStream> localInFile;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(localInFile), aFile,
PR_RDONLY | nsIFile::OS_READAHEAD);
@@ -255,15 +253,12 @@ VariableLengthPrefixSet::StoreToFile(nsIFile* aFile)
uint32_t fileSize = 0;
// Preallocate the file storage
{
nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_VLPS_FALLOCATE_TIME> timer;
nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
fileSize += mFixedPrefixSet->CalculatePreallocateSize();
fileSize += CalculatePreallocateSize();
fileSize += mFixedPrefixSet->CalculatePreallocateSize();
fileSize += CalculatePreallocateSize();
Unused << fos->Preallocate(fileSize);
}
Unused << fos->Preallocate(fileSize);
// Convert to buffered stream
nsCOMPtr<nsIOutputStream> out =
@@ -1814,8 +1814,6 @@ nsUrlClassifierDBService::Shutdown()
gShuttingDownThread = true;
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_SHUTDOWN_TIME> timer;
mCompleters.Clear();
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
@@ -315,8 +315,6 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile* aFile)
{
MutexAutoLock lock(mLock);
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FILELOAD_TIME> timer;
nsCOMPtr<nsIInputStream> localInFile;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(localInFile), aFile,
PR_RDONLY | nsIFile::OS_READAHEAD);
@@ -356,17 +354,13 @@ nsUrlClassifierPrefixSet::StoreToFile(nsIFile* aFile)
uint32_t fileSize;
// Preallocate the file storage
{
nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FALLOCATE_TIME> timer;
nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile));
fileSize = CalculatePreallocateSize();
fileSize = CalculatePreallocateSize();
// Ignore failure, the preallocation is a hint and we write out the entire
// file later on
Unused << fos->Preallocate(fileSize);
}
// Ignore failure, the preallocation is a hint and we write out the entire
// file later on
Unused << fos->Preallocate(fileSize);
// Convert to buffered stream
nsCOMPtr<nsIOutputStream> out =
-3
View File
@@ -716,9 +716,6 @@ nsIdleService::IdleTimerCallback(void)
return;
}
// Tell expired listeners they are expired,and find the next timeout
Telemetry::AutoTimer<Telemetry::IDLE_NOTIFY_IDLE_MS> timer;
// We need to initialise the time to the next idle switch.
mDeltaToNextIdleSwitchInS = UINT32_MAX;
-1
View File
@@ -440,7 +440,6 @@ ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge)
{
#ifdef HAVE_JEMALLOC_STATS
if (aDoPurge) {
Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer;
jemalloc_purge_freed_pages();
}
#endif