mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 918825 - Add frame duration marker. r=ehsan
This commit is contained in:
parent
715a9c6997
commit
7d8c972382
@ -165,6 +165,7 @@ ClientLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
|
||||
MOZ_LAYERS_LOG((" ----- (beginning paint)"));
|
||||
Log();
|
||||
#endif
|
||||
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_START);
|
||||
|
||||
NS_ASSERTION(InConstruction(), "Should be in construction phase");
|
||||
mPhase = PHASE_DRAWING;
|
||||
|
@ -547,6 +547,8 @@ CompositorParent::Composite()
|
||||
15 + (int)(TimeStamp::Now() - mExpectedComposeTime).ToMilliseconds());
|
||||
}
|
||||
#endif
|
||||
|
||||
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_END);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -187,6 +187,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
const bool& isFirstPaint,
|
||||
InfallibleTArray<EditReply>* reply)
|
||||
{
|
||||
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
|
||||
PROFILER_LABEL("LayerTransactionParent", "RecvUpdate");
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
TimeStamp updateStart = TimeStamp::Now();
|
||||
|
@ -538,6 +538,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
|
||||
PlatformSyncBeforeUpdate();
|
||||
|
||||
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END);
|
||||
if (mTxn->mSwapRequired) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
|
||||
RenderTraceScope rendertrace3("Forward Transaction", "000093");
|
||||
|
@ -1058,6 +1058,8 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
return;
|
||||
}
|
||||
|
||||
profiler_tracing("Paint", "RD", TRACING_INTERVAL_START);
|
||||
|
||||
/*
|
||||
* The timer holds a reference to |this| while calling |Notify|.
|
||||
* However, implementations of |WillRefresh| are permitted to destroy
|
||||
@ -1072,6 +1074,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
|
||||
if (!mPresContext || !mPresContext->GetPresShell()) {
|
||||
StopTimer();
|
||||
profiler_tracing("Paint", "RD", TRACING_INTERVAL_END);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1089,6 +1092,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
// readded as needed.
|
||||
mFrameRequestCallbackDocs.Clear();
|
||||
|
||||
profiler_tracing("Paint", "Scripts", TRACING_INTERVAL_START);
|
||||
int64_t eventTime = aNowEpoch / PR_USEC_PER_MSEC;
|
||||
for (uint32_t i = 0; i < frameRequestCallbacks.Length(); ++i) {
|
||||
const DocumentFrameCallbacks& docCallbacks = frameRequestCallbacks[i];
|
||||
@ -1115,6 +1119,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
profiler_tracing("Paint", "Scripts", TRACING_INTERVAL_END);
|
||||
|
||||
// This is the Flush_Style case.
|
||||
if (mPresContext && mPresContext->GetPresShell()) {
|
||||
@ -1213,6 +1218,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
for (uint32_t i = 0; i < mPostRefreshObservers.Length(); ++i) {
|
||||
mPostRefreshObservers[i]->DidRefresh();
|
||||
}
|
||||
profiler_tracing("Paint", "RD", TRACING_INTERVAL_END);
|
||||
}
|
||||
|
||||
/* static */ PLDHashOperator
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
// Profiler
|
||||
#include "PlatformMacros.h"
|
||||
#include "GeckoProfilerImpl.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "platform.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -56,6 +56,12 @@ namespace mozilla {
|
||||
class TimeStamp;
|
||||
}
|
||||
|
||||
enum TracingMetadata {
|
||||
TRACING_DEFAULT,
|
||||
TRACING_INTERVAL_START,
|
||||
TRACING_INTERVAL_END
|
||||
};
|
||||
|
||||
#ifndef MOZ_ENABLE_PROFILER_SPS
|
||||
|
||||
#include <stdint.h>
|
||||
@ -82,6 +88,9 @@ class TimeStamp;
|
||||
#define PROFILER_MAIN_THREAD_LABEL(name_space, info) do {} while (0)
|
||||
#define PROFILER_MAIN_THREAD_LABEL_PRINTF(name_space, info, format, ...) do {} while (0)
|
||||
|
||||
static inline void profiler_tracing(const char* aCategory, const char* aInfo,
|
||||
TracingMetadata metaData = TRACING_DEFAULT) {}
|
||||
|
||||
// Initilize the profiler TLS, signal handlers on linux. If MOZ_PROFILER_STARTUP
|
||||
// is set the profiler will be started. This call must happen before any other
|
||||
// sampler calls. Particularly sampler_label/sampler_marker.
|
||||
|
@ -78,5 +78,8 @@ double mozilla_sampler_time(const TimeStamp& aTime);
|
||||
/* Returns true if env var SPS_NEW is set to anything, else false. */
|
||||
extern bool sps_version2();
|
||||
|
||||
void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
|
||||
TracingMetadata aMetaData);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -201,6 +201,21 @@ bool profiler_in_privacy_mode()
|
||||
return stack->mPrivacyMode;
|
||||
}
|
||||
|
||||
static inline void profiler_tracing(const char* aCategory, const char* aInfo,
|
||||
TracingMetadata aMetaData = TRACING_DEFAULT)
|
||||
{
|
||||
if (!stack_key_initialized)
|
||||
return;
|
||||
|
||||
// Don't insert a marker if we're not profiling to avoid
|
||||
// the heap copy (malloc).
|
||||
if (!profiler_is_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla_sampler_tracing(aCategory, aInfo, aMetaData);
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
@ -210,11 +225,13 @@ bool profiler_in_privacy_mode()
|
||||
|
||||
#define PROFILER_LABEL(name_space, info) mozilla::SamplerStackFrameRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__)
|
||||
#define PROFILER_LABEL_PRINTF(name_space, info, ...) mozilla::SamplerStackFramePrintfRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__, __VA_ARGS__)
|
||||
|
||||
#define PROFILER_MARKER(info) mozilla_sampler_add_marker(info)
|
||||
#define PROFILER_MARKER_PAYLOAD(info, payload) mozilla_sampler_add_marker(info, payload)
|
||||
#define PROFILER_MAIN_THREAD_MARKER(info) MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla_sampler_add_marker(info)
|
||||
|
||||
#define PROFILER_MAIN_THREAD_LABEL(name_space, info) MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla::SamplerStackFrameRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__)
|
||||
#define PROFILER_MAIN_THREAD_LABEL_PRINTF(name_space, info, ...) MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla::SamplerStackFramePrintfRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__, __VA_ARGS__)
|
||||
#define PROFILER_MAIN_THREAD_MARKER(info) MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla_sampler_add_marker(info)
|
||||
|
||||
|
||||
/* FIXME/bug 789667: memory constraints wouldn't much of a problem for
|
||||
|
@ -4,7 +4,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <ostream>
|
||||
#include "GeckoProfilerImpl.h"
|
||||
#include "platform.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define MOZ_PROFILE_ENTRY_H
|
||||
|
||||
#include <ostream>
|
||||
#include "GeckoProfilerImpl.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "platform.h"
|
||||
#include "ProfilerBacktrace.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
@ -16,9 +16,9 @@ ProfilerMarkerPayload::ProfilerMarkerPayload(ProfilerBacktrace* aStack)
|
||||
ProfilerMarkerPayload::ProfilerMarkerPayload(const mozilla::TimeStamp& aStartTime,
|
||||
const mozilla::TimeStamp& aEndTime,
|
||||
ProfilerBacktrace* aStack)
|
||||
: mStartTime(aStartTime),
|
||||
mEndTime(aEndTime),
|
||||
mStack(aStack)
|
||||
: mStartTime(aStartTime)
|
||||
, mEndTime(aEndTime)
|
||||
, mStack(aStack)
|
||||
{}
|
||||
|
||||
ProfilerMarkerPayload::~ProfilerMarkerPayload()
|
||||
@ -58,6 +58,37 @@ ProfilerMarkerPayload::prepareCommonProps<JSObjectBuilder>(
|
||||
JSObjectBuilder& b,
|
||||
JSObjectBuilder::ObjectHandle aObject);
|
||||
|
||||
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData)
|
||||
: mCategory(aCategory)
|
||||
, mMetaData(aMetaData)
|
||||
{}
|
||||
|
||||
template<typename Builder>
|
||||
typename Builder::Object
|
||||
ProfilerMarkerTracing::preparePayloadImp(Builder& b)
|
||||
{
|
||||
typename Builder::RootedObject data(b.context(), b.CreateObject());
|
||||
prepareCommonProps("tracing", b, data);
|
||||
|
||||
if (GetCategory()) {
|
||||
b.DefineProperty(data, "category", GetCategory());
|
||||
}
|
||||
if (GetMetaData() != TRACING_DEFAULT) {
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
b.DefineProperty(data, "interval", "start");
|
||||
} else if (GetMetaData() == TRACING_INTERVAL_END) {
|
||||
b.DefineProperty(data, "interval", "end");
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
template JSCustomObjectBuilder::Object
|
||||
ProfilerMarkerTracing::preparePayloadImp<JSCustomObjectBuilder>(JSCustomObjectBuilder& b);
|
||||
template JSObjectBuilder::Object
|
||||
ProfilerMarkerTracing::preparePayloadImp<JSObjectBuilder>(JSObjectBuilder& b);
|
||||
|
||||
ProfilerMarkerImagePayload::ProfilerMarkerImagePayload(gfxASurface *aImg)
|
||||
: mImg(aImg)
|
||||
{}
|
||||
|
@ -74,6 +74,30 @@ private:
|
||||
ProfilerBacktrace* mStack;
|
||||
};
|
||||
|
||||
class ProfilerMarkerTracing : public ProfilerMarkerPayload
|
||||
{
|
||||
public:
|
||||
ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData);
|
||||
|
||||
const char *GetCategory() const { return mCategory; }
|
||||
TracingMetadata GetMetaData() const { return mMetaData; }
|
||||
|
||||
protected:
|
||||
virtual JSCustomObjectBuilder::Object
|
||||
preparePayload(JSCustomObjectBuilder& b) { return preparePayloadImp(b); }
|
||||
virtual JSObjectBuilder::Object
|
||||
preparePayload(JSObjectBuilder& b) { return preparePayloadImp(b); }
|
||||
|
||||
private:
|
||||
template<typename Builder>
|
||||
typename Builder::Object preparePayloadImp(Builder& b);
|
||||
|
||||
private:
|
||||
const char *mCategory;
|
||||
TracingMetadata mMetaData;
|
||||
};
|
||||
|
||||
|
||||
class gfxASurface;
|
||||
class ProfilerMarkerImagePayload : public ProfilerMarkerPayload
|
||||
{
|
||||
@ -89,7 +113,7 @@ protected:
|
||||
private:
|
||||
template<typename Builder>
|
||||
typename Builder::Object preparePayloadImp(Builder& b);
|
||||
|
||||
|
||||
nsRefPtr<gfxASurface> mImg;
|
||||
};
|
||||
|
||||
@ -109,7 +133,7 @@ protected:
|
||||
private:
|
||||
template<typename Builder>
|
||||
typename Builder::Object preparePayloadImp(Builder& b);
|
||||
|
||||
|
||||
const char* mSource;
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "SaveProfileTask.h"
|
||||
#include "GeckoProfilerImpl.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
static bool
|
||||
WriteCallback(const jschar *buf, uint32_t len, void *data)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <stdio.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include "GeckoProfilerImpl.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "SaveProfileTask.h"
|
||||
#include "ProfileEntry.h"
|
||||
#include "SyncProfile.h"
|
||||
|
@ -66,7 +66,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include "platform.h"
|
||||
#include "GeckoProfilerImpl.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "ProfileEntry.h"
|
||||
|
@ -788,6 +788,12 @@ void mozilla_sampler_free_backtrace(ProfilerBacktrace* aBacktrace)
|
||||
delete aBacktrace;
|
||||
}
|
||||
|
||||
void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
|
||||
TracingMetadata aMetaData)
|
||||
{
|
||||
mozilla_sampler_add_marker(aInfo, new ProfilerMarkerTracing(aCategory, aMetaData));
|
||||
}
|
||||
|
||||
// END externally visible functions
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user