diff --git a/browser/base/content/test/performance/browser_startup_syncIPC.js b/browser/base/content/test/performance/browser_startup_syncIPC.js index 00b8be0e85e3..64e6c22bf3ae 100644 --- a/browser/base/content/test/performance/browser_startup_syncIPC.js +++ b/browser/base/content/test/performance/browser_startup_syncIPC.js @@ -283,14 +283,13 @@ add_task(async function() { let markerData = m[dataCol]; if ( !markerData || - markerData.type != "IPC" || - !markerData.sync || - markerData.direction != "sending" + markerData.category != "IPC" || + markerData.interval != "start" ) { continue; } - markersForCurrentPhase.push(markerData.messageType); + markersForCurrentPhase.push(markerName); } } diff --git a/browser/base/content/test/performance/io/browser.ini b/browser/base/content/test/performance/io/browser.ini index 28e0a1ca00f0..5a2499353639 100644 --- a/browser/base/content/test/performance/io/browser.ini +++ b/browser/base/content/test/performance/io/browser.ini @@ -16,7 +16,7 @@ prefs = gfx.canvas.willReadFrequently.enable=true environment = MOZ_PROFILER_STARTUP=1 - MOZ_PROFILER_STARTUP_FEATURES=js,mainthreadio,ipcmessages + MOZ_PROFILER_STARTUP_FEATURES=js,mainthreadio MOZ_PROFILER_STARTUP_ENTRIES=10000000 [../browser_startup_mainthreadio.js] [../browser_startup_content_mainthreadio.js] diff --git a/devtools/client/performance-new/components/Settings.js b/devtools/client/performance-new/components/Settings.js index 68ff23a57187..12627730841f 100644 --- a/devtools/client/performance-new/components/Settings.js +++ b/devtools/client/performance-new/components/Settings.js @@ -186,11 +186,6 @@ const featureCheckboxes = [ value: "preferencereads", title: "Track Preference Reads", }, - { - name: "IPC Messages", - value: "ipcmessages", - title: "Track IPC messages.", - }, { name: "JS Allocations", value: "jsallocations", diff --git a/dom/media/mediasink/moz.build b/dom/media/mediasink/moz.build index 383bce657182..8875aacea764 100644 --- a/dom/media/mediasink/moz.build +++ b/dom/media/mediasink/moz.build @@ -16,8 +16,6 @@ EXPORTS += [ 'MediaSink.h' ] -include('/ipc/chromium/chromium-config.mozbuild') - FINAL_LIBRARY = 'xul' if CONFIG['CC_TYPE'] in ('clang', 'gcc'): diff --git a/dom/performance/moz.build b/dom/performance/moz.build index 0678920c53db..5e53327d684f 100644 --- a/dom/performance/moz.build +++ b/dom/performance/moz.build @@ -46,6 +46,4 @@ include('/ipc/chromium/chromium-config.mozbuild') MOCHITEST_MANIFESTS += [ 'tests/mochitest.ini' ] -include('/ipc/chromium/chromium-config.mozbuild') - FINAL_LIBRARY = 'xul' diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 8ee4475e0d1a..9d3d4430b8fe 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -35,10 +35,6 @@ using namespace mozilla::tasktracer; #endif -#ifdef MOZ_GECKO_PROFILER -# include "ProfilerMarkerPayload.h" -#endif - // Undo the damage done by mozzconf.h #undef compress @@ -1006,17 +1002,11 @@ bool MessageChannel::Send(Message* aMsg) { return false; } - if (msg->seqno() == 0) { - msg->set_seqno(NextSeqno()); - } - MonitorAutoLock lock(*mMonitor); if (!Connected()) { ReportConnectionError("MessageChannel", msg.get()); return false; } - - AddProfilerMarker(msg.get(), MessageDirection::eSending); SendMessageToLink(msg.release()); return true; } @@ -1541,7 +1531,6 @@ bool MessageChannel::Send(Message* aMsg, Message* aReply) { // msg will be destroyed soon, but name() is not owned by msg. const char* msgName = msg->name(); - AddProfilerMarker(msg.get(), MessageDirection::eSending); SendMessageToLink(msg.release()); while (true) { @@ -1629,8 +1618,6 @@ bool MessageChannel::Send(Message* aMsg, Message* aReply) { MOZ_RELEASE_ASSERT(reply->type() == replyType, "wrong reply type"); MOZ_RELEASE_ASSERT(reply->is_sync()); - AddProfilerMarker(reply.get(), MessageDirection::eReceiving); - *aReply = std::move(*reply); if (aReply->size() >= kMinTelemetryMessageSize) { Telemetry::Accumulate(Telemetry::IPC_REPLY_SIZE, @@ -1681,9 +1668,6 @@ bool MessageChannel::Call(Message* aMsg, Message* aReply) { msg->set_interrupt_remote_stack_depth_guess(mRemoteStackDepthGuess); msg->set_interrupt_local_stack_depth(1 + InterruptStackDepth()); mInterruptStack.push(MessageInfo(*msg)); - - AddProfilerMarker(msg.get(), MessageDirection::eSending); - mLink->SendMessage(msg.release()); while (true) { @@ -1791,8 +1775,6 @@ bool MessageChannel::Call(Message* aMsg, Message* aReply) { // this frame and return the reply. mInterruptStack.pop(); - AddProfilerMarker(&recvd, MessageDirection::eReceiving); - bool is_reply_error = recvd.is_reply_error(); if (!is_reply_error) { *aReply = std::move(recvd); @@ -2105,7 +2087,6 @@ void MessageChannel::DispatchMessage(Message&& aMsg) { IPC_LOG("DispatchMessage: seqno=%d, xid=%d", aMsg.seqno(), aMsg.transaction_id()); - AddProfilerMarker(&aMsg, MessageDirection::eReceiving); { AutoEnterTransaction transaction(this, aMsg); @@ -2144,8 +2125,6 @@ void MessageChannel::DispatchMessage(Message&& aMsg) { if (reply && ChannelConnected == mChannelState) { IPC_LOG("Sending reply seqno=%d, xid=%d", aMsg.seqno(), aMsg.transaction_id()); - AddProfilerMarker(reply.get(), MessageDirection::eSending); - mLink->SendMessage(reply.forget()); } } @@ -2247,7 +2226,6 @@ void MessageChannel::DispatchInterruptMessage(ActorLifecycleProxy* aProxy, MonitorAutoLock lock(*mMonitor); if (ChannelConnected == mChannelState) { - AddProfilerMarker(reply.get(), MessageDirection::eSending); mLink->SendMessage(reply.forget()); } } @@ -2832,19 +2810,6 @@ void MessageChannel::DumpInterruptStack(const char* const pfx) const { } } -void MessageChannel::AddProfilerMarker(const IPC::Message* aMessage, - MessageDirection aDirection) { -#ifdef MOZ_GECKO_PROFILER - if (profiler_feature_active(ProfilerFeature::IPCMessages)) { - int32_t pid = mPeerPid == -1 ? base::GetCurrentProcId() : mPeerPid; - PROFILER_ADD_MARKER_WITH_PAYLOAD( - "IPC", IPC, IPCMarkerPayload, - (pid, aMessage->seqno(), aMessage->type(), mSide, aDirection, - aMessage->is_sync(), TimeStamp::Now())); - } -#endif -} - int32_t MessageChannel::GetTopmostMessageRoutingId() const { MOZ_RELEASE_ASSERT(MessageLoop::current() == mWorkerLoop); if (mCxxStackFrames.empty()) { diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index 60ac2dce54b5..e3e7a5c4f48b 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -50,11 +50,6 @@ class RefCountedMonitor : public Monitor { ~RefCountedMonitor() {} }; -enum class MessageDirection { - eSending, - eReceiving, -}; - enum class SyncSendError { SendSuccess, PreviousTimeout, @@ -468,9 +463,6 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver { // debugger with all threads paused. void DumpInterruptStack(const char* const pfx = "") const; - void AddProfilerMarker(const IPC::Message* aMessage, - MessageDirection aDirection); - private: // Called from both threads size_t InterruptStackDepth() const { diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h index 9ff880c6a8b3..38da466bb3d4 100644 --- a/ipc/glue/ProtocolUtils.h +++ b/ipc/glue/ProtocolUtils.h @@ -627,6 +627,11 @@ inline bool LoggingEnabledFor(const char* aTopLevelProtocol) { #endif } +enum class MessageDirection { + eSending, + eReceiving, +}; + MOZ_NEVER_INLINE void LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid, const char* aContextDescription, diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index bc72a6949cda..fc3bd2504382 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -4742,9 +4742,14 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): + [Whitespace.NL, StmtDecl(Decl(Type.BOOL, sendok.name)), StmtBlock([ - StmtExpr(ExprAssn(sendok, ExprCall( - send, args=[msgexpr, ExprAddrOf(replyexpr)] - ))), + StmtExpr(ExprCall(ExprVar('AUTO_PROFILER_TRACING'), + [ExprLiteral.String("IPC"), + ExprLiteral.String(self.protocol.name + "::" + + md.prettyMsgName()), + ExprVar('OTHER')])), + StmtExpr(ExprAssn(sendok, ExprCall(send, + args=[msgexpr, + ExprAddrOf(replyexpr)]))), ]) ]) ) diff --git a/js/public/ProfilingCategory.h b/js/public/ProfilingCategory.h index 084ac33c23f8..5935adb65402 100644 --- a/js/public/ProfilingCategory.h +++ b/js/public/ProfilingCategory.h @@ -71,9 +71,6 @@ END_CATEGORY \ BEGIN_CATEGORY(DOM, "DOM", "blue") \ SUBCATEGORY(DOM, DOM, "Other") \ - END_CATEGORY \ - BEGIN_CATEGORY(IPC, "IPC", "lightgreen") \ - SUBCATEGORY(IPC, IPC, "Other") \ END_CATEGORY namespace JS { diff --git a/toolkit/components/extensions/schemas/geckoProfiler.json b/toolkit/components/extensions/schemas/geckoProfiler.json index b2efebd00349..d3a46cd1eb92 100644 --- a/toolkit/components/extensions/schemas/geckoProfiler.json +++ b/toolkit/components/extensions/schemas/geckoProfiler.json @@ -39,8 +39,7 @@ "jsallocations", "nostacksampling", "nativeallocations", - "preferencereads", - "ipcmessages" + "preferencereads" ] }, { diff --git a/tools/profiler/core/ProfilerMarkerPayload.cpp b/tools/profiler/core/ProfilerMarkerPayload.cpp index a2edde4e0a91..18e1569b7ba5 100644 --- a/tools/profiler/core/ProfilerMarkerPayload.cpp +++ b/tools/profiler/core/ProfilerMarkerPayload.cpp @@ -967,53 +967,3 @@ void NativeAllocationMarkerPayload::StreamPayload( aUniqueStacks); aWriter.IntProperty("size", mSize); } - -BlocksRingBuffer::Length IPCMarkerPayload::TagAndSerializationBytes() const { - return CommonPropsTagAndSerializationBytes() + - BlocksRingBuffer::SumBytes(mOtherPid, mMessageSeqno, mMessageType, - mSide, mDirection, mSync); -} - -void IPCMarkerPayload::SerializeTagAndPayload( - BlocksRingBuffer::EntryWriter& aEntryWriter) const { - static const DeserializerTag tag = TagForDeserializer(Deserialize); - SerializeTagAndCommonProps(tag, aEntryWriter); - aEntryWriter.WriteObject(mOtherPid); - aEntryWriter.WriteObject(mMessageSeqno); - aEntryWriter.WriteObject(mMessageType); - aEntryWriter.WriteObject(mSide); - aEntryWriter.WriteObject(mDirection); - aEntryWriter.WriteObject(mSync); -} - -// static -UniquePtr IPCMarkerPayload::Deserialize( - BlocksRingBuffer::EntryReader& aEntryReader) { - ProfilerMarkerPayload::CommonProps props = - DeserializeCommonProps(aEntryReader); - auto otherPid = aEntryReader.ReadObject(); - auto messageSeqno = aEntryReader.ReadObject(); - auto messageType = aEntryReader.ReadObject(); - auto mSide = aEntryReader.ReadObject(); - auto mDirection = aEntryReader.ReadObject(); - auto mSync = aEntryReader.ReadObject(); - return UniquePtr( - new IPCMarkerPayload(std::move(props), otherPid, messageSeqno, - messageType, mSide, mDirection, mSync)); -} - -void IPCMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter, - const TimeStamp& aProcessStartTime, - UniqueStacks& aUniqueStacks) const { - using namespace mozilla::ipc; - StreamCommonProps("IPC", aWriter, aProcessStartTime, aUniqueStacks); - aWriter.IntProperty("otherPid", mOtherPid); - aWriter.IntProperty("messageSeqno", mMessageSeqno); - aWriter.StringProperty("messageType", - IPC::StringFromIPCMessageType(mMessageType)); - aWriter.StringProperty("side", mSide == ParentSide ? "parent" : "child"); - aWriter.StringProperty("direction", mDirection == MessageDirection::eSending - ? "sending" - : "receiving"); - aWriter.BoolProperty("sync", mSync); -} diff --git a/tools/profiler/public/GeckoProfiler.h b/tools/profiler/public/GeckoProfiler.h index 1efa1ef43558..b239cbba1a0b 100644 --- a/tools/profiler/public/GeckoProfiler.h +++ b/tools/profiler/public/GeckoProfiler.h @@ -180,10 +180,7 @@ class Vector; \ MACRO(16, "nativeallocations", NativeAllocations, \ "Collect the stacks from a smaller subset of all native " \ - "allocations, biasing towards collecting larger allocations") \ - \ - MACRO(17, "ipcmessages", IPCMessages, \ - "Have the IPC layer track cross-process messages") + "allocations, biasing towards collecting larger allocations") struct ProfilerFeature { # define DECLARE(n_, str_, Name_, desc_) \ diff --git a/tools/profiler/public/ProfilerMarkerPayload.h b/tools/profiler/public/ProfilerMarkerPayload.h index c1dd505f9d7a..184969b82d41 100644 --- a/tools/profiler/public/ProfilerMarkerPayload.h +++ b/tools/profiler/public/ProfilerMarkerPayload.h @@ -16,7 +16,6 @@ #include "mozilla/UniquePtr.h" #include "mozilla/Preferences.h" #include "mozilla/UniquePtrExtensions.h" -#include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/net/TimingStruct.h" #include "nsString.h" @@ -704,43 +703,6 @@ class NativeAllocationMarkerPayload : public ProfilerMarkerPayload { int64_t mSize; }; -class IPCMarkerPayload : public ProfilerMarkerPayload { - public: - IPCMarkerPayload(int32_t aOtherPid, int32_t aMessageSeqno, - IPC::Message::msgid_t aMessageType, mozilla::ipc::Side aSide, - mozilla::ipc::MessageDirection aDirection, bool aSync, - const mozilla::TimeStamp& aStartTime) - : ProfilerMarkerPayload(aStartTime, aStartTime), - mOtherPid(aOtherPid), - mMessageSeqno(aMessageSeqno), - mMessageType(aMessageType), - mSide(aSide), - mDirection(aDirection), - mSync(aSync) {} - - DECL_STREAM_PAYLOAD - - private: - IPCMarkerPayload(CommonProps&& aCommonProps, int32_t aOtherPid, - int32_t aMessageSeqno, IPC::Message::msgid_t aMessageType, - mozilla::ipc::Side aSide, - mozilla::ipc::MessageDirection aDirection, bool aSync) - : ProfilerMarkerPayload(std::move(aCommonProps)), - mOtherPid(aOtherPid), - mMessageSeqno(aMessageSeqno), - mMessageType(aMessageType), - mSide(aSide), - mDirection(aDirection), - mSync(aSync) {} - - int32_t mOtherPid; - int32_t mMessageSeqno; - IPC::Message::msgid_t mMessageType; - mozilla::ipc::Side mSide; - mozilla::ipc::MessageDirection mDirection; - bool mSync; -}; - namespace mozilla { // Serialize a pointed-at ProfilerMarkerPayload, may be null when there are no diff --git a/tools/profiler/tests/browser/browser.ini b/tools/profiler/tests/browser/browser.ini index 21e06644eaa6..5a5026c9f01c 100644 --- a/tools/profiler/tests/browser/browser.ini +++ b/tools/profiler/tests/browser/browser.ini @@ -9,6 +9,5 @@ support-files = [browser_test_feature_jsallocations.js] [browser_test_feature_preferencereads.js] [browser_test_feature_nativeallocations.js] -[browser_test_feature_ipcmessages.js] [browser_test_profile_single_frame_page_info.js] [browser_test_profile_multi_frame_page_info.js] diff --git a/tools/profiler/tests/browser/browser_test_feature_ipcmessages.js b/tools/profiler/tests/browser/browser_test_feature_ipcmessages.js deleted file mode 100644 index 50b03b1c66ab..000000000000 --- a/tools/profiler/tests/browser/browser_test_feature_ipcmessages.js +++ /dev/null @@ -1,92 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -function countIPCMessagesInThread(thread) { - let count = 0; - for (let payload of getPayloadsOfType(thread, "PreferenceRead")) { - if (payload.prefName === "layout.css.dpi") { - count++; - } - } - return count; -} - -/** - * Test the IPCMessage feature. - */ -add_task(async function test_profile_feature_ipcmessges() { - if (!AppConstants.MOZ_GECKO_PROFILER) { - return; - } - Assert.ok( - !Services.profiler.IsActive(), - "The profiler is not currently active" - ); - - startProfiler({ features: ["threads", "ipcmessages"] }); - - const url = BASE_URL + "fixed_height.html"; - await BrowserTestUtils.withNewTab(url, async contentBrowser => { - const contentPid = await ContentTask.spawn( - contentBrowser, - null, - () => Services.appinfo.processID - ); - - info("Wait 100ms so that the tab finishes executing."); - await wait(100); - - info( - "Check that some PreferenceRead profile markers were generated when " + - "the feature is enabled." - ); - { - const { parentThread, contentThread } = await stopProfilerAndGetThreads( - contentPid - ); - - Assert.greater( - getPayloadsOfType(parentThread, "IPC").length, - 0, - "IPC profile markers were recorded for the parent process' main " + - "thread when the IPCMessages feature was turned on." - ); - - Assert.greater( - getPayloadsOfType(contentThread, "IPC").length, - 0, - "IPC profile markers were recorded for the content process' main " + - "thread when the IPCMessages feature was turned on." - ); - } - - startProfiler({ features: ["threads"] }); - info("Now reload the tab with a clean run."); - gBrowser.reload(); - await wait(100); - - info( - "Check that no PreferenceRead markers were recorded when the " + - "feature is turned off." - ); - { - const { parentThread, contentThread } = await stopProfilerAndGetThreads( - contentPid - ); - Assert.equal( - getPayloadsOfType(parentThread, "IPC").length, - 0, - "No IPC profile markers were recorded for the parent process' main " + - "thread when the IPCMessages feature was turned off." - ); - - Assert.equal( - getPayloadsOfType(contentThread, "IPC").length, - 0, - "No IPC profile markers were recorded for the content process' main " + - "thread when the IPCMessages feature was turned off." - ); - } - }); -}); diff --git a/tools/profiler/tests/gtest/moz.build b/tools/profiler/tests/gtest/moz.build index 3f3bd352733b..51718e0e0743 100644 --- a/tools/profiler/tests/gtest/moz.build +++ b/tools/profiler/tests/gtest/moz.build @@ -29,8 +29,6 @@ USE_LIBS += [ 'jsoncpp', ] -include('/ipc/chromium/chromium-config.mozbuild') - FINAL_LIBRARY = 'xul-gtest' if CONFIG['CC_TYPE'] in ('clang', 'gcc'):