Bug 1675409 - Migrated LogMarkerPayload to Markers 2.0 API - r=gregtatum

Differential Revision: https://phabricator.services.mozilla.com/D96039
This commit is contained in:
Gerald Squelart 2020-11-18 21:47:24 +00:00
Родитель 46fed8e10f
Коммит 4d9cfb4113
5 изменённых файлов: 27 добавлений и 60 удалений

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

@ -111,26 +111,6 @@ struct UserTimingMeasure {
}
};
struct Log {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("Log");
}
static void StreamJSONMarkerData(SpliceableJSONWriter& aWriter,
const ProfilerString8View& aModule,
const ProfilerString8View& aText) {
aWriter.StringProperty("module", aModule);
aWriter.StringProperty("name", aText);
}
static MarkerSchema MarkerTypeDisplay() {
using MS = MarkerSchema;
MS schema{MS::Location::markerTable};
schema.SetTableLabel("({marker.data.module}) {marker.data.name}");
schema.AddKeyLabelFormat("module", "Module", MS::Format::string);
schema.AddKeyLabelFormat("name", "Name", MS::Format::string);
return schema;
}
};
struct MediaSample {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("MediaSample");

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

@ -3452,10 +3452,6 @@ void TestProfiler() {
"text", mozilla::baseprofiler::category::OTHER, {},
mozilla::baseprofiler::markers::Text{}, "text text"));
MOZ_RELEASE_ASSERT(baseprofiler::AddMarker(
"log", mozilla::baseprofiler::category::OTHER, {},
mozilla::baseprofiler::markers::Log{}, "module", "text"));
MOZ_RELEASE_ASSERT(baseprofiler::AddMarker(
"media sample", mozilla::baseprofiler::category::OTHER, {},
mozilla::baseprofiler::markers::MediaSample{}, 123, 456));
@ -3518,7 +3514,6 @@ void TestProfiler() {
svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"name\": \"UserTimingMeasure\",") !=
svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"name\": \"Log\",") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"name\": \"MediaSample\",") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"display\": [") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"marker-chart\"") != svnpos);
@ -4037,10 +4032,6 @@ void TestPredefinedMarkers() {
buffer, std::string_view("text"), mozilla::baseprofiler::category::OTHER,
{}, mozilla::baseprofiler::markers::Text{}, "text text"));
MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer(
buffer, std::string_view("log"), mozilla::baseprofiler::category::OTHER,
{}, mozilla::baseprofiler::markers::Log{}, "module", "text"));
MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer(
buffer, std::string_view("media"), mozilla::baseprofiler::category::OTHER,
{}, mozilla::baseprofiler::markers::MediaSample{}, 123, 456));

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

@ -38,7 +38,6 @@ namespace geckoprofiler::markers {
using Tracing = mozilla::baseprofiler::markers::Tracing;
using UserTimingMark = mozilla::baseprofiler::markers::UserTimingMark;
using UserTimingMeasure = mozilla::baseprofiler::markers::UserTimingMeasure;
using Log = mozilla::baseprofiler::markers::Log;
using MediaSample = mozilla::baseprofiler::markers::MediaSample;
struct Network {

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

@ -799,9 +799,6 @@ TEST(GeckoProfiler, Markers)
(ts1, ts2, JS::UniqueChars(buffer)));
}
PROFILER_ADD_MARKER_WITH_PAYLOAD("LogMarkerPayload marker", OTHER,
LogMarkerPayload, ("module", "text", ts1));
PROFILER_ADD_MARKER_WITH_PAYLOAD("NativeAllocationMarkerPayload marker",
OTHER, NativeAllocationMarkerPayload,
(ts1, 9876543210, 1234, 5678, nullptr));
@ -908,10 +905,6 @@ TEST(GeckoProfiler, Markers)
{}, geckoprofiler::markers::Text{},
"Text text"));
MOZ_RELEASE_ASSERT(profiler_add_marker("Log", geckoprofiler::category::OTHER,
{}, geckoprofiler::markers::Log{},
"module", "log text"));
MOZ_RELEASE_ASSERT(
profiler_add_marker("MediaSample", geckoprofiler::category::OTHER, {},
geckoprofiler::markers::MediaSample{}, 123, 456));
@ -962,7 +955,6 @@ TEST(GeckoProfiler, Markers)
S_GCMajorMarkerPayload,
S_GCMinorMarkerPayload,
S_GCSliceMarkerPayload,
S_LogMarkerPayload,
S_NativeAllocationMarkerPayload,
S_NetworkMarkerPayload_start,
S_NetworkMarkerPayload_stop,
@ -1335,15 +1327,6 @@ TEST(GeckoProfiler, Markers)
EXPECT_TRUE(payload["stack"].isNull());
EXPECT_EQ_JSON(payload["timings"], Int, 44);
} else if (nameString == "LogMarkerPayload marker") {
EXPECT_EQ(state, S_LogMarkerPayload);
state = State(S_LogMarkerPayload + 1);
EXPECT_EQ(typeString, "Log");
EXPECT_TIMING_INSTANT_AT(ts1Double);
EXPECT_TRUE(payload["stack"].isNull());
EXPECT_EQ_JSON(payload["name"], String, "text");
EXPECT_EQ_JSON(payload["module"], String, "module");
} else if (nameString == "NativeAllocationMarkerPayload marker") {
EXPECT_EQ(state, S_NativeAllocationMarkerPayload);
state = State(S_NativeAllocationMarkerPayload + 1);
@ -1715,7 +1698,6 @@ TEST(GeckoProfiler, Markers)
testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("UserTimingMeasure") !=
testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("Log") != testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("MediaSample") !=
testedSchemaNames.end());
} // markerSchema

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

@ -23,9 +23,6 @@
#include "nsDebugImpl.h"
#include "NSPRLogModulesParser.h"
#include "LogCommandLineHandler.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif
#include "prenv.h"
#ifdef XP_WIN
@ -419,15 +416,33 @@ class LogModuleManager {
#ifdef MOZ_GECKO_PROFILER
if (mAddProfilerMarker && profiler_can_accept_markers()) {
if (aStart) {
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"LogMessages", OTHER, LogMarkerPayload,
(aName, buffToWrite, *aStart, TimeStamp::Now()));
} else {
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"LogMessages", OTHER, LogMarkerPayload,
(aName, buffToWrite, TimeStamp::Now()));
}
struct LogMarker {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("Log");
}
static void StreamJSONMarkerData(
baseprofiler::SpliceableJSONWriter& aWriter,
const ProfilerString8View& aModule,
const ProfilerString8View& aText) {
aWriter.StringProperty("module", aModule);
aWriter.StringProperty("name", aText);
}
static MarkerSchema MarkerTypeDisplay() {
using MS = MarkerSchema;
MS schema{MS::Location::markerTable};
schema.SetTableLabel("({marker.data.module}) {marker.data.name}");
schema.AddKeyLabelFormat("module", "Module", MS::Format::string);
schema.AddKeyLabelFormat("name", "Name", MS::Format::string);
return schema;
}
};
profiler_add_marker(
"LogMessages", geckoprofiler::category::OTHER,
aStart ? MarkerTiming::IntervalUntilNowFrom(*aStart)
: MarkerTiming::InstantNow(),
LogMarker{}, ProfilerString8View::WrapNullTerminatedString(aName),
ProfilerString8View::WrapNullTerminatedString(buffToWrite));
}
#endif