Bug 1508837: Add TextMarker payloads for simple Profiler Markers r=mstange
authorRandell Jesup <rjesup@jesup.org>
Fri, 14 Dec 2018 16:01:19 -0500
changeset 511116 c0f053802584ff2872b860b0ce023873b242de05
parent 511115 5101144bde6a5c05419f4f3b2925a15ca696b1a1
child 511117 d7e75d5ad3de61c89de5ce8e3e8478d4979b34f8
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1508837
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508837: Add TextMarker payloads for simple Profiler Markers r=mstange
dom/base/nsDOMNavigationTiming.cpp
tools/profiler/core/ProfilerMarkerPayload.cpp
tools/profiler/public/ProfilerMarkerPayload.h
--- a/dom/base/nsDOMNavigationTiming.cpp
+++ b/dom/base/nsDOMNavigationTiming.cpp
@@ -328,19 +328,19 @@ void nsDOMNavigationTiming::TTITimeout(n
     if (mLoadedURI) {
       mLoadedURI->GetSpec(spec);
     }
     nsPrintfCString marker("TTFI after %dms (LongTask after %dms) for URL %s",
                            int(elapsed.ToMilliseconds()),
                            int(elapsedLongTask.ToMilliseconds()), spec.get());
 
     DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
-    profiler_add_marker("TTI", MakeUnique<UserTimingMarkerPayload>(
-                                   NS_ConvertASCIItoUTF16(marker), mTTFI,
-                                   docShellId, docShellHistoryId));
+    profiler_add_marker(
+        "TTI", MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mTTFI,
+                                             docShellId, docShellHistoryId));
   }
 #endif
   return;
 }
 
 void nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!mNavigationStart.IsNull());
--- a/tools/profiler/core/ProfilerMarkerPayload.cpp
+++ b/tools/profiler/core/ProfilerMarkerPayload.cpp
@@ -92,16 +92,23 @@ void UserTimingMarkerPayload::StreamPayl
   if (mEndMark.isSome()) {
     aWriter.StringProperty("endMark",
                            NS_ConvertUTF16toUTF8(mEndMark.value()).get());
   } else {
     aWriter.NullProperty("endMark");
   }
 }
 
+void TextMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
+                                      const TimeStamp& aProcessStartTime,
+                                      UniqueStacks& aUniqueStacks) {
+  StreamCommonProps("Text", aWriter, aProcessStartTime, aUniqueStacks);
+  aWriter.StringProperty("name", mText.get());
+}
+
 void DOMEventMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
                                           const TimeStamp& aProcessStartTime,
                                           UniqueStacks& aUniqueStacks) {
   TracingMarkerPayload::StreamPayload(aWriter, aProcessStartTime,
                                       aUniqueStacks);
 
   WriteTime(aWriter, aProcessStartTime, mTimeStamp, "timeStamp");
   aWriter.StringProperty("eventType", NS_ConvertUTF16toUTF8(mEventType).get());
--- a/tools/profiler/public/ProfilerMarkerPayload.h
+++ b/tools/profiler/public/ProfilerMarkerPayload.h
@@ -354,9 +354,43 @@ class LongTaskMarkerPayload : public Pro
  public:
   LongTaskMarkerPayload(const mozilla::TimeStamp& aStartTime,
                         const mozilla::TimeStamp& aEndTime)
       : ProfilerMarkerPayload(aStartTime, aEndTime) {}
 
   DECL_STREAM_PAYLOAD
 };
 
+class TextMarkerPayload : public ProfilerMarkerPayload {
+ public:
+  TextMarkerPayload(const nsACString& aText,
+                    const mozilla::TimeStamp& aStartTime)
+      : ProfilerMarkerPayload(aStartTime, aStartTime), mText(aText) {}
+
+  TextMarkerPayload(const nsACString& aText,
+                    const mozilla::TimeStamp& aStartTime,
+                    const mozilla::TimeStamp& aEndTime)
+      : ProfilerMarkerPayload(aStartTime, aEndTime), mText(aText) {}
+
+  TextMarkerPayload(const nsACString& aText,
+                    const mozilla::TimeStamp& aStartTime,
+                    const mozilla::Maybe<nsID>& aDocShellId,
+                    const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
+      : ProfilerMarkerPayload(aStartTime, aStartTime, aDocShellId,
+                              aDocShellHistoryId),
+        mText(aText) {}
+
+  TextMarkerPayload(const nsACString& aText,
+                    const mozilla::TimeStamp& aStartTime,
+                    const mozilla::TimeStamp& aEndTime,
+                    const mozilla::Maybe<nsID>& aDocShellId,
+                    const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
+      : ProfilerMarkerPayload(aStartTime, aEndTime, aDocShellId,
+                              aDocShellHistoryId),
+        mText(aText) {}
+
+  DECL_STREAM_PAYLOAD
+
+ private:
+  nsCString mText;
+};
+
 #endif  // ProfilerMarkerPayload_h