Bug 1403868 (part 2) - Tweak profiler_tracing(). r=mstange.

This patch does the following.

- Makes the TracingKind argument non-optional.

- Puts the UniqueProfilerBacktrace argument last in the second variant.

- Reorders AutoProfilerTracing to match the order of the profiler_tracing()
  declarations.

--HG--
extra : rebase_source : 8e9acdaf777c642cd854570771a3f96da6d524d1
This commit is contained in:
Nicholas Nethercote 2017-10-03 19:48:10 +11:00
Родитель 93c60b0d95
Коммит cbc9fbb2bf
5 изменённых файлов: 19 добавлений и 19 удалений

Просмотреть файл

@ -868,7 +868,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
} else if (profiler_feature_active(ProfilerFeature::LayersDump)) { } else if (profiler_feature_active(ProfilerFeature::LayersDump)) {
std::stringstream ss; std::stringstream ss;
Dump(ss); Dump(ss);
profiler_tracing("log", ss.str().c_str()); profiler_tracing("log", ss.str().c_str(), TRACING_EVENT);
} }
// Dump to LayerScope Viewer // Dump to LayerScope Viewer

Просмотреть файл

@ -3804,7 +3804,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
// Flush stream now to avoid reordering dump output relative to // Flush stream now to avoid reordering dump output relative to
// messages dumped by PaintRoot below. // messages dumped by PaintRoot below.
if (profilerNeedsDisplayList && !consoleNeedsDisplayList) { if (profilerNeedsDisplayList && !consoleNeedsDisplayList) {
profiler_tracing("log", ss->str().c_str()); profiler_tracing("log", ss->str().c_str(), TRACING_EVENT);
} else { } else {
fprint_stderr(gfxUtils::sDumpPaintFile, *ss); fprint_stderr(gfxUtils::sDumpPaintFile, *ss);
} }
@ -3877,7 +3877,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
} }
if (profilerNeedsDisplayList && !consoleNeedsDisplayList) { if (profilerNeedsDisplayList && !consoleNeedsDisplayList) {
profiler_tracing("log", ss->str().c_str()); profiler_tracing("log", ss->str().c_str(), TRACING_EVENT);
} else { } else {
fprint_stderr(gfxUtils::sDumpPaintFile, *ss); fprint_stderr(gfxUtils::sDumpPaintFile, *ss);
} }

Просмотреть файл

@ -3252,7 +3252,7 @@ profiler_tracing(const char* aCategory, const char* aMarkerName,
void void
profiler_tracing(const char* aCategory, const char* aMarkerName, profiler_tracing(const char* aCategory, const char* aMarkerName,
UniqueProfilerBacktrace aCause, TracingKind aKind) TracingKind aKind, UniqueProfilerBacktrace aCause)
{ {
MOZ_RELEASE_ASSERT(CorePS::Exists()); MOZ_RELEASE_ASSERT(CorePS::Exists());

Просмотреть файл

@ -416,11 +416,11 @@ enum TracingKind {
// inactive or in privacy mode. // inactive or in privacy mode.
PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory,
const char* aMarkerName, const char* aMarkerName,
TracingKind aKind = TRACING_EVENT)) TracingKind aKind))
PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory,
const char* aMarkerName, const char* aMarkerName,
UniqueProfilerBacktrace aCause, TracingKind aKind,
TracingKind aKind = TRACING_EVENT)) UniqueProfilerBacktrace aCause))
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Output profiles // Output profiles
@ -590,17 +590,6 @@ public:
class MOZ_RAII AutoProfilerTracing class MOZ_RAII AutoProfilerTracing
{ {
public: public:
AutoProfilerTracing(const char* aCategory, const char* aMarkerName,
UniqueProfilerBacktrace aBacktrace
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategory(aCategory)
, mMarkerName(aMarkerName)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing(mCategory, mMarkerName, Move(aBacktrace),
TRACING_INTERVAL_START);
}
AutoProfilerTracing(const char* aCategory, const char* aMarkerName AutoProfilerTracing(const char* aCategory, const char* aMarkerName
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategory(aCategory) : mCategory(aCategory)
@ -610,6 +599,17 @@ public:
profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START); profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START);
} }
AutoProfilerTracing(const char* aCategory, const char* aMarkerName,
UniqueProfilerBacktrace aBacktrace
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategory(aCategory)
, mMarkerName(aMarkerName)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START,
Move(aBacktrace));
}
~AutoProfilerTracing() ~AutoProfilerTracing()
{ {
profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_END); profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_END);

Просмотреть файл

@ -461,7 +461,7 @@ TEST(GeckoProfiler, Markers)
profiler_tracing("A", "C", TRACING_INTERVAL_END); profiler_tracing("A", "C", TRACING_INTERVAL_END);
UniqueProfilerBacktrace bt = profiler_get_backtrace(); UniqueProfilerBacktrace bt = profiler_get_backtrace();
profiler_tracing("B", "A", Move(bt), TRACING_EVENT); profiler_tracing("B", "A", TRACING_EVENT, Move(bt));
{ {
AutoProfilerTracing tracing("C", "A"); AutoProfilerTracing tracing("C", "A");