зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1319669 - Add TaskTracer labels for IPC messages. r=cyu,billm
--HG-- extra : rebase_source : e5de9974d2110fa717c5ecfc295110c2d6939cd2
This commit is contained in:
Родитель
ac11da5245
Коммит
3de5fae4cb
|
@ -538,13 +538,6 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
|
|||
" with type " << m.type();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
AutoSaveCurTraceInfo saveCurTraceInfo;
|
||||
SetCurTraceInfo(m.header()->source_event_id,
|
||||
m.header()->parent_task_id,
|
||||
m.header()->source_event_type);
|
||||
#endif
|
||||
|
||||
if (m.routing_id() == MSG_ROUTING_NONE &&
|
||||
m.type() == HELLO_MESSAGE_TYPE) {
|
||||
// The Hello message contains only the process id.
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "chrome/common/file_descriptor_set_posix.h"
|
||||
#endif
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
#include "GeckoTaskTracer.h"
|
||||
#include "GeckoTaskTracerImpl.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/Move.h"
|
||||
|
@ -145,4 +145,39 @@ uint32_t Message::num_fds() const {
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
void *MessageTask() {
|
||||
return reinterpret_cast<void*>(&MessageTask);
|
||||
}
|
||||
|
||||
void
|
||||
Message::TaskTracerDispatch() {
|
||||
header()->task_id = GenNewUniqueTaskId();
|
||||
uintptr_t* vtab = reinterpret_cast<uintptr_t*>(&MessageTask);
|
||||
LogVirtualTablePtr(header()->task_id,
|
||||
header()->source_event_id,
|
||||
vtab);
|
||||
LogDispatch(header()->task_id,
|
||||
header()->parent_task_id,
|
||||
header()->source_event_id,
|
||||
header()->source_event_type);
|
||||
}
|
||||
|
||||
Message::AutoTaskTracerRun::AutoTaskTracerRun(Message& aMsg)
|
||||
: mMsg(aMsg)
|
||||
, mTaskId(mMsg.header()->task_id)
|
||||
, mSourceEventId(mMsg.header()->source_event_id) {
|
||||
LogBegin(mMsg.header()->task_id,
|
||||
mMsg.header()->source_event_id);
|
||||
SetCurTraceInfo(mMsg.header()->source_event_id,
|
||||
mMsg.header()->task_id,
|
||||
mMsg.header()->source_event_type);
|
||||
}
|
||||
|
||||
Message::AutoTaskTracerRun::~AutoTaskTracerRun() {
|
||||
AddLabel("IPC Message %s", mMsg.name());
|
||||
LogEnd(mTaskId, mSourceEventId);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace IPC
|
||||
|
|
|
@ -272,6 +272,19 @@ class Message : public Pickle {
|
|||
header()->flags |= INTERRUPT_BIT;
|
||||
}
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
void TaskTracerDispatch();
|
||||
class AutoTaskTracerRun
|
||||
: public mozilla::tasktracer::AutoSaveCurTraceInfo {
|
||||
Message& mMsg;
|
||||
uint64_t mTaskId;
|
||||
uint64_t mSourceEventId;
|
||||
public:
|
||||
explicit AutoTaskTracerRun(Message& aMsg);
|
||||
~AutoTaskTracerRun();
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
protected:
|
||||
#endif
|
||||
|
@ -311,6 +324,7 @@ class Message : public Pickle {
|
|||
// Sequence number
|
||||
int32_t seqno;
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
uint64_t task_id;
|
||||
uint64_t source_event_id;
|
||||
uint64_t parent_task_id;
|
||||
mozilla::tasktracer::SourceEventType source_event_type;
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
#include "nsISupportsImpl.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
#include "GeckoTaskTracer.h"
|
||||
using namespace mozilla::tasktracer;
|
||||
#endif
|
||||
|
||||
using mozilla::Move;
|
||||
|
||||
// Undo the damage done by mozzconf.h
|
||||
|
@ -979,6 +984,9 @@ MessageChannel::OnMessageReceivedFromLink(Message&& aMsg)
|
|||
// blocked. This is okay, since we always check for pending events before
|
||||
// blocking again.
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
aMsg.TaskTracerDispatch();
|
||||
#endif
|
||||
RefPtr<MessageTask> task = new MessageTask(this, Move(aMsg));
|
||||
mPending.insertBack(task);
|
||||
|
||||
|
@ -1079,6 +1087,9 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
|
|||
SyncStackFrame frame(this, false);
|
||||
NeuteredWindowRegion neuteredRgn(mFlags & REQUIRE_DEFERRED_MESSAGE_PROTECTION);
|
||||
#endif
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
AutoScopedLabel autolabel("sync message %s", aMsg->name());
|
||||
#endif
|
||||
|
||||
CxxStackFrame f(*this, OUT_MESSAGE, msg);
|
||||
|
||||
|
@ -1271,6 +1282,9 @@ MessageChannel::Call(Message* aMsg, Message* aReply)
|
|||
#ifdef OS_WIN
|
||||
SyncStackFrame frame(this, true);
|
||||
#endif
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
AutoScopedLabel autolabel("sync message %s", aMsg->name());
|
||||
#endif
|
||||
|
||||
// This must come before MonitorAutoLock, as its destructor acquires the
|
||||
// monitor lock.
|
||||
|
@ -1416,6 +1430,9 @@ MessageChannel::Call(Message* aMsg, Message* aReply)
|
|||
// own the monitor.
|
||||
size_t stackDepth = InterruptStackDepth();
|
||||
{
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
Message::AutoTaskTracerRun tasktracerRun(recvd);
|
||||
#endif
|
||||
MonitorAutoUnlock unlock(*mMonitor);
|
||||
|
||||
CxxStackFrame frame(*this, IN_MESSAGE, &recvd);
|
||||
|
@ -1675,6 +1692,9 @@ MessageChannel::DispatchMessage(Message &&aMsg)
|
|||
MOZ_RELEASE_ASSERT(!aMsg.is_sync() || id == transaction.TransactionID());
|
||||
|
||||
{
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
Message::AutoTaskTracerRun tasktracerRun(aMsg);
|
||||
#endif
|
||||
MonitorAutoUnlock unlock(*mMonitor);
|
||||
CxxStackFrame frame(*this, IN_MESSAGE, &aMsg);
|
||||
|
||||
|
@ -1711,6 +1731,9 @@ MessageChannel::DispatchSyncMessage(const Message& aMsg, Message*& aReply)
|
|||
int nestedLevel = aMsg.nested_level();
|
||||
|
||||
MOZ_RELEASE_ASSERT(nestedLevel == IPC::Message::NOT_NESTED || NS_IsMainThread());
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
AutoScopedLabel autolabel("sync message %s", aMsg.name());
|
||||
#endif
|
||||
|
||||
MessageChannel* dummy;
|
||||
MessageChannel*& blockingVar = mSide == ChildSide && NS_IsMainThread() ? gParentProcessBlocker : dummy;
|
||||
|
|
Загрузка…
Ссылка в новой задаче