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

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

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

@ -111,21 +111,6 @@ struct UserTimingMeasure {
}
};
struct LongTask {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("MainThreadLongTask");
}
static void StreamJSONMarkerData(SpliceableJSONWriter& aWriter) {
aWriter.StringProperty("category", "LongTask");
}
static MarkerSchema MarkerTypeDisplay() {
using MS = MarkerSchema;
MS schema{MS::Location::markerChart, MS::Location::markerTable};
schema.AddKeyLabelFormat("category", "Type", MS::Format::string);
return schema;
}
};
struct Log {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("Log");

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

@ -3448,10 +3448,6 @@ void TestProfiler() {
mozilla::baseprofiler::markers::UserTimingMeasure{}, "measure name",
Some(ProfilerString8View("start")), Some(ProfilerString8View("end"))));
MOZ_RELEASE_ASSERT(baseprofiler::AddMarker(
"longtask", mozilla::baseprofiler::category::OTHER, {},
mozilla::baseprofiler::markers::LongTask{}));
MOZ_RELEASE_ASSERT(baseprofiler::AddMarker(
"text", mozilla::baseprofiler::category::OTHER, {},
mozilla::baseprofiler::markers::Text{}, "text text"));
@ -3524,8 +3520,6 @@ void TestProfiler() {
svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"name\": \"Log\",") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"name\": \"MediaSample\",") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"name\": \"MainThreadLongTask\",") !=
svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"display\": [") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"marker-chart\"") != svnpos);
MOZ_RELEASE_ASSERT(profileSV.find("\"marker-table\"") != svnpos);
@ -4039,11 +4033,6 @@ void TestPredefinedMarkers() {
mozilla::Some(mozilla::ProfilerString8View(" start ")),
mozilla::Some(mozilla::ProfilerString8View("end"))));
MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer(
buffer, std::string_view("long task"),
mozilla::baseprofiler::category::OTHER, {},
mozilla::baseprofiler::markers::LongTask{}));
MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer(
buffer, std::string_view("text"), mozilla::baseprofiler::category::OTHER,
{}, mozilla::baseprofiler::markers::Text{}, "text text"));

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

@ -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 LongTask = mozilla::baseprofiler::markers::LongTask;
using Log = mozilla::baseprofiler::markers::Log;
using MediaSample = mozilla::baseprofiler::markers::MediaSample;

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

@ -802,9 +802,6 @@ TEST(GeckoProfiler, Markers)
PROFILER_ADD_MARKER_WITH_PAYLOAD("LogMarkerPayload marker", OTHER,
LogMarkerPayload, ("module", "text", ts1));
PROFILER_ADD_MARKER_WITH_PAYLOAD("LongTaskMarkerPayload marker", OTHER,
LongTaskMarkerPayload, (ts1, ts2));
PROFILER_ADD_MARKER_WITH_PAYLOAD("NativeAllocationMarkerPayload marker",
OTHER, NativeAllocationMarkerPayload,
(ts1, 9876543210, 1234, 5678, nullptr));
@ -907,10 +904,6 @@ TEST(GeckoProfiler, Markers)
Some(mozilla::ProfilerString8View("start")),
Some(mozilla::ProfilerString8View("end"))));
MOZ_RELEASE_ASSERT(profiler_add_marker("LongTask",
geckoprofiler::category::OTHER, {},
geckoprofiler::markers::LongTask{}));
MOZ_RELEASE_ASSERT(profiler_add_marker("Text", geckoprofiler::category::OTHER,
{}, geckoprofiler::markers::Text{},
"Text text"));
@ -970,7 +963,6 @@ TEST(GeckoProfiler, Markers)
S_GCMinorMarkerPayload,
S_GCSliceMarkerPayload,
S_LogMarkerPayload,
S_LongTaskMarkerPayload,
S_NativeAllocationMarkerPayload,
S_NetworkMarkerPayload_start,
S_NetworkMarkerPayload_stop,
@ -1352,14 +1344,6 @@ TEST(GeckoProfiler, Markers)
EXPECT_EQ_JSON(payload["name"], String, "text");
EXPECT_EQ_JSON(payload["module"], String, "module");
} else if (nameString == "LongTaskMarkerPayload marker") {
EXPECT_EQ(state, S_LongTaskMarkerPayload);
state = State(S_LongTaskMarkerPayload + 1);
EXPECT_EQ(typeString, "MainThreadLongTask");
EXPECT_TIMING_INTERVAL_AT(ts1Double, ts2Double);
EXPECT_TRUE(payload["stack"].isNull());
EXPECT_EQ_JSON(payload["category"], String, "LongTask");
} else if (nameString == "NativeAllocationMarkerPayload marker") {
EXPECT_EQ(state, S_NativeAllocationMarkerPayload);
state = State(S_NativeAllocationMarkerPayload + 1);
@ -1731,8 +1715,6 @@ TEST(GeckoProfiler, Markers)
testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("UserTimingMeasure") !=
testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("MainThreadLongTask") !=
testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("Log") != testedSchemaNames.end());
EXPECT_TRUE(testedSchemaNames.find("MediaSample") !=
testedSchemaNames.end());

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

@ -42,9 +42,6 @@
#include "nsThreadSyncDispatch.h"
#include "nsServiceManagerUtils.h"
#include "GeckoProfiler.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif
#include "InputEventStatistics.h"
#include "ThreadEventQueue.h"
#include "ThreadEventTarget.h"
@ -1524,9 +1521,28 @@ void PerformanceCounterState::MaybeReportAccumulatedTime(TimeStamp aNow) {
#ifdef MOZ_GECKO_PROFILER
if (profiler_thread_is_being_profiled()) {
PROFILER_ADD_MARKER_WITH_PAYLOAD(
mCurrentRunnableIsIdleRunnable ? "LongIdleTask" : "LongTask", OTHER,
LongTaskMarkerPayload, (mCurrentTimeSliceStart, aNow));
struct LongTaskMarker {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("MainThreadLongTask");
}
static void StreamJSONMarkerData(
baseprofiler::SpliceableJSONWriter& aWriter) {
aWriter.StringProperty("category", "LongTask");
}
static MarkerSchema MarkerTypeDisplay() {
using MS = MarkerSchema;
MS schema{MS::Location::markerChart, MS::Location::markerTable};
schema.AddKeyLabelFormat("category", "Type", MS::Format::string);
return schema;
}
};
profiler_add_marker(mCurrentRunnableIsIdleRunnable
? ProfilerString8View("LongIdleTask")
: ProfilerString8View("LongTask"),
geckoprofiler::category::OTHER,
MarkerTiming::Interval(mCurrentTimeSliceStart, aNow),
LongTaskMarker{});
}
#endif
}