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}
This commit is contained in:
Peter Boström 2015-12-08 13:25:57 +01:00
parent cd6f539a08
commit 9f45a45a62
3 changed files with 13 additions and 0 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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 =