Skip to content

Instantly share code, notes, and snippets.

@mvines
Created October 24, 2016 17:21
Show Gist options
  • Save mvines/71753df8fc7b17b9b33dfe2dd71517b1 to your computer and use it in GitHub Desktop.
Save mvines/71753df8fc7b17b9b33dfe2dd71517b1 to your computer and use it in GitHub Desktop.
rtc::Thread logging
From fcf83794dc4613251596e00ab27c47cb5c6516e8 Mon Sep 17 00:00:00 2001
From: Michael Vines <mvines@silklabs.com>
Date: Mon, 24 Oct 2016 10:20:24 -0700
Subject: [PATCH] rtc::Thread logging
---
webrtc/base/thread.cc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc
index dc8ccdf..108724b 100644
--- a/webrtc/base/thread.cc
+++ b/webrtc/base/thread.cc
@@ -332,7 +332,9 @@ void Thread::Send(MessageHandler* phandler, uint32_t id, MessageData* pdata) {
msg.message_id = id;
msg.pdata = pdata;
if (IsCurrent()) {
+ LOG(LS_INFO) << this << " IsCurrent ";
phandler->OnMessage(&msg);
+ LOG(LS_INFO) << this << " IsCurrent return ";
return;
}
@@ -341,6 +343,7 @@ void Thread::Send(MessageHandler* phandler, uint32_t id, MessageData* pdata) {
AutoThread thread;
Thread *current_thread = Thread::Current();
ASSERT(current_thread != NULL); // AutoThread ensures this
+ LOG(LS_INFO) << this << " invoked from current_thread of " << current_thread;
bool ready = false;
{
@@ -355,6 +358,8 @@ void Thread::Send(MessageHandler* phandler, uint32_t id, MessageData* pdata) {
// Wait for a reply
WakeUpSocketServer();
+ LOG(LS_INFO) << this << " post WakeUpSocketServer with current_thread of " << current_thread;
+
bool waited = false;
crit_.Enter();
while (!ready) {
@@ -403,6 +408,7 @@ void Thread::ReceiveSendsFromThread(const Thread* source) {
smsg.msg.phandler->OnMessage(&smsg.msg);
crit_.Enter();
+ LOG(LS_INFO) << this << " WakeUp of thread " << smsg.thread << " from thread " << this;
*smsg.ready = true;
smsg.thread->socketserver()->WakeUp();
}
@@ -412,6 +418,7 @@ void Thread::ReceiveSendsFromThread(const Thread* source) {
bool Thread::PopSendMessageFromThread(const Thread* source, _SendMessage* msg) {
for (std::list<_SendMessage>::iterator it = sendlist_.begin();
it != sendlist_.end(); ++it) {
+ LOG(LS_INFO) << this << " poped a message from " << it->thread << " and wanted " << source;
if (it->thread == source || source == NULL) {
*msg = *it;
sendlist_.erase(it);
@@ -422,10 +429,12 @@ bool Thread::PopSendMessageFromThread(const Thread* source, _SendMessage* msg) {
}
void Thread::InvokeBegin() {
+ LOG(LS_INFO) << this << " " << __PRETTY_FUNCTION__;
TRACE_EVENT_BEGIN0("webrtc", "Thread::Invoke");
}
void Thread::InvokeEnd() {
+ LOG(LS_INFO) << this << " " << __PRETTY_FUNCTION__;
TRACE_EVENT_END0("webrtc", "Thread::Invoke");
}
--
2.9.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment