зеркало из https://github.com/mozilla/pjs.git
Bug 718440. Add more sampler labels to various places. r=bgirard
This shows the problems described in bug 710068.
This commit is contained in:
Родитель
bf6888ed1e
Коммит
6fffa906f2
|
@ -2017,6 +2017,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status)
|
||||
{
|
||||
SAMPLE_LABEL("content", "nsXMLHttpRequest::OnStopRequest");
|
||||
if (!IsSameOrBaseChannel(request, mChannel)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "nsDOMProgressEvent.h"
|
||||
#include "nsDOMEventTargetWrapperCache.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "sampler.h"
|
||||
|
||||
class nsILoadGroup;
|
||||
class AsyncVerifyRedirectCallbackForwarder;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "gfxFailure.h"
|
||||
#include "prenv.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "sampler.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
@ -195,6 +196,7 @@ public:
|
|||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
SAMPLE_LABEL("GLContext", "SwapBuffers");
|
||||
[mContext flushBuffer];
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
|
||||
#include "gfxCrashReporterUtils.h"
|
||||
|
||||
#include "sampler.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
@ -758,6 +760,7 @@ LayerManagerOGL::BindAndDrawQuadWithTextureRect(LayerProgram *aProg,
|
|||
void
|
||||
LayerManagerOGL::Render()
|
||||
{
|
||||
SAMPLE_LABEL("LayerManagerOGL", "Render");
|
||||
if (mDestroyed) {
|
||||
NS_WARNING("Call on destroyed layer manager");
|
||||
return;
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
static bool gDisableOptimize = false;
|
||||
|
||||
#include "cairo.h"
|
||||
#include "sampler.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
||||
|
@ -435,6 +436,7 @@ 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!");
|
||||
|
|
|
@ -116,6 +116,8 @@
|
|||
#include "nsXULPopupManager.h"
|
||||
#endif
|
||||
|
||||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -3630,6 +3632,7 @@ nsLayoutUtils::DrawBackgroundImage(nsRenderingContext* aRenderingContext,
|
|||
const nsRect& aDirty,
|
||||
PRUint32 aImageFlags)
|
||||
{
|
||||
SAMPLE_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage");
|
||||
return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter,
|
||||
aDest, aFill, aAnchor, aDirty,
|
||||
aImageSize, aImageFlags);
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "sampler.h"
|
||||
|
||||
// headers for plugin scriptability
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -698,6 +699,7 @@ nsObjectFrame::InstantiatePlugin(nsPluginHost* aPluginHost,
|
|||
const char* aMimeType,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
SAMPLE_LABEL("nsObjectFrame", "InstantiatePlugin");
|
||||
NS_ASSERTION(mPreventInstantiation,
|
||||
"Instantiation should be prevented here!");
|
||||
|
||||
|
@ -2150,6 +2152,7 @@ nsObjectFrame::PrepareInstanceOwner()
|
|||
nsresult
|
||||
nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener)
|
||||
{
|
||||
SAMPLE_LABEL("plugin", "nsObjectFrame::Instantiate");
|
||||
if (mPreventInstantiation) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2200,6 +2203,7 @@ nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamList
|
|||
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));
|
||||
|
@ -2348,6 +2352,7 @@ DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
|
|||
static void
|
||||
DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
|
||||
{
|
||||
SAMPLE_LABEL("plugin", "DoStopPlugin");
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
aInstanceOwner->GetInstance(getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
|
@ -2390,6 +2395,7 @@ nsStopPluginRunnable::Notify(nsITimer *aTimer)
|
|||
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;
|
||||
|
|
|
@ -383,7 +383,7 @@ 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.
|
||||
|
||||
|
@ -426,6 +426,7 @@ nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream)
|
|||
PRUint32
|
||||
nsInputStreamPump::OnStateStart()
|
||||
{
|
||||
SAMPLE_LABEL("nsInputStreamPump", "OnStateStart");
|
||||
LOG((" OnStateStart [this=%x]\n", this));
|
||||
|
||||
nsresult rv;
|
||||
|
@ -453,6 +454,7 @@ nsInputStreamPump::OnStateStart()
|
|||
PRUint32
|
||||
nsInputStreamPump::OnStateTransfer()
|
||||
{
|
||||
SAMPLE_LABEL("Input", "nsInputStreamPump::OnStateTransfer");
|
||||
LOG((" OnStateTransfer [this=%x]\n", this));
|
||||
|
||||
// if canceled, go directly to STATE_STOP...
|
||||
|
@ -562,6 +564,7 @@ nsInputStreamPump::OnStateTransfer()
|
|||
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
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "nsIInputStream.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsNetError.h"
|
||||
#include "sampler.h"
|
||||
|
||||
nsStreamLoader::nsStreamLoader()
|
||||
: mData(nsnull),
|
||||
|
@ -118,6 +119,7 @@ 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;
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -4213,6 +4214,7 @@ nsHttpChannel::ContinueOnStartRequest3(nsresult result)
|
|||
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));
|
||||
|
||||
|
@ -4388,6 +4390,7 @@ 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));
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsHtml5StreamParser.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "mozilla/Util.h" // DebugOnly
|
||||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -426,6 +427,7 @@ class nsHtml5FlushLoopGuard
|
|||
void
|
||||
nsHtml5TreeOpExecutor::RunFlushLoop()
|
||||
{
|
||||
SAMPLE_LABEL("html5", "RunFlushLoop");
|
||||
if (mRunFlushLoopOnStack) {
|
||||
// There's already a RunFlushLoop() on the call stack.
|
||||
return;
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "SQLCollations.h"
|
||||
#include "FileSystemModule.h"
|
||||
#include "mozStorageHelper.h"
|
||||
#include "sampler.h"
|
||||
|
||||
#include "prlog.h"
|
||||
#include "prprf.h"
|
||||
|
@ -608,6 +609,7 @@ 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;
|
||||
|
@ -1028,6 +1030,7 @@ NS_IMETHODIMP
|
|||
Connection::Clone(bool aReadOnly,
|
||||
mozIStorageConnection **_connection)
|
||||
{
|
||||
SAMPLE_LABEL("storage", "Connection::Clone");
|
||||
if (!mDBConn)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
if (!mDatabaseFile)
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "mozStorageStatementParams.h"
|
||||
#include "mozStorageStatementRow.h"
|
||||
#include "mozStorageStatement.h"
|
||||
#include "sampler.h"
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
|
@ -587,6 +588,7 @@ Statement::Execute()
|
|||
NS_IMETHODIMP
|
||||
Statement::ExecuteStep(bool *_moreResults)
|
||||
{
|
||||
SAMPLE_LABEL("storage", "Statement::ExecuteStep");
|
||||
if (!mDBStatement)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "nsVariant.h"
|
||||
#include "mozilla/storage.h"
|
||||
|
||||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#define ENSURE_ANNO_TYPE(_type, _statement) \
|
||||
|
@ -236,6 +238,7 @@ nsAnnotationService::SetItemAnnotation(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
SAMPLE_LABEL("AnnotationService", "SetItemAnnotation");
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG(aValue);
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
#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.
|
||||
|
@ -681,6 +683,7 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder,
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
||||
{
|
||||
SAMPLE_LABEL("bookmarks", "RemoveItem");
|
||||
NS_ENSURE_ARG(aItemId != mRoot);
|
||||
|
||||
BookmarkData bookmark;
|
||||
|
@ -1132,6 +1135,7 @@ nsNavBookmarks::GetDescendantChildren(PRInt64 aFolderId,
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
||||
{
|
||||
SAMPLE_LABEL("bookmarks", "RemoveFolderChilder");
|
||||
NS_ENSURE_ARG_MIN(aFolderId, 1);
|
||||
|
||||
BookmarkData folder;
|
||||
|
@ -2751,6 +2755,7 @@ nsNavBookmarks::EnsureKeywordsHash() {
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::RunInBatchMode(nsINavHistoryBatchCallback* aCallback,
|
||||
nsISupports* aUserData) {
|
||||
SAMPLE_LABEL("bookmarks", "RunInBatchMode");
|
||||
NS_ENSURE_ARG(aCallback);
|
||||
|
||||
mBatching = true;
|
||||
|
|
|
@ -77,14 +77,6 @@
|
|||
#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)
|
||||
|
||||
|
@ -106,6 +98,7 @@
|
|||
#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
|
||||
|
|
|
@ -49,6 +49,16 @@ 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)
|
||||
|
@ -59,7 +69,9 @@ extern bool stack_key_initialized;
|
|||
#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
|
||||
|
@ -129,7 +141,8 @@ 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() {
|
||||
|
|
|
@ -664,7 +664,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
|
|||
NS_ASSERTION(!aView || static_cast<nsView*>(aView)->GetViewManager() == this,
|
||||
"wrong view manager");
|
||||
|
||||
SAMPLE_LABEL("event", "DispatchEvent");
|
||||
SAMPLE_LABEL("event", "nsViewManager::DispatchEvent");
|
||||
|
||||
*aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "nsToolkit.h"
|
||||
#include "TextInputHandler.h"
|
||||
#include "mozilla/HangMonitor.h"
|
||||
#include "sampler.h"
|
||||
|
||||
#include "npapi.h"
|
||||
|
||||
|
@ -405,7 +406,7 @@ void
|
|||
nsAppShell::ProcessGeckoEvents(void* aInfo)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
SAMPLE_LABEL("Events", "ProcessGeckoEvents");
|
||||
nsAppShell* self = static_cast<nsAppShell*> (aInfo);
|
||||
|
||||
if (self->mRunningEventLoop) {
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::gl;
|
||||
|
@ -2477,6 +2479,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
|
||||
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
|
||||
{
|
||||
SAMPLE_LABEL("widget", "ChildView::drawRect");
|
||||
bool isVisible;
|
||||
if (!mGeckoChild || NS_FAILED(mGeckoChild->IsVisible(isVisible)) ||
|
||||
!isVisible)
|
||||
|
|
Загрузка…
Ссылка в новой задаче