From ee148dcec6d33fb630dfae35f6e24856005cc04c Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Tue, 30 Jun 2020 14:25:09 +0000 Subject: [PATCH] Bug 1649233 - Add a new ProfilerMarkerPayload that is just a time duration. r=gerald,canaltinova Differential Revision: https://phabricator.services.mozilla.com/D81592 --- tools/profiler/core/ProfilerMarkerPayload.cpp | 26 +++++++++++++++++++ tools/profiler/public/ProfilerMarkerPayload.h | 13 ++++++++++ 2 files changed, 39 insertions(+) diff --git a/tools/profiler/core/ProfilerMarkerPayload.cpp b/tools/profiler/core/ProfilerMarkerPayload.cpp index 909f0b419250..755460bc9095 100644 --- a/tools/profiler/core/ProfilerMarkerPayload.cpp +++ b/tools/profiler/core/ProfilerMarkerPayload.cpp @@ -816,6 +816,32 @@ void GCSliceMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter, } } +ProfileBufferEntryWriter::Length BudgetMarkerPayload::TagAndSerializationBytes() + const { + return CommonPropsTagAndSerializationBytes(); +} + +void BudgetMarkerPayload::SerializeTagAndPayload( + ProfileBufferEntryWriter& aEntryWriter) const { + static const DeserializerTag tag = TagForDeserializer(Deserialize); + SerializeTagAndCommonProps(tag, aEntryWriter); +} + +// static +UniquePtr BudgetMarkerPayload::Deserialize( + ProfileBufferEntryReader& aEntryReader) { + ProfilerMarkerPayload::CommonProps props = + DeserializeCommonProps(aEntryReader); + return UniquePtr( + new BudgetMarkerPayload(std::move(props))); +} + +void BudgetMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter, + const TimeStamp& aProcessStartTime, + UniqueStacks& aUniqueStacks) const { + StreamCommonProps("Budget", aWriter, aProcessStartTime, aUniqueStacks); +} + ProfileBufferEntryWriter::Length GCMajorMarkerPayload::TagAndSerializationBytes() const { return CommonPropsTagAndSerializationBytes() + diff --git a/tools/profiler/public/ProfilerMarkerPayload.h b/tools/profiler/public/ProfilerMarkerPayload.h index 5b5a6a0fcf96..089bc30c6631 100644 --- a/tools/profiler/public/ProfilerMarkerPayload.h +++ b/tools/profiler/public/ProfilerMarkerPayload.h @@ -228,6 +228,19 @@ class TracingMarkerPayload : public ProfilerMarkerPayload { TracingKind mKind; }; +class BudgetMarkerPayload : public ProfilerMarkerPayload { + public: + BudgetMarkerPayload(const mozilla::TimeStamp& aStartTime, + const mozilla::TimeStamp& aEndTime) + : ProfilerMarkerPayload(aStartTime, aEndTime) {} + + DECL_STREAM_PAYLOAD + + private: + explicit BudgetMarkerPayload(CommonProps&& aCommonProps) + : ProfilerMarkerPayload(std::move(aCommonProps)) {} +}; + class FileIOMarkerPayload : public ProfilerMarkerPayload { public: FileIOMarkerPayload(