Skip to content

Commit

Permalink
Bug 1351528 (part 2) - Rename TracingMetadata as TracingKind. r=mstange.
Browse files Browse the repository at this point in the history
"Metadata" regularly confuses me, because it suggests something complicated
rather than a simple enum.

This change also has the benefit of removing inconsistent capitalization
("Metadata" vs. "MetaData").
  • Loading branch information
nnethercote committed Mar 29, 2017
1 parent bd636bd commit 565487b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
14 changes: 8 additions & 6 deletions tools/profiler/core/ProfilerMarkers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ ProfilerMarkerPayload::streamCommonProps(const char* aMarkerType,
}
}

ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData)
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory,
TracingKind aKind)
: mCategory(aCategory)
, mMetaData(aMetaData)
, mKind(aKind)
{
}

ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData,
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory,
TracingKind aKind,
UniqueProfilerBacktrace aCause)
: mCategory(aCategory)
, mMetaData(aMetaData)
, mKind(aKind)
{
if (aCause) {
SetStack(mozilla::Move(aCause));
Expand All @@ -77,9 +79,9 @@ ProfilerMarkerTracing::StreamPayload(SpliceableJSONWriter& aWriter,
aWriter.StringProperty("category", GetCategory());
}

if (GetMetaData() == TRACING_INTERVAL_START) {
if (GetKind() == TRACING_INTERVAL_START) {
aWriter.StringProperty("interval", "start");
} else if (GetMetaData() == TRACING_INTERVAL_END) {
} else if (GetKind() == TRACING_INTERVAL_END) {
aWriter.StringProperty("interval", "end");
}
}
Expand Down
8 changes: 4 additions & 4 deletions tools/profiler/core/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3064,7 +3064,7 @@ profiler_add_marker(const char* aMarker, ProfilerMarkerPayload* aPayload)

void
profiler_tracing(const char* aCategory, const char* aInfo,
TracingMetadata aMetaData)
TracingKind aKind)
{
// This function runs both on and off the main thread.

Expand All @@ -3076,13 +3076,13 @@ profiler_tracing(const char* aCategory, const char* aInfo,
return;
}

auto marker = new ProfilerMarkerTracing(aCategory, aMetaData);
auto marker = new ProfilerMarkerTracing(aCategory, aKind);
locked_profiler_add_marker(lock, aInfo, marker);
}

void
profiler_tracing(const char* aCategory, const char* aInfo,
UniqueProfilerBacktrace aCause, TracingMetadata aMetaData)
UniqueProfilerBacktrace aCause, TracingKind aKind)
{
// This function runs both on and off the main thread.

Expand All @@ -3095,7 +3095,7 @@ profiler_tracing(const char* aCategory, const char* aInfo,
}

auto marker =
new ProfilerMarkerTracing(aCategory, aMetaData, mozilla::Move(aCause));
new ProfilerMarkerTracing(aCategory, aKind, mozilla::Move(aCause));
locked_profiler_add_marker(lock, aInfo, marker);
}

Expand Down
6 changes: 3 additions & 3 deletions tools/profiler/public/GeckoProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Promise;

class nsIProfilerStartParams;

enum TracingMetadata {
enum TracingKind {
TRACING_EVENT,
TRACING_INTERVAL_START,
TRACING_INTERVAL_END,
Expand Down Expand Up @@ -124,10 +124,10 @@ using UniqueProfilerBacktrace =
// Adds a tracing marker to the PseudoStack. A no-op if the profiler is
// inactive or in privacy mode.
PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aInfo,
TracingMetadata metaData = TRACING_EVENT))
TracingKind aKind = TRACING_EVENT))
PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aInfo,
UniqueProfilerBacktrace aCause,
TracingMetadata metaData = TRACING_EVENT))
TracingKind aKind = TRACING_EVENT))

// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will be
// started. This call must happen before any other profiler calls (except
Expand Down
8 changes: 4 additions & 4 deletions tools/profiler/public/ProfilerMarkers.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ class ProfilerMarkerPayload
class ProfilerMarkerTracing : public ProfilerMarkerPayload
{
public:
ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData);
ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData,
ProfilerMarkerTracing(const char* aCategory, TracingKind aKind);
ProfilerMarkerTracing(const char* aCategory, TracingKind aKind,
UniqueProfilerBacktrace aCause);

const char *GetCategory() const { return mCategory; }
TracingMetadata GetMetaData() const { return mMetaData; }
TracingKind GetKind() const { return mKind; }

virtual void StreamPayload(SpliceableJSONWriter& aWriter,
const mozilla::TimeStamp& aStartTime,
UniqueStacks& aUniqueStacks) override;

private:
const char *mCategory;
TracingMetadata mMetaData;
TracingKind mKind;
};

class ProfilerMarkerImagePayload : public ProfilerMarkerPayload
Expand Down
2 changes: 1 addition & 1 deletion tools/profiler/tests/gtest/LulTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "gtest/gtest.h"
#include "mozilla/Atomics.h"
#include "LulMain.h"
#include "GeckoProfiler.h" // for TracingMetadata
#include "GeckoProfiler.h" // for TracingKind
#include "platform-linux-lul.h" // for read_procmaps

// Set this to 0 to make LUL be completely silent during tests.
Expand Down

0 comments on commit 565487b

Please sign in to comment.