Bug 792502 - Kill the FunctionTimer code; r=vlad

This commit is contained in:
Ehsan Akhgari 2012-09-19 16:59:38 -04:00
parent 09e5ef62cd
commit 8cc30b88b2
63 changed files with 0 additions and 940 deletions

View File

@ -55,7 +55,6 @@
#include "nsLayoutUtils.h"
#include "nsNPAPIPluginInstance.h"
#include "nsObjectFrame.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
@ -88,7 +87,6 @@ bool nsAccessibilityService::gIsShutdown = true;
nsAccessibilityService::nsAccessibilityService() :
nsAccDocManager(), FocusManager()
{
NS_TIME_FUNCTION;
}
nsAccessibilityService::~nsAccessibilityService()

View File

@ -7265,19 +7265,6 @@ dnl =
dnl ========================================================
MOZ_ARG_HEADER(Profiling and Instrumenting)
dnl ========================================================
dnl = Enable NS_FUNCTION_TIMER, which provides Function
dnl = timing for identifying code bottlenecks
dnl = NS_FUNCTION_TIMER is off by default.
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(functiontimer,
[ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
NS_FUNCTION_TIMER=1,
NS_FUNCTION_TIMER= )
if test -n "$NS_FUNCTION_TIMER"; then
AC_DEFINE(NS_FUNCTION_TIMER)
fi
dnl ========================================================
dnl = Enable runtime visual profiling logger
dnl ========================================================

View File

@ -41,7 +41,6 @@
#include "nsIDOMDOMStringList.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentXBL.h"
#include "mozilla/FunctionTimer.h"
#include "nsGenericElement.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMCDATASection.h"
@ -4238,7 +4237,6 @@ nsDocument::LookupImageElement(const nsAString& aId)
void
nsDocument::DispatchContentLoadedEvents()
{
NS_TIME_FUNCTION;
// If you add early returns from this method, make sure you're
// calling UnblockOnload properly.

View File

@ -44,7 +44,6 @@
#include "nsCrossSiteListenerProxy.h"
#include "nsSandboxFlags.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/CORSMode.h"
#include "mozilla/Attributes.h"
@ -702,8 +701,6 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
nsAFlatString* script;
nsAutoString textData;
NS_TIME_FUNCTION;
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsINode> scriptElem = do_QueryInterface(aRequest->mElement);

View File

@ -10,7 +10,6 @@
#include "nsEventListenerManager.h"
#include "nsContentUtils.h"
#include "nsError.h"
#include "mozilla/FunctionTimer.h"
#include "nsMutationEvent.h"
#include NEW_H
#include "nsFixedSizeAllocator.h"
@ -461,12 +460,6 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
NS_ENSURE_TRUE(aEvent->message || !aDOMEvent || aTargets,
NS_ERROR_DOM_INVALID_STATE_ERR);
#ifdef NS_FUNCTION_TIMER
const char* timer_event_name = nsDOMEvent::GetEventName(aEvent->message);
NS_TIME_FUNCTION_MIN_FMT(20, "Dispatching '%s' event",
timer_event_name ? timer_event_name : "<other>");
#endif
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aTarget);
bool retargeted = false;

View File

@ -16,7 +16,6 @@
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h"
#include "mozilla/FunctionTimer.h"
#include "nsContentUtils.h"
#include "nsIPresShell.h"
#include "nsIXMLContentSink.h"
@ -996,8 +995,6 @@ nsBindingManager::ProcessAttachedQueue(uint32_t aSkipSize)
if (mProcessingAttachedStack || mAttachedStack.Length() <= aSkipSize)
return;
NS_TIME_FUNCTION;
mProcessingAttachedStack = true;
// Excute constructors. Do this from high index to low

View File

@ -8,7 +8,6 @@
#include "jsapi.h"
#include "nsUnicharUtils.h"
#include "nsReadableUtils.h"
#include "mozilla/FunctionTimer.h"
#include "nsXBLProtoImplField.h"
#include "nsIScriptContext.h"
#include "nsIURI.h"
@ -79,7 +78,6 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
nsIURI* aBindingDocURI,
bool* aDidInstall) const
{
NS_TIME_FUNCTION_MIN(5);
NS_PRECONDITION(aBoundNode,
"uh-oh, bound node should NOT be null or bad things will "
"happen");

View File

@ -9,7 +9,6 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIScriptGlobalObject.h"
#include "mozilla/FunctionTimer.h"
#include "nsUnicharUtils.h"
#include "nsReadableUtils.h"
#include "nsXBLProtoImplMethod.h"
@ -139,7 +138,6 @@ nsresult
nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr,
JSObject* aClassObject)
{
NS_TIME_FUNCTION_MIN(5);
NS_PRECONDITION(!IsCompiled(),
"Trying to compile an already-compiled method");
NS_PRECONDITION(aClassObject,

View File

@ -23,7 +23,6 @@
#include "nsIXMLContentSink.h"
#include "nsContentCID.h"
#include "nsXMLDocument.h"
#include "mozilla/FunctionTimer.h"
#include "nsGkAtoms.h"
#include "nsIMemory.h"
#include "nsIObserverService.h"
@ -1067,8 +1066,6 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
nsIURI* aDocumentURI, nsIURI* aBindingURI,
bool aForceSyncLoad, nsIDocument** aResult)
{
NS_TIME_FUNCTION;
nsresult rv = NS_OK;
// Initialize our out pointer to nullptr
*aResult = nullptr;

View File

@ -58,7 +58,6 @@
#include "prlog.h"
#include "rdf.h"
#include "nsIFrame.h"
#include "mozilla/FunctionTimer.h"
#include "nsXBLService.h"
#include "nsCExternalHandlerService.h"
#include "nsMimeTypes.h"
@ -2816,7 +2815,6 @@ FirePendingMergeNotification(nsIURI* aKey, nsCOMPtr<nsIObserver>& aObserver, voi
nsresult
nsXULDocument::ResumeWalk()
{
NS_TIME_FUNCTION;
// Walk the prototype and build the delegate content model. The
// walk is performed in a top-down, left-to-right fashion. That
// is, a parent is built before any of its children; a node is

View File

@ -22,7 +22,6 @@
#include "nsString.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "mozilla/FunctionTimer.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsDOMCID.h"
#include "nsNodeInfoManager.h"
@ -245,7 +244,6 @@ nsXULPrototypeDocument::NewXULPDGlobalObject()
NS_IMETHODIMP
nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream)
{
NS_TIME_FUNCTION;
nsresult rv;
rv = aStream->ReadObject(true, getter_AddRefs(mURI));

View File

@ -51,7 +51,6 @@
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIUploadChannel.h"
#include "nsISecurityEventSink.h"
#include "mozilla/FunctionTimer.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSContextStack.h"
#include "nsIScriptObjectPrincipal.h"
@ -6662,8 +6661,6 @@ nsDocShell::EnsureContentViewer()
if (mIsBeingDestroyed)
return NS_ERROR_FAILURE;
NS_TIME_FUNCTION;
nsCOMPtr<nsIURI> baseURI;
nsIPrincipal* principal = GetInheritedPrincipal(false);
nsCOMPtr<nsIDocShellTreeItem> parentItem;
@ -11200,8 +11197,6 @@ nsDocShell::EnsureScriptEnvironment()
return NS_ERROR_NOT_AVAILABLE;
}
NS_TIME_FUNCTION;
#ifdef DEBUG
NS_ASSERTION(!mInEnsureScriptEnv,
"Infinite loop! Calling EnsureScriptEnvironment() from "

View File

@ -150,7 +150,6 @@
#include "nsIDOMFile.h"
#include "nsIDOMFileList.h"
#include "nsIURIFixup.h"
#include "mozilla/FunctionTimer.h"
#include "nsCDefaultURIFixup.h"
#include "nsEventDispatcher.h"
#include "nsIObserverService.h"
@ -198,7 +197,6 @@
#include "nsISupportsPrimitives.h"
#include "nsXPCOMCID.h"
#include "GeneratedEvents.h"
#include "mozilla/FunctionTimer.h"
#include "mozIThirdPartyUtil.h"
#ifdef MOZ_LOGGING
@ -1735,8 +1733,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsISupports* aState,
bool aForceReuseInnerWindow)
{
NS_TIME_FUNCTION;
NS_PRECONDITION(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(aDocument);
@ -9604,8 +9600,6 @@ nsGlobalWindow::RunTimeoutHandler(nsTimeout* aTimeout,
uint32_t lineNo = 0;
handler->GetLocation(&filename, &lineNo);
NS_TIME_FUNCTION_MARK("(file: %s, line: %d)", filename, lineNo);
bool is_undefined;
aScx->EvaluateString(nsDependentString(script), FastGetGlobalJSObject(),
timeout->mPrincipal, timeout->mPrincipal,
@ -9737,8 +9731,6 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
return;
}
NS_TIME_FUNCTION;
NS_ASSERTION(IsInnerWindow(), "Timeout running on outer window!");
NS_ASSERTION(!IsFrozen(), "Timeout running on a window in the bfcache!");

View File

@ -75,7 +75,6 @@
#include "prlog.h"
#include "prthread.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/BindingUtils.h"
@ -1236,9 +1235,6 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
JS::Value* aRetValue,
bool* aIsUndefined)
{
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (url: %s, line: %d)", MOZ_FUNCTION_NAME,
__LINE__, aURL, aLineNo);
SAMPLE_LABEL("JS", "EvaluateStringWithValue");
NS_ABORT_IF_FALSE(aScopeObject,
"Shouldn't call EvaluateStringWithValue with null scope object.");
@ -1422,9 +1418,6 @@ nsJSContext::EvaluateString(const nsAString& aScript,
nsAString *aRetValue,
bool* aIsUndefined)
{
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (url: %s, line: %d)", MOZ_FUNCTION_NAME,
__LINE__, aURL, aLineNo);
SAMPLE_LABEL("JS", "EvaluateString");
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
@ -1739,9 +1732,6 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
uint32_t aVersion,
nsScriptObjectHolder<JSObject>& aHandler)
{
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (url: %s, line: %d)", MOZ_FUNCTION_NAME,
__LINE__, aURL, aLineNo);
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
NS_PRECONDITION(AtomIsEventHandlerName(aName), "Bad event name");
@ -1801,9 +1791,6 @@ nsJSContext::CompileFunction(JSObject* aTarget,
bool aShared,
JSObject** aFunctionObject)
{
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s, url: %s, line: %d)", MOZ_FUNCTION_NAME,
__LINE__, aName.BeginReading(), aURL, aLineNo);
NS_ABORT_IF_FALSE(aFunctionObject,
"Shouldn't call CompileFunction with null return value.");
@ -1860,17 +1847,6 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
return NS_OK;
}
#ifdef NS_FUNCTION_TIMER
{
JSObject *obj = aHandler;
if (js::IsFunctionProxy(obj))
obj = js::UnwrapObject(obj);
JSString *id = JS_GetFunctionId(static_cast<JSFunction *>(JS_GetPrivate(obj)));
JSAutoByteString bytes;
const char *name = !id ? "anonymous" : bytes.encode(mContext, id) ? bytes.ptr() : "<error>";
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s)", MOZ_FUNCTION_NAME, __LINE__, name);
}
#endif
SAMPLE_LABEL("JS", "CallEventHandler");
nsAutoMicroTask mt;
@ -2022,8 +1998,6 @@ nsresult
nsJSContext::Deserialize(nsIObjectInputStream* aStream,
nsScriptObjectHolder<JSScript>& aResult)
{
NS_TIME_FUNCTION_MIN(1.0);
JSScript *script;
nsresult rv = nsContentUtils::XPConnect()->ReadScript(aStream, mContext, &script);
if (NS_FAILED(rv)) return rv;
@ -2908,7 +2882,6 @@ nsJSContext::GarbageCollectNow(js::gcreason::Reason aReason,
IsShrinking aShrinking,
int64_t aSliceMillis)
{
NS_TIME_FUNCTION_MIN(1.0);
SAMPLE_LABEL("GC", "GarbageCollectNow");
MOZ_ASSERT_IF(aSliceMillis, aIncremental == IncrementalGC);
@ -2976,7 +2949,6 @@ nsJSContext::GarbageCollectNow(js::gcreason::Reason aReason,
void
nsJSContext::ShrinkGCBuffersNow()
{
NS_TIME_FUNCTION_MIN(1.0);
SAMPLE_LABEL("GC", "ShrinkGCBuffersNow");
KillShrinkGCBuffersTimer();
@ -3079,7 +3051,6 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
}
SAMPLE_LABEL("GC", "CycleCollectNow");
NS_TIME_FUNCTION_MIN(1.0);
KillCCTimer();

View File

@ -23,7 +23,6 @@
#include "mozFlushType.h" // for mozFlushType::Flush_Frames
#include "mozISpellCheckingEngine.h"
#include "mozInlineSpellChecker.h" // for mozInlineSpellChecker
#include "mozilla/FunctionTimer.h" // for NS_TIME_FUNCTION
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/Selection.h" // for Selection, etc
#include "mozilla/Services.h" // for GetObserverService
@ -1311,8 +1310,6 @@ NS_IMETHODIMP nsEditor::Observe(nsISupports* aSubj, const char *aTopic,
NS_IMETHODIMP nsEditor::SyncRealTimeSpell()
{
NS_TIME_FUNCTION;
bool enable = GetDesiredSpellCheckState();
// Initializes mInlineSpellChecker

View File

@ -5,7 +5,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Element.h"
@ -118,8 +117,6 @@ NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
nsISelectionController *aSelCon,
uint32_t aFlags)
{
NS_TIME_FUNCTION;
NS_PRECONDITION(aDoc, "bad arg");
NS_ENSURE_TRUE(aDoc, NS_ERROR_NULL_POINTER);

View File

@ -12,7 +12,6 @@
#include "nsISupportsPrimitives.h"
#include "nsAppStartupNotifier.h"
#include "mozilla/FunctionTimer.h"
NS_IMPL_ISUPPORTS1(nsAppStartupNotifier, nsIObserver)
@ -26,8 +25,6 @@ nsAppStartupNotifier::~nsAppStartupNotifier()
NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
{
NS_TIME_FUNCTION;
NS_ENSURE_ARG(aTopic);
nsresult rv;
@ -41,8 +38,6 @@ NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *a
getter_AddRefs(enumerator));
if (NS_FAILED(rv)) return rv;
NS_TIME_FUNCTION_MARK("EnumerateCategory");
nsCOMPtr<nsISupports> entry;
while (NS_SUCCEEDED(enumerator->GetNext(getter_AddRefs(entry)))) {
nsCOMPtr<nsISupportsCString> category = do_QueryInterface(entry, &rv);
@ -87,8 +82,6 @@ NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *a
#endif
}
NS_TIME_FUNCTION_MARK("observer: category: %s cid: %s", categoryEntry.get(), nsPromiseFlatCString(contractId).get());
}
}
}

View File

@ -65,7 +65,6 @@
#include "TexturePoolOGL.h"
#endif
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
@ -1361,8 +1360,6 @@ qcms_profile *
gfxPlatform::GetCMSOutputProfile()
{
if (!gCMSOutputProfile) {
NS_TIME_FUNCTION;
/* Determine if we're using the internal override to force sRGB as
an output profile for reftests. See Bug 452125.

View File

@ -15,7 +15,6 @@
#include "gfxPlatform.h"
#include "nsIMemoryReporter.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Attributes.h"
class CharMapHashKey : public PLDHashEntryHdr
@ -89,8 +88,6 @@ public:
}
static nsresult Init() {
NS_TIME_FUNCTION;
NS_ASSERTION(!sPlatformFontList, "What's this doing here?");
gfxPlatform::GetPlatform()->CreatePlatformFontList();
if (!sPlatformFontList) {

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Attributes.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "ImageLogging.h"
@ -868,8 +867,6 @@ void imgLoader::GlobalInit()
nsresult imgLoader::InitCache()
{
NS_TIME_FUNCTION;
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (!os)
return NS_ERROR_FAILURE;

View File

@ -68,7 +68,6 @@
#include "jsdbgapi.h"
#include "mozilla/FunctionTimer.h"
using namespace mozilla;
using namespace mozilla::scache;
@ -388,7 +387,6 @@ NS_IMPL_ISUPPORTS3(mozJSComponentLoader,
nsresult
mozJSComponentLoader::ReallyInit()
{
NS_TIME_FUNCTION;
nsresult rv;
@ -464,11 +462,6 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile)
if (NS_FAILED(rv))
return NULL;
#ifdef NS_FUNCTION_TIMER
NS_TIME_FUNCTION_FMT("%s (line %d) (file: %s)", MOZ_FUNCTION_NAME,
__LINE__, spec.get());
#endif
if (!mInitialized) {
rv = ReallyInit();
if (NS_FAILED(rv))
@ -974,9 +967,6 @@ mozJSComponentLoader::Import(const nsACString& registryLocation,
uint8_t optionalArgc,
JS::Value* retval)
{
NS_TIME_FUNCTION_FMT("%s (line %d) (file: %s)", MOZ_FUNCTION_NAME,
__LINE__, registryLocation.BeginReading());
JSAutoRequest ar(cx);
JS::Value targetVal = targetVal_;

View File

@ -28,7 +28,6 @@
#include "jsfriendapi.h"
#include "nsJSPrincipals.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/scache/StartupCache.h"
#include "mozilla/scache/StartupCacheUtils.h"
@ -155,11 +154,6 @@ mozJSSubScriptLoader::LoadSubScript(const nsAString& url,
nsresult rv = NS_OK;
#ifdef NS_FUNCTION_TIMER
NS_TIME_FUNCTION_FMT("%s (line %d) (url: %s)", MOZ_FUNCTION_NAME,
__LINE__, NS_LossyConvertUTF16toASCII(url).get());
#endif
/* set the system principal if it's not here already */
if (!mSystemPrincipal) {
nsCOMPtr<nsIScriptSecurityManager> secman =

View File

@ -17,7 +17,6 @@
#include "nsIMemoryReporter.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
#include "mozilla/FunctionTimer.h"
#include "prsystem.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
@ -2103,7 +2102,6 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
JS_NewDHashTable(JS_DHashGetStubOps(), nullptr,
sizeof(JSDHashEntryStub), 128);
#endif
NS_TIME_FUNCTION;
DOM_InitInterfaces();
Preferences::AddBoolVarCache(&gNewDOMBindingsEnabled, "dom.new_bindings",
@ -2225,8 +2223,6 @@ bool InternStaticDictionaryJSVals(JSContext* aCx);
JSBool
XPCJSRuntime::OnJSContextNew(JSContext *cx)
{
NS_TIME_FUNCTION;
// if it is our first context then we need to generate our string ids
JSBool ok = true;
if (JSID_IS_VOID(mStrIDs[0])) {

View File

@ -15,7 +15,6 @@
#include "nsIContent.h"
#include "nsIContentViewerContainer.h"
#include "nsIContentViewer.h"
#include "mozilla/FunctionTimer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsIDOMBeforeUnloadEvent.h"
#include "nsIDocument.h"
@ -960,7 +959,6 @@ void DocumentViewerImpl::SetNavigationTiming(nsDOMNavigationTiming* timing)
NS_IMETHODIMP
DocumentViewerImpl::LoadComplete(nsresult aStatus)
{
NS_TIME_FUNCTION;
/* We need to protect ourself against auto-destruction in case the
window is closed while processing the OnLoad event. See bug
http://bugzilla.mozilla.org/show_bug.cgi?id=78445 for more

View File

@ -169,7 +169,6 @@
#include "imgIEncoder.h"
#include "gfxPlatform.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "sampler.h"
@ -178,20 +177,6 @@
#include "Layers.h"
#include "nsAsyncDOMEvent.h"
#ifdef NS_FUNCTION_TIMER
#define NS_TIME_FUNCTION_DECLARE_DOCURL \
nsAutoCString docURL__("N/A"); \
nsIURI *uri__ = mDocument->GetDocumentURI(); \
if (uri__) uri__->GetSpec(docURL__);
#define NS_TIME_FUNCTION_WITH_DOCURL \
NS_TIME_FUNCTION_DECLARE_DOCURL \
NS_TIME_FUNCTION_MIN_FMT(1.0, \
"%s (line %d) (document: %s)", MOZ_FUNCTION_NAME, \
__LINE__, docURL__.get())
#else
#define NS_TIME_FUNCTION_WITH_DOCURL do{} while(0)
#endif
#define ANCHOR_SCROLL_FLAGS (SCROLL_OVERFLOW_HIDDEN | SCROLL_NO_PARENT_FRAMES)
using namespace mozilla;
@ -781,8 +766,6 @@ PresShell::Init(nsIDocument* aDocument,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode)
{
NS_TIME_FUNCTION_MIN(1.0);
NS_PRECONDITION(nullptr != aDocument, "null ptr");
NS_PRECONDITION(nullptr != aPresContext, "null ptr");
NS_PRECONDITION(nullptr != aViewManager, "null ptr");
@ -918,8 +901,6 @@ PresShell::Init(nsIDocument* aDocument,
void
PresShell::Destroy()
{
NS_TIME_FUNCTION_MIN(1.0);
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"destroy called on presshell while scripts not blocked");
@ -1115,8 +1096,6 @@ nsIPresShell::GetAuthorStyleDisabled() const
nsresult
PresShell::SetPreferenceStyleRules(bool aForceReflow)
{
NS_TIME_FUNCTION_MIN(1.0);
if (!mDocument) {
return NS_ERROR_NULL_POINTER;
}
@ -1206,8 +1185,6 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
nsresult
PresShell::CreatePreferenceStyleSheet()
{
NS_TIME_FUNCTION_MIN(1.0);
NS_ASSERTION(!mPrefStyleSheet, "prefStyleSheet already exists");
mPrefStyleSheet = new nsCSSStyleSheet(CORS_NONE);
nsCOMPtr<nsIURI> uri;
@ -1247,8 +1224,6 @@ static uint32_t sInsertPrefSheetRulesAt = 2;
nsresult
PresShell::SetPrefNoScriptRule()
{
NS_TIME_FUNCTION_MIN(1.0);
nsresult rv = NS_OK;
// also handle the case where print is done from print preview
@ -1276,8 +1251,6 @@ PresShell::SetPrefNoScriptRule()
nsresult PresShell::SetPrefNoFramesRule(void)
{
NS_TIME_FUNCTION_MIN(1.0);
NS_ASSERTION(mPresContext,"null prescontext not allowed");
if (!mPresContext) {
return NS_ERROR_FAILURE;
@ -1313,8 +1286,6 @@ nsresult PresShell::SetPrefNoFramesRule(void)
nsresult PresShell::SetPrefLinkRules(void)
{
NS_TIME_FUNCTION_MIN(1.0);
NS_ASSERTION(mPresContext,"null prescontext not allowed");
if (!mPresContext) {
return NS_ERROR_FAILURE;
@ -1390,8 +1361,6 @@ nsresult PresShell::SetPrefLinkRules(void)
nsresult PresShell::SetPrefFocusRules(void)
{
NS_TIME_FUNCTION_MIN(1.0);
NS_ASSERTION(mPresContext,"null prescontext not allowed");
nsresult result = NS_OK;
@ -1628,7 +1597,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
return NS_OK;
}
NS_TIME_FUNCTION_WITH_DOCURL;
mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
NS_ASSERTION(!mDidInitialize, "Why are we being called?");
@ -1709,8 +1677,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
// Run the XBL binding constructors for any new frames we've constructed
mDocument->BindingManager()->ProcessAttachedQueue();
NS_TIME_FUNCTION_MARK("XBL binding constructors fired");
// Constructors may have killed us too
NS_ENSURE_STATE(!mHaveShutDown);
@ -1971,8 +1937,6 @@ PresShell::SetIgnoreFrameDestruction(bool aIgnore)
void
PresShell::NotifyDestroyingFrame(nsIFrame* aFrame)
{
NS_TIME_FUNCTION_MIN(1.0);
if (!mIgnoreFrameDestruction) {
mDocument->StyleImageLoader()->DropRequestsForFrame(aFrame);
@ -2475,15 +2439,6 @@ void
PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
nsFrameState aBitToAdd)
{
#ifdef NS_FUNCTION_TIMER
NS_TIME_FUNCTION_DECLARE_DOCURL;
nsAutoCString frameType__("N/A");
nsIAtom *atomType__ = aFrame ? aFrame->GetType() : nullptr;
if (atomType__) atomType__->ToUTF8String(frameType__);
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (document: %s, frame type: %s)", MOZ_FUNCTION_NAME,
__LINE__, docURL__.get(), frameType__.get());
#endif
NS_PRECONDITION(aBitToAdd == NS_FRAME_IS_DIRTY ||
aBitToAdd == NS_FRAME_HAS_DIRTY_CHILDREN,
"Unexpected bits being added");
@ -2703,8 +2658,6 @@ PresShell::CancelAllPendingReflows()
nsresult
PresShell::RecreateFramesFor(nsIContent* aContent)
{
NS_TIME_FUNCTION_MIN(1.0);
NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE);
if (!mDidInitialize) {
// Nothing to do here. In fact, if we proceed and aContent is the
@ -2767,8 +2720,6 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
already_AddRefed<nsRenderingContext>
PresShell::GetReferenceRenderingContext()
{
NS_TIME_FUNCTION_MIN(1.0);
nsDeviceContext* devCtx = mPresContext->DeviceContext();
nsRefPtr<nsRenderingContext> rc;
if (mPresContext->IsScreen()) {
@ -3512,8 +3463,6 @@ nsIPresShell::ClearMouseCapture(nsIFrame* aFrame)
nsresult
PresShell::CaptureHistoryState(nsILayoutHistoryState** aState, bool aLeavingPage)
{
NS_TIME_FUNCTION_MIN(1.0);
nsresult rv = NS_OK;
NS_PRECONDITION(nullptr != aState, "null state pointer");
@ -3765,19 +3714,6 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
* SetNeedStyleFlush calls on the document.
*/
#ifdef NS_FUNCTION_TIMER
NS_TIME_FUNCTION_DECLARE_DOCURL;
static const char *flushTypeNames[] = {
"Flush_Content",
"Flush_ContentAndNotify",
"Flush_Styles",
"Flush_InterruptibleLayout",
"Flush_Layout",
"Flush_Display"
};
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (document: %s, type: %s)", MOZ_FUNCTION_NAME,
__LINE__, docURL__.get(), flushTypeNames[aType - 1]);
#endif
SAMPLE_LABEL("layout", "FlushPendingNotifications");
#ifdef ACCESSIBILITY
@ -4281,8 +4217,6 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
nscolor aBackgroundColor,
gfxContext* aThebesContext)
{
NS_TIME_FUNCTION_WITH_DOCURL;
NS_ENSURE_TRUE(!(aFlags & RENDER_IS_UNTRUSTED), NS_ERROR_NOT_IMPLEMENTED);
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
@ -4426,8 +4360,6 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
nsDisplayList* aList,
nsRange* aRange)
{
NS_TIME_FUNCTION_WITH_DOCURL;
// iterate though the display items and add up the bounding boxes of each.
// This will allow the total area of the frames within the range to be
// determined. To do this, remove an item from the bottom of the list, check
@ -4533,8 +4465,6 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect& aSurfaceRect,
bool aForPrimarySelection)
{
NS_TIME_FUNCTION_WITH_DOCURL;
RangePaintInfo* info = nullptr;
nsRange* range = static_cast<nsRange*>(aRange);
@ -4620,8 +4550,6 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
nsIntPoint& aPoint,
nsIntRect* aScreenRect)
{
NS_TIME_FUNCTION_WITH_DOCURL;
nsPresContext* pc = GetPresContext();
if (!pc || aArea.width == 0 || aArea.height == 0)
return nullptr;
@ -5251,17 +5179,6 @@ PresShell::Paint(nsIView* aViewToPaint,
PaintType aType,
bool aWillSendDidPaint)
{
#ifdef NS_FUNCTION_TIMER
NS_TIME_FUNCTION_DECLARE_DOCURL;
const nsRect& bounds__ = aDirtyRegion.GetBounds();
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (document: %s, dirty rect: (<%f, %f>, <%f, %f>)",
MOZ_FUNCTION_NAME, __LINE__, docURL__.get(),
NSCoordToFloat(bounds__.x),
NSCoordToFloat(bounds__.y),
NSCoordToFloat(bounds__.XMost()),
NSCoordToFloat(bounds__.YMost()));
#endif
SAMPLE_LABEL("Paint", "PresShell::Paint");
NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
NS_ASSERTION(aViewToPaint, "null view");
@ -5678,8 +5595,6 @@ PresShell::HandleEvent(nsIFrame *aFrame,
if (!nsContentUtils::IsSafeToRunScript())
return NS_OK;
NS_TIME_FUNCTION_MIN(1.0);
nsIContent* capturingContent =
NS_IS_MOUSE_EVENT(aEvent) || aEvent->eventStructType == NS_WHEEL_EVENT ?
GetCapturingContent() : nullptr;
@ -6274,8 +6189,6 @@ static bool CanHandleContextMenuEvent(nsMouseEvent* aMouseEvent,
nsresult
PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
{
NS_TIME_FUNCTION_MIN(1.0);
nsRefPtr<nsEventStateManager> manager = mPresContext->EventStateManager();
nsresult rv = NS_OK;
@ -7353,8 +7266,6 @@ PresShell::ScheduleReflowOffTimer()
bool
PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
{
NS_TIME_FUNCTION_WITH_DOCURL;
nsAutoCString docURL("N/A");
nsIURI *uri = mDocument->GetDocumentURI();
if (uri)
@ -7550,7 +7461,6 @@ PresShell::ProcessReflowCommands(bool aInterruptible)
return true;
}
NS_TIME_FUNCTION_WITH_DOCURL;
mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
bool interrupted = false;
if (!mDirtyRoots.IsEmpty()) {

View File

@ -31,7 +31,6 @@
#include "nsCharsetSource.h"
#include "nsMimeTypes.h"
#include "mozilla/FunctionTimer.h"
// plugins
#include "nsIPluginHost.h"
@ -145,16 +144,6 @@ nsContentDLF::CreateInstance(const char* aCommand,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
#ifdef NS_FUNCTION_TIMER
nsAutoCString channelURL__("N/A");
nsCOMPtr<nsIURI> url__;
if (aChannel && NS_SUCCEEDED(aChannel->GetURI(getter_AddRefs(url__)))) {
url__->GetSpec(channelURL__);
}
NS_TIME_FUNCTION_FMT("%s (line %d) (url: %s)", MOZ_FUNCTION_NAME,
__LINE__, channelURL__.get());
#endif
// Declare "type" here. This is because although the variable itself only
// needs limited scope, we need to use the raw string memory -- as returned
// by "type.get()" farther down in the function.
@ -297,8 +286,6 @@ nsContentDLF::CreateInstanceForDocument(nsISupports* aContainer,
const char *aCommand,
nsIContentViewer** aContentViewer)
{
NS_TIME_FUNCTION;
nsCOMPtr<nsIContentViewer> contentViewer;
nsresult rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
NS_ENSURE_SUCCESS(rv, rv);
@ -314,8 +301,6 @@ nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup,
nsIPrincipal* aPrincipal,
nsIDocument **aDocument)
{
NS_TIME_FUNCTION;
*aDocument = nullptr;
nsresult rv = NS_ERROR_FAILURE;
@ -396,8 +381,6 @@ nsContentDLF::CreateDocument(const char* aCommand,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer)
{
NS_TIME_FUNCTION;
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIURI> aURL;
@ -446,8 +429,6 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer)
{
NS_TIME_FUNCTION;
nsresult rv;
nsCOMPtr<nsIDocument> doc = do_CreateInstance(kXULDocumentCID, &rv);
if (NS_FAILED(rv)) return rv;

View File

@ -71,7 +71,6 @@
#include "nsPresState.h"
#include "nsContentList.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Selection.h"
#define DEFAULT_COLUMN_WIDTH 20
@ -292,8 +291,6 @@ nsTextControlFrame::EnsureEditorInitialized()
if (mUseEditor)
return NS_OK;
NS_TIME_FUNCTION;
nsIDocument* doc = mContent->GetCurrentDoc();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);

View File

@ -65,7 +65,6 @@
#include "nsIChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "mozilla/FunctionTimer.h"
/**
* OVERALL ARCHITECTURE
@ -1387,13 +1386,6 @@ Loader::LoadSheet(SheetLoadData* aLoadData, StyleSheetState aSheetState)
"Shouldn't use system principal for async loads");
NS_ASSERTION(mLoadingDatas.IsInitialized(), "mLoadingDatas should be initialized by now.");
#ifdef NS_FUNCTION_TIMER
nsAutoCString spec__("N/A");
if (aLoadData->mURI) aLoadData->mURI->GetSpec(spec__);
NS_TIME_FUNCTION_FMT("Loading stylesheet (url: %s, %ssync)",
spec__.get(), aLoadData->mSyncLoad ? "" : "a");
#endif
LOG_URI(" Load from: '%s'", aLoadData->mURI);
nsresult rv = NS_OK;
@ -1623,12 +1615,6 @@ Loader::ParseSheet(const nsAString& aInput,
NS_PRECONDITION(aLoadData, "Must have load data");
NS_PRECONDITION(aLoadData->mSheet, "Must have sheet to parse into");
#ifdef NS_FUNCTION_TIMER
nsAutoCString spec__("N/A");
if (aLoadData->mURI) aLoadData->mURI->GetSpec(spec__);
NS_TIME_FUNCTION_FMT("Parsing stylesheet (url: %s)", spec__.get());
#endif
aCompleted = false;
nsCSSParser parser(this, aLoadData->mSheet);

View File

@ -20,7 +20,6 @@
#include "nsWildCard.h"
#include "nsZipArchive.h"
#include "nsString.h"
#include "mozilla/FunctionTimer.h"
#include "prenv.h"
#if defined(XP_WIN)
#include <windows.h>
@ -517,9 +516,6 @@ nsZipItem* nsZipArchive::CreateZipItem()
//---------------------------------------------
nsresult nsZipArchive::BuildFileList()
{
#ifndef XP_WIN
NS_TIME_FUNCTION;
#endif
// Get archive size using end pos
const uint8_t* buf;
const uint8_t* startp = mFd->mFileData;

View File

@ -40,7 +40,6 @@
#include "nsIUploadChannel2.h"
#include "nsXULAppAPI.h"
#include "mozilla/FunctionTimer.h"
#if defined(XP_WIN) || defined(MOZ_PLATFORM_MAEMO)
#include "nsNativeConnectionHelper.h"
@ -157,8 +156,6 @@ nsIOService::nsIOService()
nsresult
nsIOService::Init()
{
NS_TIME_FUNCTION;
nsresult rv;
// We need to get references to the DNS service so that we can shut it
@ -171,8 +168,6 @@ nsIOService::Init()
return rv;
}
NS_TIME_FUNCTION_MARK("got DNS Service");
// XXX hack until xpidl supports error info directly (bug 13423)
nsCOMPtr<nsIErrorService> errorService = do_GetService(NS_ERRORSERVICE_CONTRACTID);
if (errorService) {
@ -181,8 +176,6 @@ nsIOService::Init()
else
NS_WARNING("failed to get error service");
NS_TIME_FUNCTION_MARK("got Error Service");
// setup our bad port list stuff
for(int i=0; gBadPortList[i]; i++)
mRestrictedPortList.AppendElement(gBadPortList[i]);
@ -209,14 +202,10 @@ nsIOService::Init()
}
else
NS_WARNING("failed to get observer service");
NS_TIME_FUNCTION_MARK("Registered observers");
gIOService = this;
InitializeNetworkLinkService();
NS_TIME_FUNCTION_MARK("Set up network link service");
return NS_OK;
}
@ -230,8 +219,6 @@ nsIOService::~nsIOService()
nsresult
nsIOService::InitializeSocketTransportService()
{
NS_TIME_FUNCTION;
nsresult rv = NS_OK;
if (!mSocketTransportService) {
@ -254,8 +241,6 @@ nsIOService::InitializeSocketTransportService()
nsresult
nsIOService::InitializeNetworkLinkService()
{
NS_TIME_FUNCTION;
nsresult rv = NS_OK;
if (mNetworkLinkServiceInitialized)

View File

@ -19,7 +19,6 @@
#include "nsServiceManagerUtils.h"
#include "nsIOService.h"
#include "mozilla/FunctionTimer.h"
// XXX: There is no good header file to put these in. :(
namespace mozilla { namespace psm {
@ -416,8 +415,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS6(nsSocketTransportService,
NS_IMETHODIMP
nsSocketTransportService::Init()
{
NS_TIME_FUNCTION;
if (!NS_IsMainThread()) {
NS_ERROR("wrong thread");
return NS_ERROR_UNEXPECTED;
@ -446,8 +443,6 @@ nsSocketTransportService::Init()
SOCKET_LOG(("running socket transport thread without a pollable event"));
}
}
NS_TIME_FUNCTION_MARK("Created thread");
nsCOMPtr<nsIThread> thread;
nsresult rv = NS_NewThread(getter_AddRefs(thread), this);
@ -464,8 +459,6 @@ nsSocketTransportService::Init()
tmpPrefService->AddObserver(SEND_BUFFER_PREF, this, false);
UpdatePrefs();
NS_TIME_FUNCTION_MARK("UpdatePrefs");
mInitialized = true;
return NS_OK;
}

View File

@ -37,7 +37,6 @@
#include "mozilla/Services.h"
#include "nsITimer.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/net/NeckoCommon.h"
@ -1109,8 +1108,6 @@ nsCacheService::~nsCacheService()
nsresult
nsCacheService::Init()
{
NS_TIME_FUNCTION;
// Thie method must be called on the main thread because mCacheIOThread must
// only be modified on the main thread.
if (!NS_IsMainThread()) {

View File

@ -44,7 +44,6 @@
#include "nsCOMArray.h"
#include "nsISimpleEnumerator.h"
#include "mozilla/FunctionTimer.h"
#include "nsThreadUtils.h"
#include "mozilla/Telemetry.h"
@ -386,8 +385,6 @@ nsDiskCacheDevice::~nsDiskCacheDevice()
nsresult
nsDiskCacheDevice::Init()
{
NS_TIME_FUNCTION;
nsresult rv;
if (Initialized()) {

View File

@ -35,7 +35,6 @@
#include "nsICacheVisitor.h"
#include "nsISeekableStream.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Telemetry.h"
#include "sqlite3.h"
@ -1051,8 +1050,6 @@ struct StatementSql {
nsresult
nsOfflineCacheDevice::Init()
{
NS_TIME_FUNCTION;
NS_ENSURE_TRUE(!mDB, NS_ERROR_ALREADY_INITIALIZED);
// SetCacheParentDirectory must have been called

View File

@ -46,7 +46,6 @@
#include "nsIPrivateBrowsingService.h"
#include "nsNetCID.h"
#include "mozilla/storage.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Util.h" // for DebugOnly
#include "mozilla/Attributes.h"
@ -608,8 +607,6 @@ nsCookieService::nsCookieService()
nsresult
nsCookieService::Init()
{
NS_TIME_FUNCTION;
nsresult rv;
mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -27,7 +27,6 @@
#include "nsIOService.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Attributes.h"
using namespace mozilla;
@ -364,8 +363,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsDNSService, nsIDNSService, nsPIDNSService,
NS_IMETHODIMP
nsDNSService::Init()
{
NS_TIME_FUNCTION;
if (mResolver)
return NS_OK;
NS_ENSURE_TRUE(!mResolver, NS_ERROR_ALREADY_INITIALIZED);

View File

@ -14,7 +14,6 @@
#include "nsNetUtil.h"
#include "prnetdb.h"
#include "mozilla/FunctionTimer.h"
using namespace mozilla;
@ -61,8 +60,6 @@ nsDomainEntry::FuncForStaticAsserts(void)
nsresult
nsEffectiveTLDService::Init()
{
NS_TIME_FUNCTION;
const ETLDEntry *entries = nsDomainEntry::entries;
// We'll probably have to rehash at least once, since nsTHashtable doesn't

View File

@ -34,7 +34,6 @@
#include "nsThreadUtils.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
@ -367,8 +366,6 @@ nsHostResolver::~nsHostResolver()
nsresult
nsHostResolver::Init()
{
NS_TIME_FUNCTION;
PL_DHashTableInit(&mDB, &gHostDB_ops, nullptr, sizeof(nsHostDBEnt), 0);
mShutdown = false;

View File

@ -14,7 +14,6 @@
#include "nsISupportsPrimitives.h"
#include "punycode.h"
#include "mozilla/FunctionTimer.h"
//-----------------------------------------------------------------------------
// RFC 1034 - 3.1. Name space specifications and terminology
@ -47,8 +46,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsIDNService,
nsresult nsIDNService::Init()
{
NS_TIME_FUNCTION;
nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs)
prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch));

View File

@ -63,7 +63,6 @@ using namespace mozilla;
using namespace mozilla::net;
#include "mozilla/net/HttpChannelChild.h"
#include "mozilla/FunctionTimer.h"
#ifdef DEBUG
// defined by the socket transport service while active
@ -208,8 +207,6 @@ nsHttpHandler::~nsHttpHandler()
nsresult
nsHttpHandler::Init()
{
NS_TIME_FUNCTION;
nsresult rv;
LOG(("nsHttpHandler::Init\n"));
@ -310,8 +307,6 @@ nsHttpHandler::Init()
nsresult
nsHttpHandler::InitConnectionMgr()
{
NS_TIME_FUNCTION;
nsresult rv;
if (!mConnMgr) {

View File

@ -28,7 +28,6 @@
#include "nsServiceManagerUtils.h" // do_GetService
#include "nsIHttpActivityObserver.h"
#include "mozilla/FunctionTimer.h"
using namespace mozilla;
@ -173,8 +172,6 @@ nsHttpTransaction::Init(uint8_t caps,
nsITransportEventSink *eventsink,
nsIAsyncInputStream **responseBody)
{
NS_TIME_FUNCTION;
nsresult rv;
LOG(("nsHttpTransaction::Init [this=%x caps=%x]\n", this, caps));

View File

@ -31,7 +31,6 @@
#include "nsZipArchive.h"
#include "mozilla/Omnijar.h"
#include "prenv.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Telemetry.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
@ -485,7 +484,6 @@ StartupCache::WaitOnWriteThread()
if (!mWriteThread || mWriteThread == PR_GetCurrentThread())
return;
NS_TIME_FUNCTION_MIN(30);
PR_JoinThread(mWriteThread);
mWriteThread = NULL;
}

View File

@ -33,7 +33,6 @@
#include "nsIPromptService.h"
#include "nsIMemoryReporter.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Util.h"
namespace {
@ -571,8 +570,6 @@ const sqlite3_mem_methods memMethods = {
nsresult
Service::initialize()
{
NS_TIME_FUNCTION;
int rc;
#ifdef MOZ_STORAGE_MEMORY
@ -729,12 +726,6 @@ Service::OpenDatabase(nsIFile *aDatabaseFile,
{
NS_ENSURE_ARG(aDatabaseFile);
#ifdef NS_FUNCTION_TIMER
nsCString leafname;
(void)aDatabaseFile->GetNativeLeafName(leafname);
NS_TIME_FUNCTION_FMT("mozIStorageService::OpenDatabase(%s)", leafname.get());
#endif
// Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
// reasons.
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
@ -755,13 +746,6 @@ Service::OpenUnsharedDatabase(nsIFile *aDatabaseFile,
{
NS_ENSURE_ARG(aDatabaseFile);
#ifdef NS_FUNCTION_TIMER
nsCString leafname;
(void)aDatabaseFile->GetNativeLeafName(leafname);
NS_TIME_FUNCTION_FMT("mozIStorageService::OpenUnsharedDatabase(%s)",
leafname.get());
#endif
// Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
// reasons.
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_PRIVATECACHE |
@ -868,13 +852,6 @@ Service::OpenDatabaseWithVFS(nsIFile *aDatabaseFile,
{
NS_ENSURE_ARG(aDatabaseFile);
#ifdef NS_FUNCTION_TIMER
nsCString leafname;
(void)aDatabaseFile->GetNativeLeafName(leafname);
NS_TIME_FUNCTION_FMT("mozIStorageService::OpenDatabaseWithVFS(%s)",
leafname.get());
#endif
// Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
// reasons.
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |

View File

@ -27,7 +27,6 @@
#include "prlog.h"
#include "mozilla/FunctionTimer.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo* gStorageLog;
@ -557,9 +556,6 @@ Statement::ExecuteStep(bool *_moreResults)
if (!mDBStatement)
return NS_ERROR_NOT_INITIALIZED;
NS_TIME_FUNCTION_MIN_FMT(5, "mozIStorageStatement::ExecuteStep(%s) (0x%p)",
mDBConnection->getFilename().get(), mDBStatement);
// Bind any parameters first before executing.
if (mParamsArray) {
// If we have more than one row of parameters to bind, they shouldn't be

View File

@ -16,7 +16,6 @@
#include "nsPrintfCString.h"
#include "prprf.h"
#include "mozilla/storage.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Util.h"
#include "sampler.h"
@ -237,8 +236,6 @@ NS_IMPL_ISUPPORTS5(nsNavBookmarks
nsresult
nsNavBookmarks::Init()
{
NS_TIME_FUNCTION;
mDB = Database::GetDatabase();
NS_ENSURE_STATE(mDB);

View File

@ -32,7 +32,6 @@
#include "nsAppDirectoryServiceDefs.h"
#include "nsMathUtils.h"
#include "mozilla/storage.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Util.h"
#include "mozilla/Preferences.h"
@ -290,8 +289,6 @@ nsNavHistory::~nsNavHistory()
nsresult
nsNavHistory::Init()
{
NS_TIME_FUNCTION;
LoadPrefs();
mDB = Database::GetDatabase();

View File

@ -34,7 +34,6 @@
#include "nsAppShellCID.h"
#include "nsXPCOMCIDInternal.h"
#include "mozilla/Services.h"
#include "mozilla/FunctionTimer.h"
#include "nsIXPConnect.h"
#include "jsapi.h"
#include "prenv.h"
@ -172,22 +171,17 @@ nsAppStartup::nsAppStartup() :
nsresult
nsAppStartup::Init()
{
NS_TIME_FUNCTION;
nsresult rv;
// Create widget application shell
mAppShell = do_GetService(kAppShellCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_TIME_FUNCTION_MARK("Got AppShell service");
nsCOMPtr<nsIObserverService> os =
mozilla::services::GetObserverService();
if (!os)
return NS_ERROR_FAILURE;
NS_TIME_FUNCTION_MARK("Got Observer service");
os->AddObserver(this, "quit-application-forced", true);
os->AddObserver(this, "sessionstore-windows-restored", true);
os->AddObserver(this, "profile-change-teardown", true);

View File

@ -91,7 +91,6 @@
#include "nsIDocShell.h"
#include "nsAppShellCID.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/unused.h"
using namespace mozilla;
@ -184,7 +183,6 @@ using mozilla::unused;
#include "base/command_line.h"
#include "mozilla/FunctionTimer.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
@ -1232,7 +1230,6 @@ nsSingletonFactory::LockFactory(bool)
nsresult
ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native)
{
NS_TIME_FUNCTION;
nsresult rv;
NS_IF_ADDREF(gNativeAppSupport = native);
@ -1240,23 +1237,16 @@ ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native)
// Inform the chrome registry about OS accessibility
nsCOMPtr<nsIToolkitChromeRegistry> cr =
mozilla::services::GetToolkitChromeRegistryService();
NS_TIME_FUNCTION_MARK("Got ToolkitChromeRegistry service");
if (cr)
cr->CheckForOSAccessibility();
NS_TIME_FUNCTION_MARK("OS Accessibility check");
nsCOMPtr<nsIWindowCreator> creator (do_GetService(NS_APPSTARTUP_CONTRACTID));
if (!creator) return NS_ERROR_UNEXPECTED;
NS_TIME_FUNCTION_MARK("Got AppStartup service");
nsCOMPtr<nsIWindowWatcher> wwatch
(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
NS_TIME_FUNCTION_MARK("Got WindowWatcher service");
return wwatch->SetWindowCreator(creator);
}
@ -2798,8 +2788,6 @@ public:
int
XREMain::XRE_mainInit(const nsXREAppData* aAppData, bool* aExitFlag)
{
NS_TIME_FUNCTION;
if (!aExitFlag)
return 1;
*aExitFlag = false;
@ -3193,7 +3181,6 @@ XREMain::XRE_mainInit(const nsXREAppData* aAppData, bool* aExitFlag)
int
XREMain::XRE_mainStartup(bool* aExitFlag)
{
NS_TIME_FUNCTION;
nsresult rv;
if (!aExitFlag)
@ -3570,7 +3557,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
nsresult
XREMain::XRE_mainRun()
{
NS_TIME_FUNCTION;
nsresult rv = NS_OK;
NS_ASSERTION(mScopedXPCom, "Scoped xpcom not initialized.");
@ -3581,31 +3567,22 @@ XREMain::XRE_mainRun()
nsCOMPtr<nsISupports> comp;
comp = do_GetService("@mozilla.org/preferences-service;1");
NS_TIME_FUNCTION_MARK("Pref Service");
comp = do_GetService("@mozilla.org/network/socket-transport-service;1");
NS_TIME_FUNCTION_MARK("Socket Transport Service");
comp = do_GetService("@mozilla.org/network/dns-service;1");
NS_TIME_FUNCTION_MARK("DNS Service");
comp = do_GetService("@mozilla.org/network/io-service;1");
NS_TIME_FUNCTION_MARK("IO Service");
comp = do_GetService("@mozilla.org/chrome/chrome-registry;1");
NS_TIME_FUNCTION_MARK("Chrome Registry Service");
comp = do_GetService("@mozilla.org/focus-event-suppressor-service;1");
NS_TIME_FUNCTION_MARK("Focus Event Suppressor Service");
}
#endif
rv = mScopedXPCom->SetWindowCreator(mNativeApp);
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: SetWindowCreator");
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: Done");
#ifdef MOZ_CRASHREPORTER
// tell the crash reporter to also send the release channel
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
@ -3624,8 +3601,6 @@ XREMain::XRE_mainRun()
}
#endif
NS_TIME_FUNCTION_MARK("Next: AppStartup");
if (mStartOffline) {
nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1"));
NS_ENSURE_TRUE(io, NS_ERROR_FAILURE);
@ -3641,14 +3616,10 @@ XREMain::XRE_mainRun()
startupNotifier->Observe(nullptr, APPSTARTUP_TOPIC, nullptr);
}
NS_TIME_FUNCTION_MARK("Finished startupNotifier");
nsCOMPtr<nsIAppStartup> appStartup
(do_GetService(NS_APPSTARTUP_CONTRACTID));
NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
NS_TIME_FUNCTION_MARK("Created AppStartup");
if (gDoMigration) {
nsCOMPtr<nsIFile> file;
mDirProvider.GetAppDir()->Clone(getter_AddRefs(file));
@ -3702,12 +3673,8 @@ XREMain::XRE_mainRun()
}
}
NS_TIME_FUNCTION_MARK("Profile migration");
mDirProvider.DoStartup();
NS_TIME_FUNCTION_MARK("dirProvider.DoStartup() (profile-after-change)");
appStartup->GetShuttingDown(&mShuttingDown);
nsCOMPtr<nsICommandLineRunner> cmdLine;
@ -3731,10 +3698,6 @@ XREMain::XRE_mainRun()
if (obsService) {
obsService->NotifyObservers(cmdLine, "command-line-startup", nullptr);
}
NS_TIME_FUNCTION_MARK("Early command line init");
NS_TIME_FUNCTION_MARK("Next: prepare for Run");
}
SaveStateForAppInitiatedRestart();
@ -3749,11 +3712,7 @@ XREMain::XRE_mainRun()
SaveToEnv("XUL_APP_FILE=");
SaveToEnv("XRE_BINARY_PATH=");
NS_TIME_FUNCTION_MARK("env munging");
if (!mShuttingDown) {
NS_TIME_FUNCTION_MARK("Next: CreateHiddenWindow");
rv = appStartup->CreateHiddenWindow();
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
@ -3789,8 +3748,6 @@ XREMain::XRE_mainRun()
if (obsService)
obsService->NotifyObservers(nullptr, "final-ui-startup", nullptr);
NS_TIME_FUNCTION_MARK("final-ui-startup done");
appStartup->GetShuttingDown(&mShuttingDown);
}
@ -3821,10 +3778,6 @@ XREMain::XRE_mainRun()
}
#endif /* MOZ_INSTRUMENT_EVENT_LOOP */
NS_TIME_FUNCTION_MARK("Next: Run");
NS_TIME_FUNCTION_MARK("appStartup->Run");
{
rv = appStartup->Run();
if (NS_FAILED(rv)) {
@ -3833,10 +3786,6 @@ XREMain::XRE_mainRun()
}
}
NS_TIME_FUNCTION_MARK("Next: Finish");
NS_TIME_FUNCTION_MARK("appStartup->Run done");
return rv;
}
@ -3846,14 +3795,11 @@ XREMain::XRE_mainRun()
int
XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
{
NS_TIME_FUNCTION;
SAMPLER_INIT();
SAMPLE_LABEL("Startup", "XRE_Main");
nsresult rv = NS_OK;
NS_TIME_FUNCTION_MARK("XRE_main init");
gArgc = argc;
gArgv = argv;
@ -3883,7 +3829,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
if (result != 0 || exit)
return result;
NS_TIME_FUNCTION_MARK("XRE_main startup");
// startup
result = XRE_mainStartup(&exit);
if (result != 0 || exit)
@ -3892,20 +3837,16 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
bool appInitiatedRestart = false;
// Start the real application
NS_TIME_FUNCTION_MARK("XRE_main ScopedXPCOMStartup");
mScopedXPCom = new ScopedXPCOMStartup();
if (!mScopedXPCom)
return 1;
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: Initialize");
rv = mScopedXPCom->Initialize();
NS_ENSURE_SUCCESS(rv, 1);
// run!
NS_TIME_FUNCTION_MARK("XRE_main run");
rv = XRE_mainRun();
NS_TIME_FUNCTION_MARK("XRE_main shutdown");
#ifdef MOZ_INSTRUMENT_EVENT_LOOP
mozilla::ShutdownEventTracing();
#endif

View File

@ -48,19 +48,6 @@
#include "nsDocLoader.h"
#include "mozilla/Attributes.h"
#include "mozilla/FunctionTimer.h"
#ifdef NS_FUNCTION_TIMER
#define TIME_URILOADER_FUNCTION(req) \
nsAutoCString name__("N/A"); \
(req)->GetName(name__); \
NS_TIME_FUNCTION_FMT("%s (line %d) (request: %s)", \
MOZ_FUNCTION_NAME, \
__LINE__, \
name__.get())
#else
#define TIME_URILOADER_FUNCTION(req) do {} while(0)
#endif
#ifdef PR_LOGGING
PRLogModuleInfo* nsURILoader::mLog = nullptr;
#endif
@ -205,8 +192,6 @@ nsresult nsDocumentOpenInfo::Prepare()
NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
{
TIME_URILOADER_FUNCTION(request);
LOG(("[0x%p] nsDocumentOpenInfo::OnStartRequest", this));
nsresult rv = NS_OK;
@ -282,8 +267,6 @@ nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
nsIInputStream * inStr,
uint64_t sourceOffset, uint32_t count)
{
TIME_URILOADER_FUNCTION(request);
// if we have retarged to the end stream listener, then forward the call....
// otherwise, don't do anything
@ -297,8 +280,6 @@ nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
NS_IMETHODIMP nsDocumentOpenInfo::OnStopRequest(nsIRequest *request, nsISupports *aCtxt,
nsresult aStatus)
{
TIME_URILOADER_FUNCTION(request);
LOG(("[0x%p] nsDocumentOpenInfo::OnStopRequest", this));
if ( m_targetStreamListener)
@ -321,8 +302,6 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStopRequest(nsIRequest *request, nsISupports
nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports * aCtxt)
{
TIME_URILOADER_FUNCTION(request);
LOG(("[0x%p] nsDocumentOpenInfo::DispatchContent for type '%s'", this, mContentType.get()));
NS_PRECONDITION(!m_targetStreamListener,
@ -553,8 +532,6 @@ nsDocumentOpenInfo::ConvertData(nsIRequest *request,
const nsACString& aSrcContentType,
const nsACString& aOutContentType)
{
TIME_URILOADER_FUNCTION(request);
LOG(("[0x%p] nsDocumentOpenInfo::ConvertData from '%s' to '%s'", this,
PromiseFlatCString(aSrcContentType).get(),
PromiseFlatCString(aOutContentType).get()));
@ -611,8 +588,6 @@ bool
nsDocumentOpenInfo::TryContentListener(nsIURIContentListener* aListener,
nsIChannel* aChannel)
{
TIME_URILOADER_FUNCTION(aChannel);
LOG(("[0x%p] nsDocumentOpenInfo::TryContentListener; mFlags = 0x%x",
this, mFlags));
@ -757,8 +732,6 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
{
NS_ENSURE_ARG_POINTER(channel);
TIME_URILOADER_FUNCTION(channel);
#ifdef PR_LOGGING
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;
@ -806,8 +779,6 @@ nsresult nsURILoader::OpenChannel(nsIChannel* channel,
NS_ASSERTION(channel, "Trying to open a null channel!");
NS_ASSERTION(aWindowContext, "Window context must not be null");
TIME_URILOADER_FUNCTION(channel);
#ifdef PR_LOGGING
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;

View File

@ -5,7 +5,6 @@
#include "GfxInfo.h"
#include "nsUnicharUtils.h"
#include "mozilla/FunctionTimer.h"
#include "prenv.h"
#include "prprf.h"
#include "nsHashKeys.h"

View File

@ -10,7 +10,6 @@
#include "GfxInfo.h"
#include "nsUnicharUtils.h"
#include "mozilla/FunctionTimer.h"
#include "nsCocoaFeatures.h"
#include "mozilla/Preferences.h"
@ -103,8 +102,6 @@ GfxInfo::GetDeviceInfo()
nsresult
GfxInfo::Init()
{
NS_TIME_FUNCTION;
nsresult rv = GfxInfoBase::Init();
// Calling CGLQueryRendererInfo causes us to switch to the discrete GPU

View File

@ -11,7 +11,6 @@
#include "GfxInfo.h"
#include "GfxInfoWebGL.h"
#include "nsUnicharUtils.h"
#include "mozilla/FunctionTimer.h"
#include "prenv.h"
#include "prprf.h"
#include "GfxDriverInfo.h"
@ -242,8 +241,6 @@ ParseIDFromDeviceID(const nsAString &key, const char *prefix, int length)
nsresult
GfxInfo::Init()
{
NS_TIME_FUNCTION;
nsresult rv = GfxInfoBase::Init();
DISPLAY_DEVICEW displayDevice;

View File

@ -158,7 +158,6 @@
#include "nsWindowDefs.h"
#include "mozilla/FunctionTimer.h"
#include "nsCrashOnException.h"
#include "nsIXULRuntime.h"
@ -1064,18 +1063,6 @@ NS_METHOD nsWindow::Show(bool bState)
}
}
#ifdef NS_FUNCTION_TIMER
static bool firstShow = true;
if (firstShow &&
(mWindowType == eWindowType_toplevel ||
mWindowType == eWindowType_dialog ||
mWindowType == eWindowType_popup))
{
firstShow = false;
mozilla::FunctionTimer::LogMessage("@ First toplevel/dialog/popup showing");
}
#endif
bool syncInvalidate = false;
bool wasVisible = mIsVisible;
@ -4280,10 +4267,6 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
LRESULT CALLBACK nsWindow::WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
NS_TIME_FUNCTION_MIN_FMT(5.0, "%s (line %d) (hWnd: %p, msg: %p, wParam: %p, lParam: %p",
MOZ_FUNCTION_NAME, __LINE__, hWnd, msg,
wParam, lParam);
if (::GetWindowLongPtrW(hWnd, GWLP_ID) == eFakeTrackPointScrollableID) {
// This message was sent to the FAKETRACKPOINTSCROLLABLE.
if (msg == WM_HSCROLL) {

View File

@ -1,119 +0,0 @@
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// needed to get vsnprintf with glibc
#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "prenv.h"
#include "mozilla/FunctionTimer.h"
#ifdef _MSC_VER
#define vsnprintf _vsnprintf
#include <windows.h>
#include <mmsystem.h>
#endif
using namespace mozilla;
// This /must/ come before the call to InitTimers below,
// or its constructor will be called after we've already
// assigned the Now() value to it.
static TimeStamp sAppStart;
nsAutoPtr<FunctionTimerLog> FunctionTimer::sLog;
char *FunctionTimer::sBuf1 = nullptr;
char *FunctionTimer::sBuf2 = nullptr;
int FunctionTimer::sBufSize = FunctionTimer::InitTimers();
unsigned FunctionTimer::sDepth = 0;
int
FunctionTimer::InitTimers()
{
if (PR_GetEnv("MOZ_FT") == NULL)
return 0;
// ensure that this is initialized before us
TimeStamp::Startup();
sLog = new FunctionTimerLog(PR_GetEnv("MOZ_FT"));
sBuf1 = (char *) malloc(BUF_LOG_LENGTH);
sBuf2 = (char *) malloc(BUF_LOG_LENGTH);
sAppStart = TimeStamp::Now();
return BUF_LOG_LENGTH;
}
FunctionTimerLog::FunctionTimerLog(const char *fname)
: mLatest(sAppStart)
{
if (strcmp(fname, "stdout") == 0) {
mFile = stdout;
} else if (strcmp(fname, "stderr") == 0) {
mFile = stderr;
} else {
FILE *fp = fopen(fname, "wb");
if (!fp) {
NS_WARNING("FunctionTimerLog: Failed to open file specified, logging disabled!");
}
mFile = fp;
}
#ifdef _MSC_VER
// Get 1ms resolution on Windows
timeBeginPeriod(1);
#endif
}
FunctionTimerLog::~FunctionTimerLog()
{
if (mFile && mFile != stdout && mFile != stderr)
fclose((FILE*)mFile);
#ifdef _MSC_VER
timeEndPeriod(1);
#endif
}
void
FunctionTimerLog::LogString(const char *str)
{
if (mFile) {
mLatest = TimeStamp::Now();
TimeDuration elapsed = mLatest - sAppStart;
fprintf((FILE*)mFile, "[% 9.2f] %s\n", elapsed.ToSeconds() * 1000.0, str);
}
}
TimeDuration
FunctionTimerLog::LatestSinceStartup() const
{
return mLatest - sAppStart;
}
int
FunctionTimer::ft_vsnprintf(char *str, int maxlen, const char *fmt, va_list args)
{
return vsnprintf(str, maxlen, fmt, args);
}
int
FunctionTimer::ft_snprintf(char *str, int maxlen, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int rval = ft_vsnprintf(str, maxlen, fmt, ap);
va_end(ap);
return rval;
}

View File

@ -1,253 +0,0 @@
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_FunctionTimer_h
#define mozilla_FunctionTimer_h
#include <stdarg.h>
#include "mozilla/TimeStamp.h"
#include "nscore.h"
#include "nsAutoPtr.h"
#if defined(NS_FORCE_FUNCTION_TIMER) && !defined(NS_FUNCTION_TIMER)
#define NS_FUNCTION_TIMER
#endif
/*
* Shortcut macros
*/
#ifdef NS_FUNCTION_TIMER
#ifdef __GNUC__
#define MOZ_FUNCTION_NAME __PRETTY_FUNCTION__
#elif defined(_MSC_VER)
#define MOZ_FUNCTION_NAME __FUNCTION__
#else
#warning "Define a suitable MOZ_FUNCTION_NAME for this platform"
#define MOZ_FUNCTION_NAME ""
#endif
// Add a timer for this function, from this declaration until the
// function returns. The function name will be used as the
// log string, and both function entry and exit will be printed.
#define NS_TIME_FUNCTION \
mozilla::FunctionTimer ft__autogen("%s (line %d)", MOZ_FUNCTION_NAME, __LINE__)
// Add a timer for this block, but print only a) if the exit time is
// greater than the given number of milliseconds; or b) if the
// mark-to-mark time is greater than the given number of milliseconds.
// No function entry will be printed. If the value given is negative,
// no function entry or exit will ever be printed, but all marks will.
#define NS_TIME_FUNCTION_MIN(_ms) \
mozilla::FunctionTimer ft__autogen((_ms), "%s (line %d)", MOZ_FUNCTION_NAME, __LINE__)
// Add a timer for this block, but print only marks, not function
// entry and exit. The same as calling the above macro with a negative value.
#define NS_TIME_FUNCTION_MARK_ONLY \
mozilla::FunctionTimer ft__autogen((-1), "%s (line %d)", MOZ_FUNCTION_NAME, __LINE__)
// Add a timer for this block, using the printf-style format.
// Both function entry and exit will be printed.
#define NS_TIME_FUNCTION_FMT(...) \
mozilla::FunctionTimer ft__autogen(__VA_ARGS__)
// Add a timer for this block, using the given minimum number of
// milliseconds and the given printf-style format. No function entry
// will be printed.
#define NS_TIME_FUNCTION_MIN_FMT(_ms, ...) \
mozilla::FunctionTimer ft__autogen((_ms), __VA_ARGS__)
// Add a midway mark for the current timer; an existing timer must
// have already been created using one of the above macros. The
// string given by the printf-style format will be logged, as well as
// the total elapsed time since the creation of the timer, and the
// time since the last mark.
#define NS_TIME_FUNCTION_MARK(...) \
ft__autogen.Mark(__VA_ARGS__)
// A double value representing the time elapsed since NS_TIME_FUNCTION
// initialization, in ms.
#define NS_TIME_FUNCTION_ELAPSED \
ft__autogen.Elapsed()
// A double value representing the time elapsed since the last
// NS_TIME_FUNCTION_MARK, in ms.
#define NS_TIME_FUNCTION_ELAPSED_SINCE_MARK \
ft__autogen.ElapsedSinceMark
// A TimeDuration value representing the elapsed time between the
// last logged event of any sort and the app startup.
#define NS_TIME_FUNCTION_LATEST \
mozilla::FunctionTimer::LatestSinceStartup()
#else
#define NS_TIME_FUNCTION do { } while (0)
#define NS_TIME_FUNCTION_MIN(_ms) do { } while (0)
#define NS_TIME_FUNCTION_MARK_ONLY do { } while (0)
#define NS_TIME_FUNCTION_FMT(...) do { } while (0)
#define NS_TIME_FUNCTION_MIN_FMT(_ms, ...) do { } while (0)
#define NS_TIME_FUNCTION_MARK(...) do { } while (0)
#define NS_TIME_FUNCTION_ELAPSED (0)
#define NS_TIME_FUNCTION_ELAPSED_SINCE_MARK (0)
#define NS_TIME_FUNCTION_LATEST (mozilla::TimeDuration(0))
#endif
namespace mozilla {
class FunctionTimerLog
{
public:
FunctionTimerLog(const char *fname);
~FunctionTimerLog();
void LogString(const char *str);
TimeDuration LatestSinceStartup() const;
private:
void *mFile;
TimeStamp mLatest;
};
class FunctionTimer
{
static nsAutoPtr<FunctionTimerLog> sLog;
static char *sBuf1;
static char *sBuf2;
static int sBufSize;
static unsigned sDepth;
enum { BUF_LOG_LENGTH = 1024 };
public:
static int InitTimers();
static int ft_vsnprintf(char *str, int maxlen, const char *fmt, va_list args);
static int ft_snprintf(char *str, int maxlen, const char *fmt, ...);
static void LogMessage(const char *s, ...) {
va_list ap;
va_start(ap, s);
if (sLog) {
ft_vsnprintf(sBuf1, sBufSize, s, ap);
sLog->LogString(sBuf1);
}
va_end(ap);
}
private:
void Init(const char *s, va_list ap) {
if (mEnabled) {
TimeInit();
ft_vsnprintf(mString, BUF_LOG_LENGTH, s, ap);
ft_snprintf(sBuf1, sBufSize, "> (% 3d)%*s|%s%s", mDepth, mDepth, " ", mHasMinMs ? "?MINMS " : "", mString);
sLog->LogString(sBuf1);
}
}
public:
inline void TimeInit() {
if (mEnabled) {
mStart = TimeStamp::Now();
mLastMark = mStart;
}
}
inline double Elapsed() {
if (mEnabled)
return (TimeStamp::Now() - mStart).ToSeconds() * 1000.0;
return 0.0;
}
inline double ElapsedSinceMark() {
if (mEnabled)
return (TimeStamp::Now() - mLastMark).ToSeconds() * 1000.0;
return 0.0;
}
static inline TimeDuration LatestSinceStartup() {
return sLog ? sLog->LatestSinceStartup() : TimeDuration(0);
}
FunctionTimer(double minms, const char *s, ...)
: mMinMs(minms), mHasMinMs(true),
mEnabled(sLog && s && *s), mDepth(++sDepth)
{
va_list ap;
va_start(ap, s);
Init(s, ap);
va_end(ap);
}
FunctionTimer(const char *s, ...)
: mMinMs(0.0), mHasMinMs(false),
mEnabled(sLog && s && *s), mDepth(++sDepth)
{
va_list ap;
va_start(ap, s);
Init(s, ap);
va_end(ap);
}
void Mark(const char *s, ...)
{
va_list ap;
va_start(ap, s);
if (mEnabled) {
ft_vsnprintf(sBuf1, sBufSize, s, ap);
TimeStamp now(TimeStamp::Now());
double ms = (now - mStart).ToSeconds() * 1000.0;
double msl = (now - mLastMark).ToSeconds() * 1000.0;
mLastMark = now;
ft_snprintf(sBuf2, sBufSize, "* (% 3d)%*s|%s%9.2f ms (%9.2f ms total) - %s [%s]", mDepth, mDepth, " ",
(!mHasMinMs || mMinMs < 0.0 || msl > mMinMs) ? "<MINMS " : "", msl, ms, mString, sBuf1);
sLog->LogString(sBuf2);
}
va_end(ap);
}
~FunctionTimer() {
if (mEnabled) {
TimeStamp now(TimeStamp::Now());
double ms = (now - mStart).ToSeconds() * 1000.0;
double msl = (now - mLastMark).ToSeconds() * 1000.0;
ft_snprintf(sBuf1, sBufSize, "< (% 3d)%*s|%s%9.2f ms (%9.2f ms total) - %s", mDepth, mDepth, " ",
(!mHasMinMs || (mMinMs >= 0.0 && msl > mMinMs)) ? "" : "<MINMS ", msl, ms, mString);
sLog->LogString(sBuf1);
}
--sDepth;
}
TimeStamp mStart, mLastMark;
const double mMinMs;
char mString[BUF_LOG_LENGTH+1];
const bool mHasMinMs;
const bool mEnabled;
const unsigned mDepth;
};
} // namespace mozilla
#endif // mozilla_FunctionTimer_h

View File

@ -37,7 +37,6 @@ CPPSRCS = \
nsCycleCollector.cpp \
nsStackWalk.cpp \
nsMemoryReporterManager.cpp \
FunctionTimer.cpp \
ClearOnShutdown.cpp \
VisualEventTracer.cpp \
$(NULL)
@ -69,7 +68,6 @@ EXPORTS = \
EXPORTS_NAMESPACES = mozilla
EXPORTS_mozilla = \
FunctionTimer.h \
MapsMemoryReporter.h \
ClearOnShutdown.h \
StaticPtr.h \

View File

@ -182,7 +182,6 @@ StackWalkInitCriticalAddress()
#include <stdio.h>
#include <malloc.h>
#include "plstr.h"
#include "mozilla/FunctionTimer.h"
#include "nspr.h"
#include <imagehlp.h>
@ -684,8 +683,6 @@ EnsureSymInitialized()
if (gInitialized)
return gInitialized;
NS_TIME_FUNCTION;
if (!EnsureImageHlpInitialized())
return false;

View File

@ -99,7 +99,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **)
#include <locale.h>
#include "mozilla/Services.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Omnijar.h"
#include "mozilla/HangMonitor.h"
#include "mozilla/Telemetry.h"
@ -313,25 +312,17 @@ NS_InitXPCOM2(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider)
{
NS_TIME_FUNCTION;
nsresult rv = NS_OK;
// We are not shutting down
gXPCOMShuttingDown = false;
NS_TIME_FUNCTION_MARK("Next: AvailableMemoryTracker Init()");
// Initialize the available memory tracker before other threads have had a
// chance to start up, because the initialization is not thread-safe.
mozilla::AvailableMemoryTracker::Init();
NS_TIME_FUNCTION_MARK("Next: log init");
NS_LogInit();
NS_TIME_FUNCTION_MARK("Next: IPC init");
// Set up chromium libs
NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
@ -358,21 +349,15 @@ NS_InitXPCOM2(nsIServiceManager* *result,
sIOThread = ioThread.release();
}
NS_TIME_FUNCTION_MARK("Next: thread manager init");
// Establish the main thread here.
rv = nsThreadManager::get()->Init();
if (NS_FAILED(rv)) return rv;
NS_TIME_FUNCTION_MARK("Next: timer startup");
// Set up the timer globals/timer thread
rv = nsTimerImpl::Startup();
NS_ENSURE_SUCCESS(rv, rv);
#ifndef ANDROID
NS_TIME_FUNCTION_MARK("Next: setlocale");
// If the locale hasn't already been setup by our embedder,
// get us out of the "C" locale and into the system
if (strcmp(setlocale(LC_ALL, NULL), "C") == 0)
@ -380,13 +365,9 @@ NS_InitXPCOM2(nsIServiceManager* *result,
#endif
#if defined(XP_UNIX) || defined(XP_OS2)
NS_TIME_FUNCTION_MARK("Next: startup native charset utils");
NS_StartupNativeCharsetUtils();
#endif
NS_TIME_FUNCTION_MARK("Next: startup local file");
NS_StartupLocalFile();
StartupSpecialSystemDirectory();
@ -419,16 +400,12 @@ NS_InitXPCOM2(nsIServiceManager* *result,
xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
}
NS_TIME_FUNCTION_MARK("Next: Omnijar init");
if (!mozilla::Omnijar::IsInitialized()) {
mozilla::Omnijar::Init();
}
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
NS_TIME_FUNCTION_MARK("Next: IPC command line init");
#ifdef OS_WIN
CommandLine::Init(0, nullptr);
#else
@ -452,8 +429,6 @@ NS_InitXPCOM2(nsIServiceManager* *result,
NS_ASSERTION(nsComponentManagerImpl::gComponentManager == NULL, "CompMgr not null at init");
NS_TIME_FUNCTION_MARK("Next: component manager init");
// Create the Component/Service Manager
nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
NS_ADDREF(nsComponentManagerImpl::gComponentManager);
@ -472,16 +447,10 @@ NS_InitXPCOM2(nsIServiceManager* *result,
NS_ADDREF(*result = nsComponentManagerImpl::gComponentManager);
}
NS_TIME_FUNCTION_MARK("Next: cycle collector startup");
NS_TIME_FUNCTION_MARK("Next: interface info manager init");
// The iimanager constructor searches and registers XPT files.
// (We trigger the singleton's lazy construction here to make that happen.)
(void) xptiInterfaceInfoManager::GetSingleton();
NS_TIME_FUNCTION_MARK("Next: register category providers");
// After autoreg, but before we actually instantiate any components,
// add any services listed in the "xpcom-directory-providers" category
// to the directory service.
@ -490,8 +459,6 @@ NS_InitXPCOM2(nsIServiceManager* *result,
mozilla::scache::StartupCache::GetSingleton();
mozilla::AvailableMemoryTracker::Activate();
NS_TIME_FUNCTION_MARK("Next: create services from category");
// Notify observers of xpcom autoregistration start
NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,
nullptr,

View File

@ -30,7 +30,6 @@
#include "mozilla/Services.h"
#include "ManifestParser.h"
#include "mozilla/FunctionTimer.h"
using namespace mozilla;
class nsIComponentLoaderManager;
@ -732,9 +731,6 @@ NS_CreateServicesFromCategory(const char *category,
nsISupports *origin,
const char *observerTopic)
{
NS_TIME_FUNCTION_FMT("NS_CreateServicesFromCategory: %s (%s)",
category, observerTopic ? observerTopic : "(no topic)");
nsresult rv;
nsCOMPtr<nsICategoryManager> categoryManager =
@ -767,8 +763,6 @@ NS_CreateServicesFromCategory(const char *category,
getter_Copies(contractID));
if (NS_FAILED(rv))
continue;
NS_TIME_FUNCTION_MARK("getservice: %s", contractID.get());
nsCOMPtr<nsISupports> instance = do_GetService(contractID);
if (!instance) {
@ -778,8 +772,6 @@ NS_CreateServicesFromCategory(const char *category,
}
if (observerTopic) {
NS_TIME_FUNCTION_MARK("observe: %s", contractID.get());
// try an observer, if it implements it.
nsCOMPtr<nsIObserver> observer = do_QueryInterface(instance);
if (observer)

View File

@ -57,7 +57,6 @@
#include "private/pprthred.h"
#include "nsTArray.h"
#include "prio.h"
#include "mozilla/FunctionTimer.h"
#include "ManifestParser.h"
#include "mozilla/Services.h"
@ -130,20 +129,6 @@ NS_DEFINE_CID(kCategoryManagerCID, NS_CATEGORYMANAGER_CID);
#define UID_STRING_LENGTH 39
#ifdef NS_FUNCTION_TIMER
#define COMPMGR_TIME_FUNCTION_CID(cid) \
char cid_buf__[NSID_LENGTH] = { '\0' }; \
cid.ToProvidedString(cid_buf__); \
NS_TIME_FUNCTION_MIN_FMT(5, "%s (line %d) (cid: %s)", MOZ_FUNCTION_NAME, \
__LINE__, cid_buf__)
#define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) \
NS_TIME_FUNCTION_MIN_FMT(5, "%s (line %d) (contractid: %s)", MOZ_FUNCTION_NAME, \
__LINE__, (cid))
#else
#define COMPMGR_TIME_FUNCTION_CID(cid) do {} while (0)
#define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) do {} while (0)
#endif
nsresult
nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) const
{
@ -294,8 +279,6 @@ nsComponentManagerImpl::InitializeModuleLocations()
nsresult nsComponentManagerImpl::Init()
{
NS_TIME_FUNCTION;
PR_ASSERT(NOT_INITIALIZED == mStatus);
if (nsComponentManagerLog == nullptr)
@ -304,7 +287,6 @@ nsresult nsComponentManagerImpl::Init()
}
// Initialize our arena
NS_TIME_FUNCTION_MARK("Next: init component manager arena");
PL_INIT_ARENA_POOL(&mArena, "ComponentManagerArena", NS_CM_BLOCK_SIZE);
mFactories.Init(CONTRACTID_HASHTABLE_INITIAL_SIZE);
@ -337,7 +319,6 @@ nsresult nsComponentManagerImpl::Init()
PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
("nsComponentManager: Initialized."));
NS_TIME_FUNCTION_MARK("Next: init native module loader");
nsresult rv = mNativeModuleLoader.Init();
if (NS_FAILED(rv))
return rv;
@ -720,8 +701,6 @@ nsComponentManagerImpl::KnownModule::Description() const
nsresult nsComponentManagerImpl::Shutdown(void)
{
NS_TIME_FUNCTION;
PR_ASSERT(NORMAL == mStatus);
mStatus = SHUTDOWN_IN_PROGRESS;
@ -898,8 +877,6 @@ nsComponentManagerImpl::CreateInstance(const nsCID &aClass,
const nsIID &aIID,
void **aResult)
{
COMPMGR_TIME_FUNCTION_CID(aClass);
// test this first, since there's no point in creating a component during
// shutdown -- whether it's available or not would depend on the order it
// occurs in the list
@ -982,8 +959,6 @@ nsComponentManagerImpl::CreateInstanceByContractID(const char *aContractID,
const nsIID &aIID,
void **aResult)
{
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
NS_ENSURE_ARG_POINTER(aContractID);
// test this first, since there's no point in creating a component during
@ -1182,9 +1157,6 @@ nsComponentManagerImpl::GetService(const nsCID& aClass,
return supports->QueryInterface(aIID, result);
}
// We only care about time when we create the service.
COMPMGR_TIME_FUNCTION_CID(aClass);
PRThread* currentPRThread = PR_GetCurrentThread();
NS_ASSERTION(currentPRThread, "This should never be null!");
@ -1265,8 +1237,6 @@ nsComponentManagerImpl::IsServiceInstantiated(const nsCID & aClass,
const nsIID& aIID,
bool *result)
{
COMPMGR_TIME_FUNCTION_CID(aClass);
// Now we want to get the service if we already got it. If not, we don't want
// to create an instance of it. mmh!
@ -1306,8 +1276,6 @@ NS_IMETHODIMP nsComponentManagerImpl::IsServiceInstantiatedByContractID(const ch
const nsIID& aIID,
bool *result)
{
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
// Now we want to get the service if we already got it. If not, we don't want
// to create an instance of it. mmh!
@ -1377,9 +1345,6 @@ nsComponentManagerImpl::GetServiceByContractID(const char* aContractID,
return serviceObject->QueryInterface(aIID, result);
}
// We only care about time when we create the service.
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
PRThread* currentPRThread = PR_GetCurrentThread();
NS_ASSERTION(currentPRThread, "This should never be null!");
@ -1600,8 +1565,6 @@ EnumerateCIDHelper(const nsID& id, nsFactoryEntry* entry, void* closure)
NS_IMETHODIMP
nsComponentManagerImpl::EnumerateCIDs(nsISimpleEnumerator **aEnumerator)
{
NS_TIME_FUNCTION;
nsCOMArray<nsISupports> array;
mFactories.EnumerateRead(EnumerateCIDHelper, &array);
@ -1619,8 +1582,6 @@ EnumerateContractsHelper(const nsACString& contract, nsFactoryEntry* entry, void
NS_IMETHODIMP
nsComponentManagerImpl::EnumerateContractIDs(nsISimpleEnumerator **aEnumerator)
{
NS_TIME_FUNCTION;
nsTArray<nsCString>* array = new nsTArray<nsCString>;
mContractIDs.EnumerateRead(EnumerateContractsHelper, array);

View File

@ -17,12 +17,10 @@
#include "nscore.h"
#include "private/pprio.h"
#include "mozilla/FileUtils.h"
#include "mozilla/FunctionTimer.h"
bool
mozilla::fallocate(PRFileDesc *aFD, int64_t aLength)
{
NS_TIME_FUNCTION;
#if defined(HAVE_POSIX_FALLOCATE)
return posix_fallocate(PR_FileDesc2NativeHandle(aFD), 0, aLength) == 0;
#elif defined(XP_WIN)

View File

@ -10,7 +10,6 @@
#include "nsString.h"
#include "nsISupportsArray.h"
#include "nsArrayEnumerator.h"
#include "mozilla/FunctionTimer.h"
#include "nsDirectoryService.h"
#include "mozilla/FileUtils.h"
#include "nsIMemoryReporter.h"
@ -66,8 +65,6 @@ xptiInterfaceInfoManager*
xptiInterfaceInfoManager::GetSingleton()
{
if (!gInterfaceInfoManager) {
NS_TIME_FUNCTION;
gInterfaceInfoManager = new xptiInterfaceInfoManager();
NS_ADDREF(gInterfaceInfoManager);
}
@ -335,8 +332,6 @@ NS_IMETHODIMP xptiInterfaceInfoManager::EnumerateInterfacesWhoseNamesStartWith(c
/* void autoRegisterInterfaces (); */
NS_IMETHODIMP xptiInterfaceInfoManager::AutoRegisterInterfaces()
{
NS_TIME_FUNCTION;
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -30,7 +30,6 @@
# include "nsXULAppAPI.h"
#endif
#include "mozilla/FunctionTimer.h"
#if defined(NS_FUNCTION_TIMER) && defined(_MSC_VER)
#include "nsTimerImpl.h"
#include "nsStackWalk.h"
@ -604,17 +603,6 @@ nsThread::ProcessNextEvent(bool mayWait, bool *result)
nsCOMPtr<nsIRunnable> event;
mEvents.GetEvent(mayWait && !ShuttingDown(), getter_AddRefs(event));
#ifdef NS_FUNCTION_TIMER
char message[1024] = {'\0'};
if (MAIN_THREAD == mIsMainThread) {
mozilla::FunctionTimer::ft_snprintf(message, sizeof(message),
"@ Main Thread Event %p", (void*)event.get());
}
// If message is empty, it means that we're not on the main thread, and
// FunctionTimer won't time this function.
NS_TIME_FUNCTION_MIN_FMT(5.0, message);
#endif
*result = (event.get() != nullptr);
if (event) {