Bug 718440. Add more sampler labels to various places. r=bgirard
☠☠ backed out by ebc05c90d282 ☠ ☠
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 17 Jan 2012 15:33:04 -0500
changeset 84743 88733ce1bef30577af5977197fcc1eb422ceaf46
parent 84742 e312a306ed0150aa9541e875b6628233eddd0695
child 84744 3706737bdf487db9a1911db819eefd008e2e695b
push id4980
push userjmuizelaar@mozilla.com
push dateTue, 17 Jan 2012 21:47:35 +0000
treeherdermozilla-inbound@88733ce1bef3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs718440, 710068
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 718440. Add more sampler labels to various places. r=bgirard This shows the problems described in bug 710068.
content/base/src/nsXMLHttpRequest.cpp
content/base/src/nsXMLHttpRequest.h
gfx/gl/GLContextProviderCGL.mm
gfx/layers/opengl/LayerManagerOGL.cpp
image/src/imgFrame.cpp
layout/base/nsLayoutUtils.cpp
layout/generic/nsObjectFrame.cpp
netwerk/base/src/nsInputStreamPump.cpp
netwerk/base/src/nsStreamLoader.cpp
netwerk/protocol/http/nsHttpChannel.cpp
parser/html/nsHtml5TreeOpExecutor.cpp
storage/src/mozStorageConnection.cpp
storage/src/mozStorageStatement.cpp
toolkit/components/places/nsAnnotationService.cpp
toolkit/components/places/nsNavBookmarks.cpp
tools/profiler/sampler.h
tools/profiler/sps/sps_sampler.h
view/src/nsViewManager.cpp
widget/cocoa/nsAppShell.mm
widget/cocoa/nsChildView.mm
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -2012,16 +2012,17 @@ nsXMLHttpRequest::OnStartRequest(nsIRequ
 
   return NS_OK;
 }
 
 /* void onStopRequest (in nsIRequest request, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
 NS_IMETHODIMP
 nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status)
 {
+  SAMPLE_LABEL("content", "nsXMLHttpRequest::OnStopRequest");
   if (!IsSameOrBaseChannel(request, mChannel)) {
     return NS_OK;
   }
 
   nsresult rv = NS_OK;
 
   // If we're loading a multipart stream of XML documents, we'll get
   // an OnStopRequest() for the last part in the stream, and then
--- a/content/base/src/nsXMLHttpRequest.h
+++ b/content/base/src/nsXMLHttpRequest.h
@@ -60,16 +60,17 @@
 #include "nsIJSNativeInitializer.h"
 #include "nsIDOMLSProgressEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsITimer.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsDOMProgressEvent.h"
 #include "nsDOMEventTargetWrapperCache.h"
 #include "nsContentUtils.h"
+#include "sampler.h"
 
 class nsILoadGroup;
 class AsyncVerifyRedirectCallbackForwarder;
 class nsIUnicodeDecoder;
 
 class nsXHREventTarget : public nsDOMEventTargetWrapperCache,
                          public nsIXMLHttpRequestEventTarget
 {
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -42,16 +42,17 @@
 #include <AppKit/NSOpenGL.h>
 #include "gfxASurface.h"
 #include "gfxImageSurface.h"
 #include "gfxQuartzSurface.h"
 #include "gfxPlatform.h"
 #include "gfxFailure.h"
 #include "prenv.h"
 #include "mozilla/Preferences.h"
+#include "sampler.h"
 
 namespace mozilla {
 namespace gl {
 
 static bool gUseDoubleBufferedWindows = true;
 
 class CGLLibrary
 {
@@ -190,16 +191,17 @@ public:
 
     bool SupportsRobustness()
     {
         return false;
     }
 
     bool SwapBuffers()
     {
+      SAMPLE_LABEL("GLContext", "SwapBuffers");
       [mContext flushBuffer];
       return true;
     }
 
     bool BindTex2DOffscreen(GLContext *aOffscreen);
     void UnbindTex2DOffscreen(GLContext *aOffscreen);
     bool ResizeOffscreen(const gfxIntSize& aNewSize);
 
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -59,16 +59,18 @@
 #include "GLContext.h"
 #include "GLContextProvider.h"
 
 #include "nsIServiceManager.h"
 #include "nsIConsoleService.h"
 
 #include "gfxCrashReporterUtils.h"
 
+#include "sampler.h"
+
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gl;
 
 #ifdef CHECK_CURRENT_PROGRAM
 int LayerManagerOGLProgram::sCurrentProgramKey = 0;
 #endif
@@ -753,16 +755,17 @@ LayerManagerOGL::BindAndDrawQuadWithText
     }
     mGLContext->fDisableVertexAttribArray(texCoordAttribIndex);
   }
 }
 
 void
 LayerManagerOGL::Render()
 {
+  SAMPLE_LABEL("LayerManagerOGL", "Render");
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return;
   }
 
   nsIntRect rect;
   mWidget->GetClientBounds(rect);
   WorldTransformRect(rect);
--- a/image/src/imgFrame.cpp
+++ b/image/src/imgFrame.cpp
@@ -44,16 +44,17 @@
 #include "prenv.h"
 
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 
 static bool gDisableOptimize = false;
 
 #include "cairo.h"
+#include "sampler.h"
 
 #if defined(XP_WIN)
 
 #include "gfxWindowsPlatform.h"
 
 /* Whether to use the windows surface; only for desktop win32 */
 #define USE_WIN_SURFACE 1
 
