Bug 707800. Add more sampler labels. r=bgirard

This commit is contained in:
Jeff Muizelaar 2011-12-02 17:05:33 -05:00
parent 1183428944
commit 9c4d4fff06
11 changed files with 57 additions and 12 deletions

View File

@ -135,6 +135,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "sampler.h"
#ifdef XP_MACOSX
#import <ApplicationServices/ApplicationServices.h>
@ -3808,6 +3809,7 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
nsIContent* aTargetContent,
nsIContent* aRelatedContent)
{
SAMPLE_LABEL("Input", "DispatchMouseEvent");
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget,
nsMouseEvent::eReal);

View File

@ -83,6 +83,7 @@
#include "nsIIOService.h"
#include "mozilla/dom/Element.h"
#include "sampler.h"
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -729,6 +730,7 @@ nsDOMWindowUtils::Focus(nsIDOMElement* aElement)
NS_IMETHODIMP
nsDOMWindowUtils::GarbageCollect(nsICycleCollectorListener *aListener)
{
SAMPLE_LABEL("GC", "GarbageCollect");
// Always permit this in debug builds.
#ifndef DEBUG
if (!IsUniversalXPConnectCapable()) {

View File

@ -108,6 +108,8 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "sampler.h"
using namespace mozilla;
const size_t gStackSize = 8192;
@ -1185,6 +1187,7 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
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.");
@ -1387,6 +1390,7 @@ nsJSContext::EvaluateString(const nsAString& aScript,
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);
if (!mScriptsEnabled) {
@ -1857,6 +1861,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s)", MOZ_FUNCTION_NAME, __LINE__, name);
}
#endif
SAMPLE_LABEL("JS", "CallEventHandler");
JSAutoRequest ar(mContext);
JSObject* target = nsnull;
@ -3166,6 +3171,7 @@ void
nsJSContext::GarbageCollectNow(bool shrinkingGC)
{
NS_TIME_FUNCTION_MIN(1.0);
SAMPLE_LABEL("GC", "GarbageCollectNow");
KillGCTimer();
@ -3191,6 +3197,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener)
return;
}
SAMPLE_LABEL("GC", "CycleCollectNow");
NS_TIME_FUNCTION_MIN(1.0);
KillCCTimer();

View File

