From 9f45a45a628100d973111b3aac66dede57454b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Tue, 8 Dec 2015 13:25:57 +0100 Subject: [PATCH] Add tracing to upper-level WebRTC calls. Adds tracing to WebRtcSession and corresponding BaseChannel calls to see where time is spent better. BUG=webrtc:5167 R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1505023003 . Cr-Commit-Position: refs/heads/master@{#10934} --- talk/app/webrtc/webrtcsession.cc | 3 +++ talk/media/webrtc/webrtcvideoengine2.cc | 2 ++ talk/session/media/channel.cc | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index ec0456f7cb..d3e8dc5596 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -50,6 +50,7 @@ #include "webrtc/base/logging.h" #include "webrtc/base/stringencode.h" #include "webrtc/base/stringutils.h" +#include "webrtc/base/trace_event.h" #include "webrtc/call.h" #include "webrtc/p2p/base/portallocator.h" #include "webrtc/p2p/base/transportchannel.h" @@ -790,6 +791,7 @@ void WebRtcSession::CreateAnswer( bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, std::string* err_desc) { + TRACE_EVENT0("webrtc", "WebRtcSession::SetLocalDescription"); ASSERT(signaling_thread()->IsCurrent()); // Takes the ownership of |desc| regardless of the result. @@ -844,6 +846,7 @@ bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, std::string* err_desc) { + TRACE_EVENT0("webrtc", "WebRtcSession::SetRemoteDescription"); ASSERT(signaling_thread()->IsCurrent()); // Takes the ownership of |desc| regardless of the result. diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc index e84cdab60d..3f9e8ce423 100644 --- a/talk/media/webrtc/webrtcvideoengine2.cc +++ b/talk/media/webrtc/webrtcvideoengine2.cc @@ -788,6 +788,7 @@ bool WebRtcVideoChannel2::ReceiveCodecsHaveChanged( } bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { + TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); // TODO(pbos): Refactor this to only recreate the send streams once // instead of 4 times. @@ -798,6 +799,7 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { } bool WebRtcVideoChannel2::SetRecvParameters(const VideoRecvParameters& params) { + TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRecvParameters"); LOG(LS_INFO) << "SetRecvParameters: " << params.ToString(); // TODO(pbos): Refactor this to only recreate the recv streams once // instead of twice. diff --git a/talk/session/media/channel.cc b/talk/session/media/channel.cc index 4682c05a98..f4c0e81fe6 100644 --- a/talk/session/media/channel.cc +++ b/talk/session/media/channel.cc @@ -387,6 +387,7 @@ bool BaseChannel::RemoveSendStream(uint32_t ssrc) { bool BaseChannel::SetLocalContent(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); return InvokeOnWorker(Bind(&BaseChannel::SetLocalContent_w, this, content, action, error_desc)); } @@ -394,6 +395,7 @@ bool BaseChannel::SetLocalContent(const MediaContentDescription* content, bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); return InvokeOnWorker(Bind(&BaseChannel::SetRemoteContent_w, this, content, action, error_desc)); } @@ -1462,6 +1464,7 @@ const ContentInfo* VoiceChannel::GetFirstContent( bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "VoiceChannel::SetLocalContent_w"); ASSERT(worker_thread() == rtc::Thread::Current()); LOG(LS_INFO) << "Setting local voice description"; @@ -1506,6 +1509,7 @@ bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content, bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "VoiceChannel::SetRemoteContent_w"); ASSERT(worker_thread() == rtc::Thread::Current()); LOG(LS_INFO) << "Setting remote voice description"; @@ -1745,6 +1749,7 @@ const ContentInfo* VideoChannel::GetFirstContent( bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "VideoChannel::SetLocalContent_w"); ASSERT(worker_thread() == rtc::Thread::Current()); LOG(LS_INFO) << "Setting local video description"; @@ -1789,6 +1794,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content, bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "VideoChannel::SetRemoteContent_w"); ASSERT(worker_thread() == rtc::Thread::Current()); LOG(LS_INFO) << "Setting remote video description"; @@ -2085,6 +2091,7 @@ bool DataChannel::SetDataChannelTypeFromContent( bool DataChannel::SetLocalContent_w(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "DataChannel::SetLocalContent_w"); ASSERT(worker_thread() == rtc::Thread::Current()); LOG(LS_INFO) << "Setting local data description"; @@ -2140,6 +2147,7 @@ bool DataChannel::SetLocalContent_w(const MediaContentDescription* content, bool DataChannel::SetRemoteContent_w(const MediaContentDescription* content, ContentAction action, std::string* error_desc) { + TRACE_EVENT0("webrtc", "DataChannel::SetRemoteContent_w"); ASSERT(worker_thread() == rtc::Thread::Current()); const DataContentDescription* data =