mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 1129249 - Add a "restyle" feature to profiler and split the style label in Cleopatra based on the restyleSource, r=dholbert,mstange
--HG-- extra : rebase_source : 0da0203824cfbf2265b42229b298274156633ddd
This commit is contained in:
parent
2aa9e4036e
commit
c56f9b604b
@ -83,6 +83,7 @@ CollectLaterSiblings(nsISupports* aElement,
|
||||
|
||||
struct RestyleEnumerateData : RestyleTracker::Hints {
|
||||
nsRefPtr<dom::Element> mElement;
|
||||
UniquePtr<ProfilerBacktrace> mBacktrace;
|
||||
};
|
||||
|
||||
struct RestyleCollector {
|
||||
@ -140,6 +141,7 @@ CollectRestyles(nsISupports* aElement,
|
||||
currentRestyle->mElement = element;
|
||||
currentRestyle->mRestyleHint = aData->mRestyleHint;
|
||||
currentRestyle->mChangeHint = aData->mChangeHint;
|
||||
currentRestyle->mBacktrace = Move(aData->mBacktrace);
|
||||
|
||||
#ifdef RESTYLE_LOGGING
|
||||
collector->count++;
|
||||
@ -305,6 +307,10 @@ RestyleTracker::DoProcessRestyles()
|
||||
continue;
|
||||
}
|
||||
|
||||
Maybe<GeckoProfilerTracingRAII> profilerRAII;
|
||||
if (profiler_feature_active("restyle")) {
|
||||
profilerRAII.emplace("Paint", "Styles", Move(data->mBacktrace));
|
||||
}
|
||||
ProcessOneRestyle(element, data->mRestyleHint, data->mChangeHint);
|
||||
AddRestyleRootsIfAwaitingRestyle(data->mDescendants);
|
||||
}
|
||||
@ -340,6 +346,11 @@ RestyleTracker::DoProcessRestyles()
|
||||
FrameTagToString(currentRestyle->mElement).get(),
|
||||
index++, collector.count);
|
||||
LOG_RESTYLE_INDENT();
|
||||
|
||||
Maybe<GeckoProfilerTracingRAII> profilerRAII;
|
||||
if (profiler_feature_active("restyle")) {
|
||||
profilerRAII.emplace("Paint", "Styles", Move(currentRestyle->mBacktrace));
|
||||
}
|
||||
ProcessOneRestyle(currentRestyle->mElement,
|
||||
currentRestyle->mRestyleHint,
|
||||
currentRestyle->mChangeHint);
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "nsContainerFrame.h"
|
||||
#include "mozilla/SplayTree.h"
|
||||
#include "mozilla/RestyleLogging.h"
|
||||
#include "ProfilerBacktrace.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -291,6 +293,7 @@ public:
|
||||
// that we called AddPendingRestyle for and found the element this is
|
||||
// the RestyleData for as its nearest restyle root.
|
||||
nsTArray<nsRefPtr<Element>> mDescendants;
|
||||
UniquePtr<ProfilerBacktrace> mBacktrace;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -388,8 +391,11 @@ RestyleTracker::AddPendingRestyleToTable(Element* aElement,
|
||||
}
|
||||
|
||||
if (!existingData) {
|
||||
mPendingRestyles.Put(aElement,
|
||||
new RestyleData(aRestyleHint, aMinChangeHint));
|
||||
RestyleData* rd = new RestyleData(aRestyleHint, aMinChangeHint);
|
||||
if (profiler_feature_active("restyle")) {
|
||||
rd->mBacktrace.reset(profiler_get_backtrace());
|
||||
}
|
||||
mPendingRestyles.Put(aElement, rd);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
#define SAMPLER_H
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
class TimeStamp;
|
||||
@ -230,4 +231,28 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ProfilerBacktrace;
|
||||
|
||||
class MOZ_STACK_CLASS GeckoProfilerTracingRAII {
|
||||
public:
|
||||
GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo,
|
||||
mozilla::UniquePtr<ProfilerBacktrace> aBacktrace
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: mCategory(aCategory)
|
||||
, mInfo(aInfo)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
profiler_tracing(mCategory, mInfo, aBacktrace.release(), TRACING_INTERVAL_START);
|
||||
}
|
||||
|
||||
~GeckoProfilerTracingRAII() {
|
||||
profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_END);
|
||||
}
|
||||
|
||||
protected:
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
const char* mCategory;
|
||||
const char* mInfo;
|
||||
};
|
||||
|
||||
#endif // ifndef SAMPLER_H
|
||||
|
@ -48,6 +48,7 @@ static bool sIsProfiling = false; // is raced on
|
||||
static bool sIsGPUProfiling = false; // is raced on
|
||||
static bool sIsLayersDump = false; // is raced on
|
||||
static bool sIsDisplayListDump = false; // is raced on
|
||||
static bool sIsRestyleProfiling = false; // is raced on
|
||||
|
||||
// env variables to control the profiler
|
||||
const char* PROFILER_MODE = "MOZ_PROFILER_MODE";
|
||||
@ -763,6 +764,7 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval,
|
||||
sIsGPUProfiling = t->ProfileGPU();
|
||||
sIsLayersDump = t->LayersDump();
|
||||
sIsDisplayListDump = t->DisplayListDump();
|
||||
sIsRestyleProfiling = t->ProfileRestyle();
|
||||
|
||||
if (Sampler::CanNotifyObservers()) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
@ -835,6 +837,7 @@ void mozilla_sampler_stop()
|
||||
sIsGPUProfiling = false;
|
||||
sIsLayersDump = false;
|
||||
sIsDisplayListDump = false;
|
||||
sIsRestyleProfiling = false;
|
||||
|
||||
if (Sampler::CanNotifyObservers()) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
@ -883,6 +886,10 @@ bool mozilla_sampler_feature_active(const char* aName)
|
||||
return sIsDisplayListDump;
|
||||
}
|
||||
|
||||
if (strcmp(aName, "restyle") == 0) {
|
||||
return sIsRestyleProfiling;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user