@ -50,6 +50,7 @@
#include "nsRenderingContext.h"
#include "mozilla/Preferences.h"
#include "sampler.h"
#ifdef DEBUG
#include <stdio.h>
@ -2014,6 +2015,8 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
const nsIntRegion& aRegionToInvalidate,
void* aCallbackData)
{
SAMPLE_LABEL("gfx", "DrawThebesLayer");
nsDisplayListBuilder* builder = static_cast<nsDisplayListBuilder*>
(aCallbackData);

View File

@ -44,6 +44,7 @@
#include "RestyleTracker.h"
#include "nsCSSFrameConstructor.h"
#include "nsStyleChangeList.h"
#include "sampler.h"
namespace mozilla {
namespace css {
@ -167,6 +168,7 @@ RestyleTracker::ProcessOneRestyle(Element* aElement,
void
RestyleTracker::ProcessRestyles()
{
SAMPLE_LABEL("CSS", "ProcessRestyles");
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
mFrameConstructor->BeginUpdate();

View File

@ -203,6 +203,7 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "sampler.h"
#include "Layers.h"
#include "nsPLDOMEvent.h"
@ -3974,6 +3975,7 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
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
#ifdef DEBUG
@ -5421,6 +5423,7 @@ PresShell::Paint(nsIView* aViewToPaint,
NSCoordToFloat(bounds__.YMost()));
#endif
SAMPLE_LABEL("Paint", "PresShell::Paint");
NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
NS_ASSERTION(aViewToPaint, "null view");
NS_ASSERTION(aWidgetToPaint, "Can't paint without a widget");
@ -7203,6 +7206,7 @@ bool
PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
{
NS_TIME_FUNCTION_WITH_DOCURL;
SAMPLE_LABEL("layout", "DoReflow");
if (mReflowContinueTimer) {
mReflowContinueTimer->Cancel();

View File

@ -47,6 +47,7 @@
#include "nsThreadUtils.h"
#include "nsCOMPtr.h"
#include "prlog.h"
#include "sampler.h"
static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
@ -382,6 +383,7 @@ nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream)
{
LOG(("nsInputStreamPump::OnInputStreamReady [this=%x]\n", this));
SAMPLE_LABEL("Input", "OnInputStreamReady");
// this function has been called from a PLEvent, so we can safely call
// any listener or progress sink methods directly from here.

View File

@ -85,6 +85,13 @@
#define FULLFUNCTION __FUNCTION__
#endif
// Redefine the macros for platforms where SPS is supported.
#if defined(ANDROID) || defined(XP_MACOSX)
#include "sps_sampler.h"
#else
// Initialize the sampler. Any other calls will be silently discarded
// before the sampler has been initialized (i.e. early start-up code)
#define SAMPLER_INIT()
@ -99,12 +106,6 @@
#define SAMPLER_GET_RESPONSIVENESS() NULL
#define SAMPLE_LABEL(name_space, info)
#define SAMPLE_MARKER(info)
// Redefine the macros for platforms where SPS is supported.
#if defined(ANDROID) || defined(XP_MACOSX)
#include "sps_sampler.h"
#endif
#endif

View File

@ -37,7 +37,6 @@
* ***** END LICENSE BLOCK ***** */
#include <pthread.h>
#include "base/atomicops.h"
#include "nscore.h"
#include "mozilla/TimeStamp.h"
@ -61,17 +60,34 @@ extern bool stack_key_initialized;
#define SAMPLE_LABEL(name_space, info) mozilla::SamplerStackFrameRAII only_one_sampleraii_per_scope(FULLFUNCTION, 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
#elif defined(__ARMEL__)
#define V8_HOST_ARCH_ARM 1
#else
#warning Please add support for your architecture in chromium_types.h
#endif
// STORE_SEQUENCER: Because signals can interrupt our profile modification
// we need to make stores are not re-ordered by the compiler
// or hardware to make sure the profile is consistent at
// every point the signal can fire.
#ifdef ARCH_CPU_ARM_FAMILY
#ifdef V8_HOST_ARCH_ARM
// TODO Is there something cheaper that will prevent
// memory stores from being reordered
// Uses: pLinuxKernelMemoryBarrier
# define STORE_SEQUENCER() base::subtle::MemoryBarrier();
#elif ARCH_CPU_X86_FAMILY
# define STORE_SEQUENCER() asm volatile("" ::: "memory");
typedef void (*LinuxKernelMemoryBarrierFunc)(void);
LinuxKernelMemoryBarrierFunc pLinuxKernelMemoryBarrier __attribute__((weak)) =
(LinuxKernelMemoryBarrierFunc) 0xffff0fa0;
# define STORE_SEQUENCER() pLinuxKernelMemoryBarrier()
#elif defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_X64)
# define STORE_SEQUENCER() asm volatile("" ::: "memory")
#else
# error "Memory clobber not supported for your platform."
#endif

View File

@ -60,6 +60,7 @@
#include "nsPresContext.h"
#include "nsEventStateManager.h"
#include "mozilla/StartupTimeline.h"
#include "sampler.h"
/**
XXX TODO XXX
@ -707,6 +708,8 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
NS_ASSERTION(!aView || static_cast<nsView*>(aView)->GetViewManager() == this,
"wrong view manager");
SAMPLE_LABEL("event", "DispatchEvent");
*aStatus = nsEventStatus_eIgnore;
switch(aEvent->message)

View File

@ -44,6 +44,7 @@
#include "nsThreadManager.h"
#include "nsThreadUtils.h"
#include "prmem.h"
#include "sampler.h"
using mozilla::TimeDuration;
using mozilla::TimeStamp;
@ -376,6 +377,8 @@ void nsTimerImpl::Fire()
if (mCanceled)
return;
SAMPLE_LABEL("Timer", "Fire");
TimeStamp now = TimeStamp::Now();
#ifdef DEBUG_TIMERS
if (PR_LOG_TEST(gTimerLog, PR_LOG_DEBUG)) {