Skip to content

Commit

Permalink
Bug 1675409 - Removed now-unused ProfilerMarkerPayload and all depend…
Browse files Browse the repository at this point in the history
…encies - r=gregtatum,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D96054
  • Loading branch information
squelart committed Nov 17, 2020
1 parent feea9c6 commit 69caddd
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 2,431 deletions.
4 changes: 0 additions & 4 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,6 @@
# include "nsIWebBrowserPrint.h"
#endif

#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::net;
Expand Down
3 changes: 0 additions & 3 deletions dom/base/ChromeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
#include "nsThreadUtils.h"
#include "mozJSComponentLoader.h"
#include "GeckoProfiler.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif
#include "nsIException.h"

namespace mozilla::dom {
Expand Down
3 changes: 0 additions & 3 deletions dom/base/TimeoutManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#include "TimeoutBudgetManager.h"
#include "mozilla/net/WebSocketEventService.h"
#include "mozilla/MediaManager.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

using namespace mozilla;
using namespace mozilla::dom;
Expand Down
1 change: 0 additions & 1 deletion dom/base/nsDOMNavigationTiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "nsPrintfCString.h"
#include "prtime.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
# include "mozilla/ProfilerMarkerTypes.h"
#endif

Expand Down
3 changes: 0 additions & 3 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
# include "mozilla/a11y/PDocAccessible.h"
#endif
#include "GeckoProfiler.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif
#include "GMPServiceParent.h"
#include "HandlerServiceParent.h"
#include "IHistory.h"
Expand Down
4 changes: 0 additions & 4 deletions dom/performance/Performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRunnable.h"

#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

#define PERFLOG(msg, ...) printf_stderr(msg, ##__VA_ARGS__)

namespace mozilla::dom {
Expand Down
3 changes: 0 additions & 3 deletions gfx/layers/ProfilerScreenshots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include "GeckoProfiler.h"
#include "gfxUtils.h"
#include "nsThreadUtils.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

using namespace mozilla;
using namespace mozilla::gfx;
Expand Down
4 changes: 0 additions & 4 deletions gfx/webrender_bindings/RenderCompositorNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include "mozilla/webrender/RenderThread.h"
#include "mozilla/widget/CompositorWidget.h"

#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

namespace mozilla {
namespace wr {

Expand Down
21 changes: 14 additions & 7 deletions mozglue/baseprofiler/core/ProfileBufferEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,20 @@ void ProfileBuffer::StreamMarkersToJSON(SpliceableJSONWriter& aWriter,
MOZ_ASSERT(static_cast<ProfileBufferEntry::KindUnderlyingType>(type) <
static_cast<ProfileBufferEntry::KindUnderlyingType>(
ProfileBufferEntry::Kind::MODERN_LIMIT));
if (type != ProfileBufferEntry::Kind::Marker ||
!::mozilla::base_profiler_markers_detail::DeserializeAfterKindAndStream(
aER, aWriter, aThreadId, [&](ProfileChunkedBuffer& aChunkedBuffer) {
ProfilerBacktrace backtrace("", &aChunkedBuffer);
backtrace.StreamJSON(aWriter, TimeStamp::ProcessCreation(),
aUniqueStacks);
})) {
bool entryWasFullyRead = false;

if (type == ProfileBufferEntry::Kind::Marker) {
entryWasFullyRead = ::mozilla::base_profiler_markers_detail::
DeserializeAfterKindAndStream(
aER, aWriter, aThreadId,
[&](ProfileChunkedBuffer& aChunkedBuffer) {
ProfilerBacktrace backtrace("", &aChunkedBuffer);
backtrace.StreamJSON(aWriter, TimeStamp::ProcessCreation(),
aUniqueStacks);
});
}

if (!entryWasFullyRead) {
// Not a marker, or marker for another thread.
// We probably didn't read the whole entry, so we need to skip to the end.
aER.SetRemainingBytes(0);
Expand Down
7 changes: 2 additions & 5 deletions mozglue/baseprofiler/public/ProfileBufferEntryKinds.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ enum class ProfileBufferEntryKind : ProfileBufferEntryKindUnderlyingType {
// Any value starting here does *not* represent a `ProfileBufferEntry` and
// requires separate decoding and handling.

// Marker data, including payload.
MarkerData = LEGACY_LIMIT,

// Markers from 2.0 specs.
Marker,
// Markers and their data.
Marker = LEGACY_LIMIT,

// Optional between TimeBeforeCompactStack and CompactStack.
UnresponsiveDurationMs,
Expand Down
4 changes: 0 additions & 4 deletions netwerk/protocol/http/HttpChannelChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@
# include "GeckoTaskTracer.h"
#endif

#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

#include <functional>

using namespace mozilla::dom;
Expand Down
4 changes: 0 additions & 4 deletions netwerk/protocol/http/nsHttpChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@
# include "GeckoTaskTracer.h"
#endif

#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif

namespace mozilla {

using namespace dom;
Expand Down
87 changes: 15 additions & 72 deletions tools/profiler/core/ProfileBufferEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "platform.h"
#include "ProfileBuffer.h"
#include "ProfilerBacktrace.h"
#include "ProfilerMarkerPayload.h"

#include "jsapi.h"
#include "jsfriendapi.h"
Expand Down Expand Up @@ -636,7 +635,6 @@ class EntryGetter {
// )+
// */
// )
// | MarkerData
// | Marker
// | ( /* Counters */
// CounterId
Expand Down Expand Up @@ -1154,78 +1152,23 @@ void ProfileBuffer::StreamMarkersToJSON(SpliceableJSONWriter& aWriter,
MOZ_ASSERT(static_cast<ProfileBufferEntry::KindUnderlyingType>(type) <
static_cast<ProfileBufferEntry::KindUnderlyingType>(
ProfileBufferEntry::Kind::MODERN_LIMIT));
// Code should *return* from the switch if the entry was fully read.
// Code should *break* from the switch if the entry was not fully read (we
// then need to adjust the reader position to the end of the entry, as
// expected by the reader code.)
switch (type) {
case ProfileBufferEntry::Kind::MarkerData:
if (aER.ReadObject<int>() != aThreadId) {
break; // Entry not fully read.
}
aWriter.StartArrayElement();
{
// Extract the information from the buffer:
// Each entry is made up of the following:
//
// [
// ProfileBufferEntry::Kind::MarkerData, <- already read
// threadId, <- already read
// name, <- next location in entries
// startTime,
// endTime,
// phase,
// categoryPair,
// payload
// ]
auto name = aER.ReadObject<std::string>();
auto startTime = aER.ReadObject<double>();
auto endTime = aER.ReadObject<double>();
auto phase = aER.ReadObject<uint8_t>();
const JS::ProfilingCategoryPairInfo& info =
GetProfilingCategoryPairInfo(
static_cast<JS::ProfilingCategoryPair>(
aER.ReadObject<uint32_t>()));
auto payload = aER.ReadObject<UniquePtr<ProfilerMarkerPayload>>();

MOZ_ASSERT(aER.RemainingBytes() == 0);

// Now write this information to JSON with the following schema:
// [name, startTime, endTime, phase, category, data]
aUniqueStacks.mUniqueStrings->WriteElement(aWriter, name);
aWriter.DoubleElement(startTime);
aWriter.DoubleElement(endTime);
aWriter.IntElement(phase);
aWriter.IntElement(unsigned(info.mCategory));
if (payload) {
aWriter.StartObjectElement(SpliceableJSONWriter::SingleLineStyle);
{
payload->StreamPayload(aWriter, aProcessStartTime, aUniqueStacks);
}
aWriter.EndObject();
}
}
aWriter.EndArray();
return; // Entry fully read.

case ProfileBufferEntry::Kind::Marker:
if (mozilla::base_profiler_markers_detail::
DeserializeAfterKindAndStream(
aER, aWriter, aThreadId,
[&](ProfileChunkedBuffer& aChunkedBuffer) {
ProfilerBacktrace backtrace("", &aChunkedBuffer);
backtrace.StreamJSON(aWriter, aProcessStartTime,
aUniqueStacks);
})) {
return; // Entry fully read.
}
break; // Entry not fully read.

default:
break; // Entry not fully read.
bool entryWasFullyRead = false;

if (type == ProfileBufferEntry::Kind::Marker) {
entryWasFullyRead =
mozilla::base_profiler_markers_detail::DeserializeAfterKindAndStream(
aER, aWriter, aThreadId,
[&](ProfileChunkedBuffer& aChunkedBuffer) {
ProfilerBacktrace backtrace("", &aChunkedBuffer);
backtrace.StreamJSON(aWriter, aProcessStartTime, aUniqueStacks);
});
}

aER.SetRemainingBytes(0);
if (!entryWasFullyRead) {
// The entry was not a marker, or it was a marker for another thread.
// We probably didn't read the whole entry, so we need to skip to the end.
aER.SetRemainingBytes(0);
}
});
}

Expand Down
Loading

0 comments on commit 69caddd

Please sign in to comment.