Bug 1631402 - Remove expired IPC_MAIN_THREAD_LATENCY probes, r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D135154
This commit is contained in:
Nika Layzell 2022-01-07 20:33:01 +00:00
parent e87630dcdc
commit 7a827c900c
7 changed files with 4 additions and 70 deletions

View File

@ -86,7 +86,7 @@ struct Copier<T, size, true> {
} // anonymous namespace
PickleIterator::PickleIterator(const Pickle& pickle)
: iter_(pickle.buffers_.Iter()), start_(mozilla::TimeStamp::Now()) {
: iter_(pickle.buffers_.Iter()) {
iter_.Advance(pickle.buffers_, pickle.header_size_);
}
@ -458,17 +458,6 @@ bool Pickle::WriteSentinel(uint32_t sentinel) { return WriteUInt32(sentinel); }
void Pickle::EndRead(PickleIterator& iter, uint32_t ipcMsgType) const {
// FIXME: Deal with the footer somehow...
// DCHECK(iter.iter_.Done());
if (NS_IsMainThread() && ipcMsgType != 0) {
uint32_t latencyMs =
round((mozilla::TimeStamp::Now() - iter.start_).ToMilliseconds());
if (latencyMs >= kMinTelemetryIPCReadLatencyMs) {
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::IPC_READ_MAIN_THREAD_LATENCY_MS,
nsDependentCString(IPC::StringFromIPCMessageType(ipcMsgType)),
latencyMs);
}
}
}
void Pickle::Truncate(PickleIterator* iter) {

View File

@ -32,7 +32,6 @@ class PickleIterator {
friend class Pickle;
mozilla::BufferList<InfallibleAllocPolicy>::IterImpl iter_;
mozilla::TimeStamp start_;
template <typename T>
void CopyInto(T* dest);

View File

@ -30,7 +30,7 @@ Message::Message()
}
Message::Message(int32_t routing_id, msgid_t type, uint32_t segment_capacity,
HeaderFlags flags, bool recordWriteLatency)
HeaderFlags flags)
: UserMessage(&kUserMessageTypeInfo),
Pickle(sizeof(Header), segment_capacity) {
MOZ_COUNT_CTOR(IPC::Message);
@ -46,9 +46,6 @@ Message::Message(int32_t routing_id, msgid_t type, uint32_t segment_capacity,
header()->num_send_rights = 0;
#endif
header()->event_footer_size = 0;
if (recordWriteLatency) {
create_time_ = mozilla::TimeStamp::Now();
}
}
Message::Message(const char* data, int data_len)
@ -72,7 +69,7 @@ Message::Message(Message&& other)
/*static*/ Message* Message::IPDLMessage(int32_t routing_id, msgid_t type,
HeaderFlags flags) {
return new Message(routing_id, type, 0, flags, true);
return new Message(routing_id, type, 0, flags);
}
/*static*/ Message* Message::ForSyncDispatchError(NestedLevel level) {

View File

@ -171,12 +171,9 @@ class Message : public mojo::core::ports::UserMessage, public Pickle {
// Initialize a message with a user-defined type, priority value, and
// destination WebView ID.
//
// NOTE: `recordWriteLatency` is only passed by IPDL generated message code,
// and is used to trigger the IPC_WRITE_LATENCY_MS telemetry.
Message(int32_t routing_id, msgid_t type,
uint32_t segmentCapacity = 0, // 0 for the default capacity.
HeaderFlags flags = HeaderFlags(), bool recordWriteLatency = false);
HeaderFlags flags = HeaderFlags());
Message(const char* data, int data_len);
@ -252,8 +249,6 @@ class Message : public mojo::core::ports::UserMessage, public Pickle {
const char* name() const { return StringFromIPCMessageType(type()); }
const mozilla::TimeStamp& create_time() const { return create_time_; }
uint32_t num_handles() const;
bool is_relay() const { return header()->flags.IsRelay(); }
@ -431,8 +426,6 @@ class Message : public mojo::core::ports::UserMessage, public Pickle {
// deserializing a message.
mutable nsTArray<mozilla::UniqueMachSendRight> attached_send_rights_;
#endif
mozilla::TimeStamp create_time_;
};
class MessageInfo {

View File

@ -135,10 +135,6 @@ namespace ipc {
static const uint32_t kMinTelemetryMessageSize = 4096;
// Note: we round the time we spend to the nearest millisecond. So a min value
// of 1 ms actually captures from 500us and above.
static const uint32_t kMinTelemetryIPCWriteLatencyMs = 1;
// Note: we round the time we spend waiting for a response to the nearest
// millisecond. So a min value of 1 ms actually captures from 500us and above.
// This is used for both the sending and receiving side telemetry for sync IPC,
@ -853,20 +849,6 @@ bool MessageChannel::Send(UniquePtr<Message> aMsg) {
Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE2, aMsg->size());
}
// If the message was created by the IPC bindings, the create time will be
// recorded. Use this information to report the
// IPC_WRITE_MAIN_THREAD_LATENCY_MS (time from message creation to it being
// sent).
if (NS_IsMainThread() && aMsg->create_time()) {
uint32_t latencyMs = round(
(mozilla::TimeStamp::Now() - aMsg->create_time()).ToMilliseconds());
if (latencyMs >= kMinTelemetryIPCWriteLatencyMs) {
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::IPC_WRITE_MAIN_THREAD_LATENCY_MS,
nsDependentCString(aMsg->name()), latencyMs);
}
}
MOZ_RELEASE_ASSERT(!aMsg->is_sync());
MOZ_RELEASE_ASSERT(aMsg->nested_level() != IPC::Message::NESTED_INSIDE_SYNC);

View File

@ -1943,8 +1943,6 @@ def _generateMessageConstructor(md, segmentSize, protocol, forReply=False):
ExprVar(msgid),
ExprLiteral.Int(int(segmentSize)),
flags,
# Pass `true` to recordWriteLatency to collect telemetry
ExprLiteral.TRUE,
],
)
)

View File

@ -15094,30 +15094,6 @@
"description": "Results of displaying add-on installation notifications.",
"releaseChannelCollection": "opt-out"
},
"IPC_READ_MAIN_THREAD_LATENCY_MS": {
"record_in_processes": ["main", "content", "gpu"],
"products": ["firefox", "fennec"],
"alert_emails": ["mlayzell@mozilla.com"],
"bug_numbers": [1342635],
"expires_in_version": "60",
"kind": "exponential",
"high": 500,
"n_buckets": 20,
"keyed": true,
"description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to deserialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
},
"IPC_WRITE_MAIN_THREAD_LATENCY_MS": {
"record_in_processes": ["main", "content", "gpu"],
"products": ["firefox", "fennec"],
"alert_emails": ["mlayzell@mozilla.com"],
"bug_numbers": [1342635],
"expires_in_version": "60",
"kind": "exponential",
"high": 500,
"n_buckets": 20,
"keyed": true,
"description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to serialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
},
"INPUT_EVENT_QUEUED_CLICK_MS": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],