@@ -430,16 +431,17 @@ imgFrame::SurfaceForDrawing(bool        
                                                   availableSize),
                            mFormat);
 }
 
 void imgFrame::Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter,
                     const gfxMatrix &aUserSpaceToImageSpace, const gfxRect& aFill,
                     const nsIntMargin &aPadding, const nsIntRect &aSubimage)
 {
+  SAMPLE_LABEL("image", "imgFrame::Draw");
   NS_ASSERTION(!aFill.IsEmpty(), "zero dest size --- fix caller");
   NS_ASSERTION(!aSubimage.IsEmpty(), "zero source size --- fix caller");
   NS_ASSERTION(!mPalettedImageData, "Directly drawing a paletted image!");
 
   bool doPadding = aPadding != nsIntMargin(0,0,0,0);
   bool doPartialDecode = !ImageComplete();
 
   if (mSinglePixel && !doPadding && !doPartialDecode) {
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -111,16 +111,18 @@
 #include "nsSVGOuterSVGFrame.h"
 
 #include "mozilla/Preferences.h"
 
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
 
+#include "sampler.h"
+
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::dom;
 
 #ifdef DEBUG
 // TODO: remove, see bug 598468.
 bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 #endif // DEBUG
@@ -3625,16 +3627,17 @@ nsLayoutUtils::DrawBackgroundImage(nsRen
                                    const nsIntSize&    aImageSize,
                                    GraphicsFilter      aGraphicsFilter,
                                    const nsRect&       aDest,
                                    const nsRect&       aFill,
                                    const nsPoint&      aAnchor,
                                    const nsRect&       aDirty,
                                    PRUint32            aImageFlags)
 {
+  SAMPLE_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage");
   return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter,
                            aDest, aFill, aAnchor, aDirty,
                            aImageSize, aImageFlags);
 }
 
 /* static */ nsresult
 nsLayoutUtils::DrawImage(nsRenderingContext* aRenderingContext,
                          imgIContainer*       aImage,
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -106,16 +106,17 @@
 #include "nsDOMClassInfo.h"
 #include "nsFocusManager.h"
 #include "nsLayoutUtils.h"
 #include "nsFrameManager.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIObserverService.h"
 #include "nsIScrollableFrame.h"
 #include "mozilla/Preferences.h"
+#include "sampler.h"
 
 // headers for plugin scriptability
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptContext.h"
 #include "nsIXPConnect.h"
 #include "nsIXPCScriptable.h"
 #include "nsIClassInfo.h"
 #include "nsIDOMClientRect.h"
@@ -693,16 +694,17 @@ nsObjectFrame::ReflowCallbackCanceled()
   mReflowCallbackPosted = false;
 }
 
 nsresult
 nsObjectFrame::InstantiatePlugin(nsPluginHost* aPluginHost, 
                                  const char* aMimeType,
                                  nsIURI* aURI)
 {
+  SAMPLE_LABEL("nsObjectFrame", "InstantiatePlugin");
   NS_ASSERTION(mPreventInstantiation,
                "Instantiation should be prevented here!");
 
   // If you add early return(s), be sure to balance this call to
   // appShell->SuspendNative() with additional call(s) to
   // appShell->ReturnNative().
   nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
   if (appShell) {
@@ -2145,16 +2147,17 @@ nsObjectFrame::PrepareInstanceOwner()
 
   // Note, |this| may very well be gone after this call.
   return mInstanceOwner->Init(PresContext(), this, GetContent());
 }
 
 nsresult
 nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener)
 {
+  SAMPLE_LABEL("plugin", "nsObjectFrame::Instantiate");
   if (mPreventInstantiation) {
     return NS_OK;
   }
   
   // Note: If PrepareInstanceOwner() returns an error, |this| may very
   // well be deleted already.
   nsresult rv = PrepareInstanceOwner();
   NS_ENSURE_SUCCESS(rv, rv);
@@ -2195,16 +2198,17 @@ nsObjectFrame::Instantiate(nsIChannel* a
 #endif
 
   return rv;
 }
 
 nsresult
 nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
 {
+  SAMPLE_LABEL("plugin", "nsObjectFrame::Instantiate");
   PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
          ("nsObjectFrame::Instantiate(%s) called on frame %p\n", aMimeType,
           this));
 
   if (mPreventInstantiation) {
     return NS_OK;
   }
 
@@ -2343,16 +2347,17 @@ DoDelayedStop(nsPluginInstanceOwner *aIn
     return true;
   }
   return false;
 }
 
 static void
 DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
 {
+  SAMPLE_LABEL("plugin", "DoStopPlugin");
   nsRefPtr<nsNPAPIPluginInstance> inst;
   aInstanceOwner->GetInstance(getter_AddRefs(inst));
   if (inst) {
     NPWindow *win;
     aInstanceOwner->GetWindow(win);
     nsPluginNativeWindow *window = (nsPluginNativeWindow *)win;
     nsRefPtr<nsNPAPIPluginInstance> nullinst;
 
@@ -2385,16 +2390,17 @@ NS_IMETHODIMP
 nsStopPluginRunnable::Notify(nsITimer *aTimer)
 {
   return Run();
 }
 
 NS_IMETHODIMP
 nsStopPluginRunnable::Run()
 {
+  SAMPLE_LABEL("plugin", "nsStopPluginRunnable::Run");
   // InitWithCallback calls Release before AddRef so we need to hold a
   // strong ref on 'this' since we fall through to this scope if it fails.
   nsCOMPtr<nsITimerCallback> kungFuDeathGrip = this;
   nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
   if (appShell) {
     PRUint32 currentLevel = 0;
     appShell->GetEventloopNestingLevel(&currentLevel);
     if (currentLevel > mInstanceOwner->GetLastEventloopNestingLevel()) {
--- a/netwerk/base/src/nsInputStreamPump.cpp
+++ b/netwerk/base/src/nsInputStreamPump.cpp
@@ -378,17 +378,17 @@ nsInputStreamPump::AsyncRead(nsIStreamLi
 // nsInputStreamPump::nsIInputStreamCallback implementation
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream)
 {
     LOG(("nsInputStreamPump::OnInputStreamReady [this=%x]\n", this));
 
-    SAMPLE_LABEL("Input", "OnInputStreamReady");
+    SAMPLE_LABEL("Input", "nsInputStreamPump::OnInputStreamReady");
     // this function has been called from a PLEvent, so we can safely call
     // any listener or progress sink methods directly from here.
 
     for (;;) {
         if (mSuspendCount || mState == STATE_IDLE) {
             mWaiting = false;
             break;
         }
@@ -421,16 +421,17 @@ nsInputStreamPump::OnInputStreamReady(ns
         mState = nextState;
     }
     return NS_OK;
 }
 
 PRUint32
 nsInputStreamPump::OnStateStart()
 {
+    SAMPLE_LABEL("nsInputStreamPump", "OnStateStart");
     LOG(("  OnStateStart [this=%x]\n", this));
 
     nsresult rv;
 
     // need to check the reason why the stream is ready.  this is required
     // so our listener can check our status from OnStartRequest.
     // XXX async streams should have a GetStatus method!
     if (NS_SUCCEEDED(mStatus)) {
@@ -448,16 +449,17 @@ nsInputStreamPump::OnStateStart()
         mStatus = rv;
 
     return NS_SUCCEEDED(mStatus) ? STATE_TRANSFER : STATE_STOP;
 }
 
 PRUint32
 nsInputStreamPump::OnStateTransfer()
 {
+    SAMPLE_LABEL("Input", "nsInputStreamPump::OnStateTransfer");
     LOG(("  OnStateTransfer [this=%x]\n", this));
 
     // if canceled, go directly to STATE_STOP...
     if (NS_FAILED(mStatus))
         return STATE_STOP;
 
     nsresult rv;
 
@@ -557,16 +559,17 @@ nsInputStreamPump::OnStateTransfer()
         }
     }
     return STATE_STOP;
 }
 
 PRUint32
 nsInputStreamPump::OnStateStop()
 {
+    SAMPLE_LABEL("Input", "nsInputStreamPump::OnStateTransfer");
     LOG(("  OnStateStop [this=%x status=%x]\n", this, mStatus));
 
     // if an error occurred, we must be sure to pass the error onto the async
     // stream.  in some cases, this is redundant, but since close is idempotent,
     // this is OK.  otherwise, be sure to honor the "close-when-done" option.
 
     if (NS_FAILED(mStatus))
         mAsyncStream->CloseWithStatus(mStatus);
--- a/netwerk/base/src/nsStreamLoader.cpp
+++ b/netwerk/base/src/nsStreamLoader.cpp
@@ -34,16 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsStreamLoader.h"
 #include "nsIInputStream.h"
 #include "nsIChannel.h"
 #include "nsNetError.h"
+#include "sampler.h"
 
 nsStreamLoader::nsStreamLoader()
   : mData(nsnull),
     mAllocated(0),
     mLength(0)
 {
 }
 
@@ -113,16 +114,17 @@ nsStreamLoader::OnStartRequest(nsIReques
   mContext = ctxt;
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
                               nsresult aStatus)
 {
+  SAMPLE_LABEL("network", "nsStreamLoader::OnStopRequest");
   if (mObserver) {
     // provide nsIStreamLoader::request during call to OnStreamComplete
     mRequest = request;
     nsresult rv = mObserver->OnStreamComplete(this, mContext, aStatus,
                                               mLength, mData);
     if (rv == NS_SUCCESS_ADOPTED_DATA) {
       // the observer now owns the data buffer, and the loader must
       // not deallocate it
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -64,16 +64,17 @@
 #include "nsICacheService.h"
 #include "nsDNSPrefetch.h"
 #include "nsChannelClassifier.h"
 #include "nsIRedirectResultListener.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Telemetry.h"
 #include "nsDOMError.h"
 #include "nsAlgorithm.h"
+#include "sampler.h"
 
 using namespace mozilla;
 
 // Device IDs for various cache types
 const char kDiskDeviceID[] = "disk";
 const char kMemoryDeviceID[] = "memory";
 const char kOfflineDeviceID[] = "offline";
 
@@ -4208,16 +4209,17 @@ nsHttpChannel::ContinueOnStartRequest3(n
         return NS_OK;
 
     return CallOnStartRequest();
 }
 
 NS_IMETHODIMP
 nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status)
 {
+    SAMPLE_LABEL("network", "nsHttpChannel::OnStopRequest");
     LOG(("nsHttpChannel::OnStopRequest [this=%p request=%p status=%x]\n",
         this, request, status));
 
     if (mTimingEnabled && request == mCachePump) {
         mCacheReadEnd = mozilla::TimeStamp::Now();
     }
 
      // allow content to be cached if it was loaded successfully (bug #482935)
@@ -4383,16 +4385,17 @@ nsHttpChannel::OnStopRequest(nsIRequest 
 // nsHttpChannel::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
                                nsIInputStream *input,
                                PRUint32 offset, PRUint32 count)
 {
+    SAMPLE_LABEL("network", "nsHttpChannel::OnDataAvailable");
     LOG(("nsHttpChannel::OnDataAvailable [this=%p request=%p offset=%u count=%u]\n",
         this, request, offset, count));
 
     // don't send out OnDataAvailable notifications if we've been canceled.
     if (mCanceled)
         return mStatus;
 
     NS_ASSERTION(mResponseHead, "No response head in ODA!!");
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -54,16 +54,17 @@
 #include "mozAutoDocUpdate.h"
 #include "nsNetUtil.h"
 #include "nsHtml5Parser.h"
 #include "nsHtml5Tokenizer.h"
 #include "nsHtml5TreeBuilder.h"
 #include "nsHtml5StreamParser.h"
 #include "mozilla/css/Loader.h"
 #include "mozilla/Util.h" // DebugOnly
+#include "sampler.h"
 
 using namespace mozilla;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsHtml5TreeOpExecutor)
 
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHtml5TreeOpExecutor)
   NS_INTERFACE_TABLE_INHERITED1(nsHtml5TreeOpExecutor, 
                                 nsIContentSink)
@@ -421,16 +422,17 @@ class nsHtml5FlushLoopGuard
 };
 
 /**
  * The purpose of the loop here is to avoid returning to the main event loop
  */
 void
 nsHtml5TreeOpExecutor::RunFlushLoop()
 {
+  SAMPLE_LABEL("html5", "RunFlushLoop");
   if (mRunFlushLoopOnStack) {
     // There's already a RunFlushLoop() on the call stack.
     return;
   }
   
   nsHtml5FlushLoopGuard guard(this); // this is also the self-kungfu!
   
   nsCOMPtr<nsIParser> parserKungFuDeathGrip(mParser);
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -66,16 +66,17 @@
 #include "mozStorageAsyncStatement.h"
 #include "mozStorageArgValueArray.h"
 #include "mozStoragePrivateHelpers.h"
 #include "mozStorageStatementData.h"
 #include "StorageBaseStatementInternal.h"
 #include "SQLCollations.h"
 #include "FileSystemModule.h"
 #include "mozStorageHelper.h"
+#include "sampler.h"
 
 #include "prlog.h"
 #include "prprf.h"
 
 #define MIN_AVAILABLE_BYTES_PER_CHUNKED_GROWTH 524288000 // 500 MiB
 
 // Maximum size of the pages cache per connection.  If the default cache_size
 // value evaluates to a larger size, it will be reduced to save memory.
@@ -603,16 +604,17 @@ Connection::getAsyncExecutionTarget()
   return mAsyncExecutionThread;
 }
 
 nsresult
 Connection::initialize(nsIFile *aDatabaseFile,
                        const char* aVFSName)
 {
   NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
+  SAMPLE_LABEL("storage", "Connection::initialize");
 
   int srv;
   nsresult rv;
 
   mDatabaseFile = aDatabaseFile;
 
   if (aDatabaseFile) {
     nsAutoString path;
@@ -1023,16 +1025,17 @@ Connection::AsyncClose(mozIStorageComple
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Connection::Clone(bool aReadOnly,
                   mozIStorageConnection **_connection)
 {
+  SAMPLE_LABEL("storage", "Connection::Clone");
   if (!mDBConn)
     return NS_ERROR_NOT_INITIALIZED;
   if (!mDatabaseFile)
     return NS_ERROR_UNEXPECTED;
 
   int flags = mFlags;
   if (aReadOnly) {
     // Turn off SQLITE_OPEN_READWRITE, and set SQLITE_OPEN_READONLY.
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -53,16 +53,17 @@
 
 #include "mozStorageBindingParams.h"
 #include "mozStorageConnection.h"
 #include "mozStorageStatementJSHelper.h"
 #include "mozStoragePrivateHelpers.h"
 #include "mozStorageStatementParams.h"
 #include "mozStorageStatementRow.h"
 #include "mozStorageStatement.h"
+#include "sampler.h"
 
 #include "prlog.h"
 
 #include "mozilla/FunctionTimer.h"
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gStorageLog;
 #endif
@@ -582,16 +583,17 @@ Statement::Execute()
   nsresult rv2 = Reset();
 
   return NS_FAILED(rv) ? rv : rv2;
 }
 
 NS_IMETHODIMP
 Statement::ExecuteStep(bool *_moreResults)
 {
+  SAMPLE_LABEL("storage", "Statement::ExecuteStep");
   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) {
--- a/toolkit/components/places/nsAnnotationService.cpp
+++ b/toolkit/components/places/nsAnnotationService.cpp
@@ -49,16 +49,18 @@
 #include "Helpers.h"
 
 #include "nsNetUtil.h"
 #include "nsIVariant.h"
 #include "nsString.h"
 #include "nsVariant.h"
 #include "mozilla/storage.h"
 
+#include "sampler.h"
+
 using namespace mozilla;
 
 #define ENSURE_ANNO_TYPE(_type, _statement)                                    \
   PR_BEGIN_MACRO                                                               \
   PRInt32 type = _statement->AsInt32(kAnnoIndex_Type);                         \
   NS_ENSURE_TRUE(type == nsIAnnotationService::_type, NS_ERROR_INVALID_ARG);   \
   PR_END_MACRO
 
@@ -231,16 +233,17 @@ nsAnnotationService::SetPageAnnotation(n
 
 NS_IMETHODIMP
 nsAnnotationService::SetItemAnnotation(PRInt64 aItemId,
                                        const nsACString& aName,
                                        nsIVariant* aValue,
                                        PRInt32 aFlags,
                                        PRUint16 aExpiration)
 {
+  SAMPLE_LABEL("AnnotationService", "SetItemAnnotation");
   NS_ENSURE_ARG_MIN(aItemId, 1);
   NS_ENSURE_ARG(aValue);
 
   if (aExpiration == EXPIRE_WITH_HISTORY)
     return NS_ERROR_INVALID_ARG;
 
   PRUint16 dataType;
   nsresult rv = aValue->GetDataType(&dataType);
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -52,16 +52,18 @@
 #include "nsUnicharUtils.h"
 #include "nsPrintfCString.h"
 #include "nsIUUIDGenerator.h"
 #include "prprf.h"
 #include "mozilla/storage.h"
 #include "mozilla/FunctionTimer.h"
 #include "mozilla/Util.h"
 
+#include "sampler.h"
+
 #define BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_SIZE 64
 #define RECENT_BOOKMARKS_INITIAL_CACHE_SIZE 10
 // Threashold to expire old bookmarks if the initial cache size is exceeded.
 #define RECENT_BOOKMARKS_THRESHOLD PRTime((PRInt64)1 * 60 * PR_USEC_PER_SEC)
 
 #define BEGIN_CRITICAL_BOOKMARK_CACHE_SECTION(_itemId_) \
   mUncachableBookmarks.PutEntry(_itemId_); \
   mRecentBookmarksCache.RemoveEntry(_itemId_)
@@ -676,16 +678,17 @@ nsNavBookmarks::InsertBookmark(PRInt64 a
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::RemoveItem(PRInt64 aItemId)
 {
+  SAMPLE_LABEL("bookmarks", "RemoveItem");
   NS_ENSURE_ARG(aItemId != mRoot);
 
   BookmarkData bookmark;
   nsresult rv = FetchItemInfo(aItemId, bookmark);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
                    nsINavBookmarkObserver,
@@ -1127,16 +1130,17 @@ nsNavBookmarks::GetDescendantChildren(PR
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
 {
+  SAMPLE_LABEL("bookmarks", "RemoveFolderChilder");
   NS_ENSURE_ARG_MIN(aFolderId, 1);
 
   BookmarkData folder;
   nsresult rv = FetchItemInfo(aFolderId, folder);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_ARG(folder.type == TYPE_FOLDER);
 
   // Fill folder children array recursively.
@@ -2746,16 +2750,17 @@ nsNavBookmarks::EnsureKeywordsHash() {
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::RunInBatchMode(nsINavHistoryBatchCallback* aCallback,
                                nsISupports* aUserData) {
+  SAMPLE_LABEL("bookmarks", "RunInBatchMode");
   NS_ENSURE_ARG(aCallback);
 
   mBatching = true;
 
   // Just forward the request to history.  History service must exist for
   // bookmarks to work and we are observing it, thus batch notifications will be
   // forwarded to bookmarks observers.
   nsNavHistory* history = nsNavHistory::GetHistoryService();
--- a/tools/profiler/sampler.h
+++ b/tools/profiler/sampler.h
@@ -72,24 +72,16 @@
  *         this tag will describe the last 'c' tag.
  *
  * NOTE: File format is planned to be extended to include a dictionary to reduce size.
  */
 
 #ifndef SAMPLER_H
 #define SAMPLER_H
 
-#if defined(_MSC_VER)
-#define FULLFUNCTION __FUNCSIG__
-#elif (__GNUC__ >= 4)
-#define FULLFUNCTION __PRETTY_FUNCTION__
-#else
-#define FULLFUNCTION __FUNCTION__
-#endif
-
 // Redefine the macros for platforms where SPS is supported.
 #if defined(ANDROID) || defined(__linux__) || defined(XP_MACOSX) || defined(XP_WIN)
 
 #include "sps_sampler.h"
 
 #else
 
 // Initialize the sampler. Any other calls will be silently discarded
@@ -101,13 +93,14 @@
 #define SAMPLER_IS_ACTIVE() false
 #define SAMPLER_SAVE()
 // Returned string must be free'ed
 #define SAMPLER_GET_PROFILE() NULL
 #define SAMPLER_RESPONSIVENESS(time) NULL
 #define SAMPLER_GET_RESPONSIVENESS() NULL
 #define SAMPLER_GET_FEATURES() NULL
 #define SAMPLE_LABEL(name_space, info)
+#define SAMPLE_LABEL_FN(name_space, info)
 #define SAMPLE_MARKER(info)
 
 #endif
 
 #endif // ifndef SAMPLER_H
--- a/tools/profiler/sps/sps_sampler.h
+++ b/tools/profiler/sps/sps_sampler.h
@@ -44,27 +44,39 @@
 
 using mozilla::TimeStamp;
 using mozilla::TimeDuration;
 
 extern mozilla::tls::key pkey_stack;
 extern mozilla::tls::key pkey_ticker;
 extern bool stack_key_initialized;
 
+#ifndef SAMPLE_FUNCTION_NAME
+# ifdef __GNUC__
+#  define SAMPLE_FUNCTION_NAME __FUNCTION__
+# elif defined(_MSC_VER)
+#  define SAMPLE_FUNCTION_NAME __FUNCTION__
+# else
+#  define SAMPLE_FUNCTION_NAME __func__  // defined in C99, supported in various C++ compilers. Just raw function name.
+# endif
+#endif
+
 #define SAMPLER_INIT() mozilla_sampler_init()
 #define SAMPLER_DEINIT() mozilla_sampler_deinit()
 #define SAMPLER_START(entries, interval, features, featureCount) mozilla_sampler_start(entries, interval, features, featureCount)
 #define SAMPLER_STOP() mozilla_sampler_stop()
 #define SAMPLER_IS_ACTIVE() mozilla_sampler_is_active()
 #define SAMPLER_RESPONSIVENESS(time) mozilla_sampler_responsiveness(time)
 #define SAMPLER_GET_RESPONSIVENESS() mozilla_sampler_get_responsiveness()
 #define SAMPLER_SAVE() mozilla_sampler_save()
 #define SAMPLER_GET_PROFILE() mozilla_sampler_get_profile()
 #define SAMPLER_GET_FEATURES() mozilla_sampler_get_features()
-#define SAMPLE_LABEL(name_space, info) mozilla::SamplerStackFrameRAII only_one_sampleraii_per_scope(FULLFUNCTION, name_space "::" info)
+// we want the class and function name but can't easily get that using preprocessor macros
+// __func__ doesn't have the class name and __PRETTY_FUNCTION__ has the parameters
+#define SAMPLE_LABEL(name_space, info) mozilla::SamplerStackFrameRAII only_one_sampleraii_per_scope(name_space "::" info)
 #define SAMPLE_MARKER(info) mozilla_sampler_add_marker(info)
 
 /* we duplicate this code here to avoid header dependencies
  * which make it more difficult to include in other places */
 #if defined(_M_X64) || defined(__x86_64__)
 #define V8_HOST_ARCH_X64 1
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
 #define V8_HOST_ARCH_IA32 1
@@ -124,17 +136,18 @@ void mozilla_sampler_save();
 char* mozilla_sampler_get_profile();
 const char** mozilla_sampler_get_features();
 void mozilla_sampler_init();
 
 namespace mozilla {
 
 class NS_STACK_CLASS SamplerStackFrameRAII {
 public:
-  SamplerStackFrameRAII(const char *aFuncName, const char *aInfo) {
+  // we only copy the strings at save time, so to take multiple parameters we'd need to copy them then.
+  SamplerStackFrameRAII(const char *aInfo) {
     mHandle = mozilla_sampler_call_enter(aInfo);
   }
   ~SamplerStackFrameRAII() {
     mozilla_sampler_call_exit(mHandle);
   }
 private:
   void* mHandle;
 };
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -659,17 +659,17 @@ IsViewForPopup(nsIView* aView)
 }
 
 NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
                                            nsIView* aView, nsEventStatus *aStatus)
 {
   NS_ASSERTION(!aView || static_cast<nsView*>(aView)->GetViewManager() == this,
                "wrong view manager");
 
-  SAMPLE_LABEL("event", "DispatchEvent");
+  SAMPLE_LABEL("event", "nsViewManager::DispatchEvent");
 
   *aStatus = nsEventStatus_eIgnore;
 
   switch(aEvent->message)
     {
     case NS_SIZE:
       {
         if (aView)
--- a/widget/cocoa/nsAppShell.mm
+++ b/widget/cocoa/nsAppShell.mm
@@ -58,16 +58,17 @@
 #include "nsIInterfaceRequestor.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsObjCExceptions.h"
 #include "nsCocoaUtils.h"
 #include "nsChildView.h"
 #include "nsToolkit.h"
 #include "TextInputHandler.h"
 #include "mozilla/HangMonitor.h"
+#include "sampler.h"
 
 #include "npapi.h"
 
 using namespace mozilla::widget;
 
 // defined in nsChildView.mm
 extern nsIRollupListener * gRollupListener;
 extern nsIWidget         * gRollupWidget;
@@ -400,17 +401,17 @@ nsAppShell::Init()
 // to ScheduleNativeEventCallback(), if processing of Gecko events via "native
 // methods" hasn't been suspended).  This happens in NativeEventCallback().
 //
 // protected static
 void
 nsAppShell::ProcessGeckoEvents(void* aInfo)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
-
+  SAMPLE_LABEL("Events", "ProcessGeckoEvents");
   nsAppShell* self = static_cast<nsAppShell*> (aInfo);
 
   if (self->mRunningEventLoop) {
     self->mRunningEventLoop = false;
 
     // The run loop may be sleeping -- [NSRunLoop runMode:...]
     // won't return until it's given a reason to wake up.  Awaken it by
     // posting a bogus event.  There's no need to make the event
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -89,16 +89,18 @@
 #include "GLContext.h"
 
 #include "mozilla/Preferences.h"
 
 #include <dlfcn.h>
 
 #include <ApplicationServices/ApplicationServices.h>
 
+#include "sampler.h"
+
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::gl;
 using namespace mozilla::widget;
 using namespace mozilla;
 
 #undef DEBUG_UPDATE
 #undef INVALIDATE_DEBUGGING  // flash areas as they are invalidated
@@ -2472,16 +2474,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
   // Title bar drawing only works if we really draw into aContext, which only
   // the basic layer manager will do.
   nsBaseWidget::AutoUseBasicLayerManager setupLayerManager(mGeckoChild);
   [self drawRect:aRect inContext:aContext];
 }
 
 - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
 {
+  SAMPLE_LABEL("widget", "ChildView::drawRect");
   bool isVisible;
   if (!mGeckoChild || NS_FAILED(mGeckoChild->IsVisible(isVisible)) ||
       !isVisible)
     return;
 
 #ifndef NP_NO_QUICKDRAW
   if (mIsPluginView && mPluginDrawingModel == NPDrawingModelQuickDraw) {
     mGeckoChild->PaintQD();