mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1884213 - Part 4: Convert Text and Tracing markers to use BaseMarkerType so they gain ETW support. r=mstange,profiler-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D203985
This commit is contained in:
parent
3504404d2b
commit
c9c92ba6bd
@ -138,45 +138,54 @@ inline ProfileBufferBlockIndex AddMarker(const ProfilerString8View& aName,
|
||||
|
||||
namespace mozilla::baseprofiler::markers {
|
||||
// Most common marker type. Others are in BaseProfilerMarkerTypes.h.
|
||||
struct TextMarker {
|
||||
static constexpr Span<const char> MarkerTypeName() {
|
||||
return MakeStringSpan("Text");
|
||||
}
|
||||
struct TextMarker : public BaseMarkerType<TextMarker> {
|
||||
static constexpr const char* Name = "Text";
|
||||
static constexpr const char* Description = "Generic text marker";
|
||||
|
||||
static constexpr bool StoreName = true;
|
||||
|
||||
using MS = MarkerSchema;
|
||||
static constexpr MS::PayloadField PayloadFields[] =
|
||||
// XXX - This is confusingly labeled 'name'. We probably want to fix that.
|
||||
{{"name", MS::InputType::CString, "Details", MS::Format::String,
|
||||
MS::PayloadFlags::Searchable}};
|
||||
|
||||
static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
|
||||
MS::Location::MarkerTable};
|
||||
|
||||
static constexpr const char* ChartLabel = "{marker.data.name}";
|
||||
static constexpr const char* TableLabel =
|
||||
"{marker.name} - {marker.data.name}";
|
||||
|
||||
static void StreamJSONMarkerData(baseprofiler::SpliceableJSONWriter& aWriter,
|
||||
const ProfilerString8View& aText) {
|
||||
aWriter.StringProperty("name", aText);
|
||||
}
|
||||
static MarkerSchema MarkerTypeDisplay() {
|
||||
using MS = MarkerSchema;
|
||||
MS schema{MS::Location::MarkerChart, MS::Location::MarkerTable};
|
||||
schema.SetChartLabel("{marker.data.name}");
|
||||
schema.SetTableLabel("{marker.name} - {marker.data.name}");
|
||||
schema.AddKeyLabelFormatSearchable("name", "Details", MS::Format::String,
|
||||
MS::Searchable::Searchable);
|
||||
return schema;
|
||||
}
|
||||
};
|
||||
|
||||
// Keep this struct in sync with the `gecko_profiler::marker::Tracing` Rust
|
||||
// counterpart.
|
||||
struct Tracing {
|
||||
static constexpr Span<const char> MarkerTypeName() {
|
||||
return MakeStringSpan("tracing");
|
||||
}
|
||||
struct Tracing : public BaseMarkerType<Tracing> {
|
||||
static constexpr const char* Name = "tracing";
|
||||
static constexpr const char* Description = "Generic tracing marker";
|
||||
|
||||
static constexpr bool StoreName = true;
|
||||
|
||||
using MS = MarkerSchema;
|
||||
static constexpr MS::PayloadField PayloadFields[] = {
|
||||
{"category", MS::InputType::CString, "Type", MS::Format::String,
|
||||
MS::PayloadFlags::Searchable}};
|
||||
|
||||
static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
|
||||
MS::Location::MarkerTable,
|
||||
MS::Location::TimelineOverview};
|
||||
|
||||
static void StreamJSONMarkerData(SpliceableJSONWriter& aWriter,
|
||||
const ProfilerString8View& aCategory) {
|
||||
if (aCategory.Length() != 0) {
|
||||
aWriter.StringProperty("category", aCategory);
|
||||
}
|
||||
}
|
||||
static MarkerSchema MarkerTypeDisplay() {
|
||||
using MS = MarkerSchema;
|
||||
MS schema{MS::Location::MarkerChart, MS::Location::MarkerTable,
|
||||
MS::Location::TimelineOverview};
|
||||
schema.AddKeyLabelFormatSearchable("category", "Type", MS::Format::String,
|
||||
MS::Searchable::Searchable);
|
||||
return schema;
|
||||
}
|
||||
};
|
||||
} // namespace mozilla::baseprofiler::markers
|
||||
|
||||
|
@ -784,7 +784,9 @@ class MarkerSchema {
|
||||
Generic = 1,
|
||||
UserMarkers = 1 << 1,
|
||||
Memory = 1 << 2,
|
||||
Scheduling = 1 << 3
|
||||
Scheduling = 1 << 3,
|
||||
Text = 1 << 4,
|
||||
Tracing = 1 << 5
|
||||
};
|
||||
|
||||
// Flags which describe additional information for a PayloadField.
|
||||
|
Loading…
Reference in New Issue
Block a user