Loading ipc/chromium/src/chrome/common/ipc_channel_utils.cc +21 −15 Original line number Diff line number Diff line Loading @@ -30,7 +30,10 @@ void AddIPCProfilerMarker(const Message& aMessage, int32_t aOtherPid, // The current timestamp must be given to the `IPCMarker` payload. [[maybe_unused]] const mozilla::TimeStamp now = mozilla::TimeStamp::Now(); PROFILER_MARKER("IPC", IPC, bool isThreadBeingProfiled = profiler_thread_is_being_profiled_for_markers(); PROFILER_MARKER( "IPC", IPC, mozilla::MarkerOptions( mozilla::MarkerTiming::InstantAt(now), // If the thread is being profiled, add the marker to Loading @@ -39,12 +42,15 @@ void AddIPCProfilerMarker(const Message& aMessage, int32_t aOtherPid, // appear in the main thread's IPC track. Profiler // analysis UI correlates all the IPC markers from // different threads and generates processed markers. profiler_thread_is_being_profiled_for_markers() ? mozilla::MarkerThreadId::CurrentThread() isThreadBeingProfiled ? mozilla::MarkerThreadId::CurrentThread() : mozilla::MarkerThreadId::MainThread()), IPCMarker, now, now, aOtherPid, aMessage.seqno(), aMessage.type(), mozilla::ipc::UnknownSide, aDirection, aPhase, aMessage.is_sync()); IPCMarker, now, now, aOtherPid, aMessage.seqno(), aMessage.type(), mozilla::ipc::UnknownSide, aDirection, aPhase, aMessage.is_sync(), // aOriginThreadId: If the thread is being profiled, do not include a // thread ID, as it's the same as the markers. Only include this field // when the marker is being sent from another thread. isThreadBeingProfiled ? mozilla::MarkerThreadId{} : mozilla::MarkerThreadId::CurrentThread()); } } Loading ipc/glue/MessageChannel.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -2113,6 +2113,8 @@ void MessageChannel::AddProfilerMarker(const IPC::Message& aMessage, !profiler_is_locked_on_current_thread()) { // The current timestamp must be given to the `IPCMarker` payload. [[maybe_unused]] const TimeStamp now = TimeStamp::Now(); bool isThreadBeingProfiled = profiler_thread_is_being_profiled_for_markers(); PROFILER_MARKER( "IPC", IPC, mozilla::MarkerOptions( Loading @@ -2123,11 +2125,15 @@ void MessageChannel::AddProfilerMarker(const IPC::Message& aMessage, // will appear in the main thread's IPC track. Profiler analysis // UI correlates all the IPC markers from different threads and // generates processed markers. profiler_thread_is_being_profiled_for_markers() ? mozilla::MarkerThreadId::CurrentThread() isThreadBeingProfiled ? mozilla::MarkerThreadId::CurrentThread() : mozilla::MarkerThreadId::MainThread()), IPCMarker, now, now, pid, aMessage.seqno(), aMessage.type(), mSide, aDirection, MessagePhase::Endpoint, aMessage.is_sync()); aDirection, MessagePhase::Endpoint, aMessage.is_sync(), // aOriginThreadId: If the thread is being profiled, do not include a // thread ID, as it's the same as the markers. Only include this field // when the marker is being sent from another thread. isThreadBeingProfiled ? mozilla::MarkerThreadId{} : mozilla::MarkerThreadId::CurrentThread()); } } } Loading ipc/glue/MessageChannel.h +11 −1 Original line number Diff line number Diff line Loading @@ -718,7 +718,8 @@ struct IPCMarker { mozilla::TimeStamp aStart, mozilla::TimeStamp aEnd, int32_t aOtherPid, int32_t aMessageSeqno, IPC::Message::msgid_t aMessageType, mozilla::ipc::Side aSide, mozilla::ipc::MessageDirection aDirection, mozilla::ipc::MessagePhase aPhase, bool aSync) { mozilla::ipc::MessagePhase aPhase, bool aSync, mozilla::MarkerThreadId aOriginThreadId) { using namespace mozilla::ipc; // This payload still streams a startTime and endTime property because it // made the migration to MarkerTiming on the front-end easier. Loading @@ -737,6 +738,15 @@ struct IPCMarker { : mozilla::MakeStringSpan("receiving")); aWriter.StringProperty("phase", IPCPhaseToString(aPhase)); aWriter.BoolProperty("sync", aSync); if (!aOriginThreadId.IsUnspecified()) { // Tech note: If `ToNumber()` returns a uint64_t, the conversion to // int64_t is "implementation-defined" before C++20. This is acceptable // here, because this is a one-way conversion to a unique identifier // that's used to visually separate data by thread on the front-end. aWriter.IntProperty( "threadId", static_cast<int64_t>(aOriginThreadId.ThreadId().ToNumber())); } } static mozilla::MarkerSchema MarkerTypeDisplay() { return mozilla::MarkerSchema::SpecialFrontendLocation{}; Loading Loading
ipc/chromium/src/chrome/common/ipc_channel_utils.cc +21 −15 Original line number Diff line number Diff line Loading @@ -30,7 +30,10 @@ void AddIPCProfilerMarker(const Message& aMessage, int32_t aOtherPid, // The current timestamp must be given to the `IPCMarker` payload. [[maybe_unused]] const mozilla::TimeStamp now = mozilla::TimeStamp::Now(); PROFILER_MARKER("IPC", IPC, bool isThreadBeingProfiled = profiler_thread_is_being_profiled_for_markers(); PROFILER_MARKER( "IPC", IPC, mozilla::MarkerOptions( mozilla::MarkerTiming::InstantAt(now), // If the thread is being profiled, add the marker to Loading @@ -39,12 +42,15 @@ void AddIPCProfilerMarker(const Message& aMessage, int32_t aOtherPid, // appear in the main thread's IPC track. Profiler // analysis UI correlates all the IPC markers from // different threads and generates processed markers. profiler_thread_is_being_profiled_for_markers() ? mozilla::MarkerThreadId::CurrentThread() isThreadBeingProfiled ? mozilla::MarkerThreadId::CurrentThread() : mozilla::MarkerThreadId::MainThread()), IPCMarker, now, now, aOtherPid, aMessage.seqno(), aMessage.type(), mozilla::ipc::UnknownSide, aDirection, aPhase, aMessage.is_sync()); IPCMarker, now, now, aOtherPid, aMessage.seqno(), aMessage.type(), mozilla::ipc::UnknownSide, aDirection, aPhase, aMessage.is_sync(), // aOriginThreadId: If the thread is being profiled, do not include a // thread ID, as it's the same as the markers. Only include this field // when the marker is being sent from another thread. isThreadBeingProfiled ? mozilla::MarkerThreadId{} : mozilla::MarkerThreadId::CurrentThread()); } } Loading
ipc/glue/MessageChannel.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -2113,6 +2113,8 @@ void MessageChannel::AddProfilerMarker(const IPC::Message& aMessage, !profiler_is_locked_on_current_thread()) { // The current timestamp must be given to the `IPCMarker` payload. [[maybe_unused]] const TimeStamp now = TimeStamp::Now(); bool isThreadBeingProfiled = profiler_thread_is_being_profiled_for_markers(); PROFILER_MARKER( "IPC", IPC, mozilla::MarkerOptions( Loading @@ -2123,11 +2125,15 @@ void MessageChannel::AddProfilerMarker(const IPC::Message& aMessage, // will appear in the main thread's IPC track. Profiler analysis // UI correlates all the IPC markers from different threads and // generates processed markers. profiler_thread_is_being_profiled_for_markers() ? mozilla::MarkerThreadId::CurrentThread() isThreadBeingProfiled ? mozilla::MarkerThreadId::CurrentThread() : mozilla::MarkerThreadId::MainThread()), IPCMarker, now, now, pid, aMessage.seqno(), aMessage.type(), mSide, aDirection, MessagePhase::Endpoint, aMessage.is_sync()); aDirection, MessagePhase::Endpoint, aMessage.is_sync(), // aOriginThreadId: If the thread is being profiled, do not include a // thread ID, as it's the same as the markers. Only include this field // when the marker is being sent from another thread. isThreadBeingProfiled ? mozilla::MarkerThreadId{} : mozilla::MarkerThreadId::CurrentThread()); } } } Loading
ipc/glue/MessageChannel.h +11 −1 Original line number Diff line number Diff line Loading @@ -718,7 +718,8 @@ struct IPCMarker { mozilla::TimeStamp aStart, mozilla::TimeStamp aEnd, int32_t aOtherPid, int32_t aMessageSeqno, IPC::Message::msgid_t aMessageType, mozilla::ipc::Side aSide, mozilla::ipc::MessageDirection aDirection, mozilla::ipc::MessagePhase aPhase, bool aSync) { mozilla::ipc::MessagePhase aPhase, bool aSync, mozilla::MarkerThreadId aOriginThreadId) { using namespace mozilla::ipc; // This payload still streams a startTime and endTime property because it // made the migration to MarkerTiming on the front-end easier. Loading @@ -737,6 +738,15 @@ struct IPCMarker { : mozilla::MakeStringSpan("receiving")); aWriter.StringProperty("phase", IPCPhaseToString(aPhase)); aWriter.BoolProperty("sync", aSync); if (!aOriginThreadId.IsUnspecified()) { // Tech note: If `ToNumber()` returns a uint64_t, the conversion to // int64_t is "implementation-defined" before C++20. This is acceptable // here, because this is a one-way conversion to a unique identifier // that's used to visually separate data by thread on the front-end. aWriter.IntProperty( "threadId", static_cast<int64_t>(aOriginThreadId.ThreadId().ToNumber())); } } static mozilla::MarkerSchema MarkerTypeDisplay() { return mozilla::MarkerSchema::SpecialFrontendLocation{}; Loading