1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef BaseProfilerMarkerTypes_h
8 #define BaseProfilerMarkerTypes_h
10 // This header contains common marker type definitions.
12 // It #include's "mozilla/BaseProfilerMarkers.h", see that file for how to
13 // define other marker types, and how to add markers to the profiler buffers.
15 // If you don't need to use these common types, #include
16 // "mozilla/BaseProfilerMarkers.h" instead.
18 // Types in this files can be defined without relying on xpcom.
19 // Others are defined in "ProfilerMarkerTypes.h".
21 // !!! /!\ WORK IN PROGRESS /!\ !!!
22 // This file contains draft marker definitions, but most are not used yet.
23 // Further work is needed to complete these definitions, and use them to convert
24 // existing PROFILER_ADD_MARKER calls. See meta bug 1661394.
26 #include "mozilla/BaseProfilerMarkers.h"
28 namespace mozilla::baseprofiler::markers
{
30 struct MediaSampleMarker
{
31 static constexpr Span
<const char> MarkerTypeName() {
32 return MakeStringSpan("MediaSample");
34 static void StreamJSONMarkerData(SpliceableJSONWriter
& aWriter
,
35 int64_t aSampleStartTimeUs
,
36 int64_t aSampleEndTimeUs
) {
37 aWriter
.IntProperty("sampleStartTimeUs", aSampleStartTimeUs
);
38 aWriter
.IntProperty("sampleEndTimeUs", aSampleEndTimeUs
);
40 static MarkerSchema
MarkerTypeDisplay() {
41 using MS
= MarkerSchema
;
42 MS schema
{MS::Location::markerChart
, MS::Location::markerTable
};
43 schema
.AddKeyLabelFormat("sampleStartTimeUs", "Sample start time",
44 MS::Format::microseconds
);
45 schema
.AddKeyLabelFormat("sampleEndTimeUs", "Sample end time",
46 MS::Format::microseconds
);
51 struct ContentBuildMarker
{
52 static constexpr Span
<const char> MarkerTypeName() {
53 return MakeStringSpan("CONTENT_FULL_PAINT_TIME");
55 static void StreamJSONMarkerData(SpliceableJSONWriter
& aWriter
) {}
56 static MarkerSchema
MarkerTypeDisplay() {
57 using MS
= MarkerSchema
;
58 MS schema
{MS::Location::markerChart
, MS::Location::markerTable
};
63 } // namespace mozilla::baseprofiler::markers
65 #endif // BaseProfilerMarkerTypes_h