summaryrefslogtreecommitdiff
path: root/TAO/utils
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2013-04-11 16:39:42 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2013-04-11 16:39:42 +0000
commitefc9cce557a187e7620616c742645b085f114c88 (patch)
treef1a7f20f418437d6ac5cca6a10ebafc4a13d1927 /TAO/utils
parent537046fb5253868dbf1cb8573b00f1f3d5a9ded4 (diff)
downloadATCD-efc9cce557a187e7620616c742645b085f114c88.tar.gz
Thu Apr 11 16:16:21 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'TAO/utils')
-rw-r--r--TAO/utils/logWalker/HostProcess.cpp43
-rw-r--r--TAO/utils/logWalker/HostProcess.h12
-rw-r--r--TAO/utils/logWalker/Invocation.cpp133
-rw-r--r--TAO/utils/logWalker/Invocation.h6
-rw-r--r--TAO/utils/logWalker/Log.cpp18
-rw-r--r--TAO/utils/logWalker/PeerProcess.cpp136
-rw-r--r--TAO/utils/logWalker/PeerProcess.h41
-rw-r--r--TAO/utils/logWalker/Session.cpp41
-rw-r--r--TAO/utils/logWalker/Session.h13
-rw-r--r--TAO/utils/logWalker/Thread.cpp86
-rw-r--r--TAO/utils/logWalker/Thread.h8
11 files changed, 422 insertions, 115 deletions
diff --git a/TAO/utils/logWalker/HostProcess.cpp b/TAO/utils/logWalker/HostProcess.cpp
index 486911f4a8c..e2449b14b0a 100644
--- a/TAO/utils/logWalker/HostProcess.cpp
+++ b/TAO/utils/logWalker/HostProcess.cpp
@@ -25,7 +25,7 @@ HostProcess::~HostProcess (void)
!i.done();
i++)
{
- delete reinterpret_cast<ACE_CString *>(i.next()->item_);
+ delete reinterpret_cast<Endpoint *>(i.next()->item_);
}
for (ThreadList::ITERATOR i(this->threads_);
!i.done();
@@ -77,9 +77,10 @@ HostProcess::find_thread (long tid, size_t offset)
}
Thread *
-HostProcess::find_thread_for_peer (const ACE_CString &addr, Session &session)
+HostProcess::find_thread_for_peer (const ACE_CString &addr)
{
Thread *thr = 0;
+ Endpoint ep (addr.c_str());
for (ACE_DLList_Iterator<Thread> i(threads_);
!i.done();
i.advance())
@@ -89,7 +90,7 @@ HostProcess::find_thread_for_peer (const ACE_CString &addr, Session &session)
if (pp == 0)
continue;
- if (pp->match_server_addr(addr, session))
+ if (pp->match_server_addr(ep))
return thr;
}
return 0;
@@ -115,7 +116,8 @@ HostProcess::find_peer (const ACE_CString &addr)
{
PeerProcess *pp = 0;
- (void)this->by_addr_.find(addr,pp);
+ Endpoint ep (addr.c_str());
+ (void)this->by_addr_.find(ep,pp);
return pp;
}
@@ -143,31 +145,31 @@ HostProcess::pid (void) const
}
bool
-HostProcess::has_endpoint (ACE_CString& addr, bool listen)
+HostProcess::has_endpoint (const Endpoint& addr, bool listen)
{
- ACE_CString *a = 0;
AddrList &list = listen ? this->listen_endpoints_ : this->client_endpoints_;
- for (ACE_DLList_Iterator<ACE_CString> i(list);
+ for (ACE_DLList_Iterator<Endpoint> i(list);
!i.done();
- i.advance())
+ ++i)
{
- i.next(a);
- if (*a == addr)
+ Endpoint *elem;
+ i.next (elem);
+ if (*elem == addr)
return true;
}
return false;
}
void
-HostProcess::add_client_endpoint(ACE_CString &addr)
+HostProcess::add_client_endpoint(const Endpoint &addr)
{
- this->client_endpoints_.insert_tail(new ACE_CString (addr));
+ this->client_endpoints_.insert_tail(new Endpoint (addr));
}
void
-HostProcess::add_listen_endpoint(ACE_CString &addr)
+HostProcess::add_listen_endpoint(const Endpoint &addr)
{
- this->listen_endpoints_.insert_tail(new ACE_CString (addr));
+ this->listen_endpoints_.insert_tail(new Endpoint (addr));
}
void
@@ -181,11 +183,12 @@ HostProcess::add_peer(long handle, PeerProcess *peer)
"add_peer, found existing for %d\n",
handle));
}
- const ACE_CString &addr = peer->is_server() ?
+ const Endpoint &addr = peer->is_server() ?
peer->server_addr() : peer->last_client_addr();
int result = this->by_addr_.bind (addr,peer);
if (result < 0)
- ACE_ERROR ((LM_ERROR,"add_peer, cannot bind to addr %s result = %d, %p\n", addr.c_str(), result, "by_addr_.bind"));
+ ACE_ERROR ((LM_ERROR,"add_peer, cannot bind to addr %s result = %d, %p\n",
+ addr.addr_.c_str(), result, "by_addr_.bind"));
PeerNode *node = new PeerNode (handle,peer);
this->by_handle_.insert_tail(node);
@@ -218,13 +221,13 @@ HostProcess::dump_summary (ostream &strm)
{
strm << " listening on ";
size_t count = 0;
- for (ACE_DLList_Iterator <ACE_CString> t_iter (this->listen_endpoints_);
+ for (ACE_DLList_Iterator <Endpoint> t_iter (this->listen_endpoints_);
!t_iter.done();
t_iter.advance())
{
- ACE_CString *ep = 0;
+ Endpoint *ep = 0;
t_iter.next(ep);
- strm << ep->c_str();
+ strm << ep->addr_.c_str();
if (++count < num)
strm << ", ";
}
@@ -283,6 +286,8 @@ HostProcess::dump_thread_invocations (ostream &strm)
t_iter.next(thr);
thr->dump_invocations (strm);
strm << endl;
+ thr->dump_incidents (strm);
+ strm << endl;
}
}
diff --git a/TAO/utils/logWalker/HostProcess.h b/TAO/utils/logWalker/HostProcess.h
index 5cd9f65b8a4..3ae936ee648 100644
--- a/TAO/utils/logWalker/HostProcess.h
+++ b/TAO/utils/logWalker/HostProcess.h
@@ -33,8 +33,8 @@ struct PeerNode
typedef ACE_DLList<Thread> ThreadList;
typedef ACE_DLList<PeerNode> PeerArray;
-typedef ACE_DLList<ACE_CString> AddrList;
-typedef ACE_RB_Tree<ACE_CString, PeerProcess *, ACE_Less_Than<ACE_CString>, ACE_Null_Mutex> PeerProcs;
+typedef ACE_DLList<Endpoint> AddrList;
+typedef ACE_RB_Tree<Endpoint, PeerProcess *, ACE_Less_Than<Endpoint>, ACE_Null_Mutex> PeerProcs;
/*
* HostProcess encapsulates the state related a specific process instance
@@ -58,7 +58,7 @@ public:
Thread * find_thread (long tid, size_t offset);
// Returns a thread that has a pending peer with the supplied address
- Thread * find_thread_for_peer (const ACE_CString& addr, Session &session);
+ Thread * find_thread_for_peer (const ACE_CString& addr);
// Returns a thread that had previously worked with handle h. May return
// a null pointer.
@@ -70,15 +70,15 @@ public:
// returns true if the supplied endpoint has been visited before. This
// may be either a listen endpoint or a client endpoint used to connect
// to another peer.
- bool has_endpoint (ACE_CString& addr, bool listen);
+ bool has_endpoint (const Endpoint& addr, bool listen);
// adds a new endpoint to the list of listen endpoints. Client endpoints
// are added as part of the process to add a new peer process
- void add_client_endpoint (ACE_CString& addr);
+ void add_client_endpoint (const Endpoint& addr);
// adds a new endpoint to the list of listen endpoints. Client endpoints
// are added as part of the process to add a new peer process
- void add_listen_endpoint (ACE_CString& addr);
+ void add_listen_endpoint (const Endpoint& addr);
// add a peer to the connection list. If the peer is not in the
// by_addr_ table, it will be added there too.
diff --git a/TAO/utils/logWalker/Invocation.cpp b/TAO/utils/logWalker/Invocation.cpp
index a7a67bf03d8..25bd4d1da29 100644
--- a/TAO/utils/logWalker/Invocation.cpp
+++ b/TAO/utils/logWalker/Invocation.cpp
@@ -20,7 +20,10 @@ Invocation::Invocation (PeerProcess *peer, Thread *thr, size_t rid)
peer_(peer),
req_id_(rid),
target_(0),
- handle_(thr->active_handle())
+ handle_(thr->active_handle()),
+ finish_reported_(false),
+ req_level_ (0),
+ repl_level_ (0)
{
}
@@ -179,11 +182,11 @@ Invocation::handle (void) const
bool
Invocation::contains (size_t line)
{
- if (this->req_octets_ == 0 || this->repl_octets_ == 0)
+ if (this->req_octets_ == 0 || this->is_oneway())
return false;
return
line > this->req_octets_->log_posn() &&
- line < this->repl_octets_->log_posn();
+ (this->repl_octets_ == 0 || line < this->repl_octets_->log_posn());
}
size_t
@@ -192,6 +195,12 @@ Invocation::req_line (void)
return this->req_octets_ == 0 ? 0 : this->req_octets_->log_posn();
}
+size_t
+Invocation::repl_line (void)
+{
+ return this->repl_octets_ == 0 ? 0 : this->repl_octets_->log_posn();
+}
+
void
Invocation::new_line (ostream &strm, int indent, int offset, bool add_nl, bool show_indent)
{
@@ -200,19 +209,125 @@ Invocation::new_line (ostream &strm, int indent, int offset, bool add_nl, bool s
strm << "\n";
}
- if (indent > 9)
+ int steps = indent / 20;
+ int extra = indent % 20;
+
+ if (steps > 1)
{
if (show_indent)
- strm << "[indent " << indent << "] ---> ";
+ {
+ strm << "[indent " << steps * 20 << "] --->";
+ extra += (indent > 99) ? 5 : 4;
+ }
else
- strm << " ";
+ {
+ extra += 20;
+ }
}
else
{
- indent += offset;
- while (indent-- > 0)
- strm << " ";
+ extra += (steps * 20);
+ }
+
+ extra += offset;
+ while (extra-- > 0)
+ strm << " ";
+}
+
+void
+Invocation::dump_start_line (ostream &strm, size_t indent)
+{
+ if (this->req_octets_ == 0)
+ return;
+ this->req_level_ = indent;
+ strm << setw(7) << this->req_octets_->log_posn() << " " << setw(0);
+
+ const char *opname = "";
+ const char *dir_1 = "sent to ";
+ const char *dir_2 = " in ";
+
+ if (this->req_octets_ != 0)
+ {
+ opname = this->req_octets_->operation();
+ if (this->req_octets_->sending())
+ {
+ dir_1 = "recv for ";
+ dir_2 = " from ";
+ }
}
+
+ this->new_line (strm, indent, 0, false, true);
+
+ strm << "start request ";
+
+ if (opname == 0 || opname[0] == 0)
+ opname = "<no operation>";
+
+ strm << dir_1;
+ if (this->target_ == 0)
+ strm << "<unknown object>" ;
+ else
+ strm << this->target_->name();
+ strm << dir_2 << this->peer_->id() << ", req " << this->req_id_;
+ strm << " [" << opname << "]";
+ if (this->is_oneway())
+ strm << " oneway";
+ else if (this->repl_octets_ == 0)
+ strm << " <no reply found>";
+ strm << endl;
+}
+
+void
+Invocation::dump_finish_line (ostream &strm, size_t indent)
+{
+ bool is_popped = this->repl_level_ > 0 && indent == this->req_level_;
+
+ if (!is_popped && (this->finish_reported_ || this->is_oneway() || this->repl_octets_ == 0))
+ return;
+
+ if (!this->finish_reported_)
+ {
+ this->repl_level_ = indent;
+ }
+
+ this->finish_reported_ = true;
+
+ strm << setw(7) << this->repl_octets_->log_posn() << " " << setw(0);
+
+ const char *opname = "";
+ const char *dir_2 = " in ";
+
+ if (this->req_octets_ != 0)
+ {
+ opname = this->req_octets_->operation();
+ if (this->req_octets_->sending())
+ {
+ dir_2 = " from ";
+ }
+ }
+
+ if (opname == 0 || opname[0] == 0)
+ {
+ opname = "<no operation>";
+ }
+
+ this->new_line (strm, indent, 0, false, true);
+
+ strm << "reply for " << this->peer_->id() << ", req " << this->req_id_;
+ strm << " [" << opname << "]";
+ if (is_popped)
+ {
+ strm << " (reply received at " << this->repl_level_ << " evaluated)";
+ }
+ else
+ {
+ if (indent != this->req_level_)
+ {
+ strm << " (req at level " << this->req_level_ << " reply at " << indent << ")";
+ }
+ }
+
+ strm << endl;
}
void
diff --git a/TAO/utils/logWalker/Invocation.h b/TAO/utils/logWalker/Invocation.h
index dae1e15c823..278b30d7dec 100644
--- a/TAO/utils/logWalker/Invocation.h
+++ b/TAO/utils/logWalker/Invocation.h
@@ -76,6 +76,7 @@ public:
bool contains (size_t line);
size_t req_line (void);
+ size_t repl_line (void);
void add_notify_incident (const ACE_CString &text, size_t offset);
Thread *waiter (void) const;
@@ -83,6 +84,8 @@ public:
void new_line (ostream &strm, int indent, int offset, bool add_nl, bool show_indent);
void dump_detail (ostream &strm, size_t indent, Dump_Mode mode, bool show_handle);
+ void dump_start_line (ostream &strm, size_t indent);
+ void dump_finish_line (ostream &strm, size_t indent);
void dump_special_details (ostream &strm, size_t indent, const char *opname);
private:
@@ -95,6 +98,9 @@ private:
size_t req_id_;
PeerObject *target_;
long handle_;
+ bool finish_reported_;
+ size_t req_level_;
+ size_t repl_level_;
};
#endif // LOG_WALKER_INVOCATION_H
diff --git a/TAO/utils/logWalker/Log.cpp b/TAO/utils/logWalker/Log.cpp
index bc43e48bb98..0d66aeda899 100644
--- a/TAO/utils/logWalker/Log.cpp
+++ b/TAO/utils/logWalker/Log.cpp
@@ -162,7 +162,7 @@ Log::get_preamble ()
}
}
- this->session_.add_process(this->hostproc_);
+ this->session_.add_process (this->hostproc_);
}
this->thr_ = this->hostproc_->find_thread (tid, this->offset_);
return;
@@ -338,7 +338,7 @@ Log::parse_open_listener_i (void)
char *addr = ACE_OS::strchr(this->info_,'<') +1;
char *c = ACE_OS::strchr(addr,'>');
*c = '\0';
- ACE_CString server_addr(addr);
+ Endpoint server_addr(addr);
this->hostproc_->add_listen_endpoint(server_addr);
}
@@ -548,11 +548,11 @@ Log::parse_complete_connection_i (void)
{
PeerProcess *waiter = 0;
c_iter.next(waiter);
- if (waiter != 0 && waiter->match_server_addr (addr, session_))
+ if (waiter != 0 && waiter->match_server_addr (addr))
{
c_iter.remove();
// ACE_DEBUG ((LM_DEBUG,"%d: complete_connection: purging waiter\n",this->offset_));
- delete waiter;
+ // delete waiter;
break;
}
}
@@ -597,7 +597,7 @@ Log::parse_handler_open_i (bool is_ssl)
{
PeerProcess *waiter = 0;
c_iter.next(waiter);
- if (waiter != 0 && waiter->match_server_addr (addr, session_))
+ if (waiter != 0 && waiter->match_server_addr (addr))
{
pp = waiter;
c_iter.remove();
@@ -606,11 +606,13 @@ Log::parse_handler_open_i (bool is_ssl)
// else
// ACE_DEBUG ((LM_DEBUG,"%d: handler_open: no match waiter addr = %s\n",
// this->offset_, (waiter == 0 ? "<null>" : waiter->server_addr().c_str()) ));
-
}
}
- else
+
+ if (pp == 0)
{
+ // ACE_DEBUG ((LM_DEBUG,"%d: handler_open: calling pop_new_connection, addr = %s\n",
+ // this->offset_, addr));
pp = this->thr_->pop_new_connection();
}
if (pp == 0)
@@ -627,7 +629,7 @@ Log::parse_handler_open_i (bool is_ssl)
{
if (pp->is_server())
{
- Transport *t = new Transport (addr, true, this->offset_);
+ Transport *t = new Transport (local_addr.c_str(), true, this->offset_);
pp->add_transport (t);
this->hostproc_->add_client_endpoint (t->client_endpoint_);
}
diff --git a/TAO/utils/logWalker/PeerProcess.cpp b/TAO/utils/logWalker/PeerProcess.cpp
index f3c03a6b03f..3d4dbfac7ce 100644
--- a/TAO/utils/logWalker/PeerProcess.cpp
+++ b/TAO/utils/logWalker/PeerProcess.cpp
@@ -10,11 +10,88 @@
#include "Thread.h"
#include "Session.h"
+Endpoint::Endpoint (void)
+ : addr_ (),
+ host_ (),
+ port_ (),
+ is_localhost_ (false),
+ role_ (ER_UNKNOWN)
+{
+}
+
+Endpoint::Endpoint (const char *addr, EndpointRole role)
+ : addr_ (),
+ host_ (),
+ port_ (),
+ is_localhost_ (false),
+ role_ (ER_UNKNOWN)
+{
+ this->assign (addr, role);
+}
+
+Endpoint::Endpoint (const Endpoint &other)
+{
+ operator = (other);
+}
+
+void
+Endpoint::assign (const char *addr, EndpointRole role)
+{
+ this->addr_ = addr;
+ this->role_ = role;
+ size_t p = addr_.rfind (':');
+ this->port_ = addr_.substring(p);
+ this->host_ = addr_.substring(0,p);
+
+ this->is_localhost_ = this->host_ == "localhost" ||
+ this->host_ == "127.0.0.1" || this->host_ == "[::1]";
+}
+
+Endpoint&
+Endpoint::operator = (const Endpoint &other)
+{
+ this->addr_ = other.addr_;
+ this->role_ = other.role_;
+ this->host_ = other.host_;
+ this->port_ = other.port_;
+ this->is_localhost_ = other.is_localhost_;
+ return *this;
+}
+
+bool
+Endpoint::operator == (const Endpoint &other) const
+{
+ if (this->port_ != other.port_)
+ return false;
+ if (this->is_localhost_ != other.is_localhost_)
+ return false;
+ if (this->is_localhost_)
+ return true;
+ if (this->host_ == other.host_)
+ return true;
+ return Session::is_equivalent (this->host_, other.host_);
+}
+
+bool
+Endpoint::operator < (const Endpoint &other) const
+{
+ if (this->port_ < other.port_)
+ return true;
+ if (this->host_ < other.host_)
+ return true;
+ return false;
+}
+
+bool
+Endpoint::is_client (void) const
+{
+ return this->role_ != ER_SERVER;
+}
+
Transport::Transport (const char *addr, bool is_client, size_t offset)
: handle_ (0),
- client_endpoint_ (addr),
- local_is_client_ (is_client),
+ client_endpoint_ (addr, is_client ? ER_CLIENT : ER_SERVER),
open_offset_ (offset),
close_offset_ (0)
{
@@ -32,11 +109,9 @@ PeerProcess::nextIdent(bool is_server)
PeerProcess::PeerProcess (size_t offset, bool is_server)
: owner_ (0),
remote_ (0),
- server_port_(),
- server_host_(),
- server_(is_server),
+ server_ep_(),
+ is_server_role_(is_server),
ssl_(false),
- localhost_(false),
origin_offset_ (offset),
objects_ (),
object_by_index_ ()
@@ -64,41 +139,22 @@ PeerProcess::~PeerProcess (void)
void
PeerProcess::set_server_addr (const ACE_CString &addr)
{
- size_t p = addr.rfind (':');
- this->server_port_ = addr.substring(p);
- this->server_host_ = addr.substring(0,p);
-
- this->localhost_ = this->server_host_ == "localhost" ||
- this->server_host_ == "127.0.0.1" || this->server_host_ == "[::1]";
+ this->server_ep_.assign (addr.c_str(), this->is_server_role_ ? ER_SERVER : ER_CLIENT);
}
bool
-PeerProcess::match_server_addr (const ACE_CString &addr, Session &session) const
+PeerProcess::match_server_addr (const Endpoint &addr) const
{
- size_t p = addr.rfind (':');
- ACE_CString port = addr.substring (p);
- ACE_CString host = addr.substring (0,p);
- if (port != this->server_port_)
- return false;
-
- if (this->localhost_)
- {
- return host == "localhost" || host == "127.0.0.1" || host == "[::1]";
- }
-
- if (this->server_host_ == host)
- return true;
-
- return session.is_equivalent (this->server_host_, host);
+ return this->server_ep_ == addr;
}
-ACE_CString
+const Endpoint &
PeerProcess::server_addr (void) const
{
- return this->server_host_ + this->server_port_;
+ return this->server_ep_;
}
-const ACE_CString&
+const Endpoint &
PeerProcess::last_client_addr (void) const
{
return this->last_transport_->client_endpoint_;
@@ -107,7 +163,7 @@ PeerProcess::last_client_addr (void) const
bool
PeerProcess::is_server (void) const
{
- return this->server_;
+ return this->is_server_role_;
}
size_t
@@ -159,8 +215,8 @@ PeerProcess::match_hosts (Session *session)
// on the server addr. But if the local side is the server
// then this wants to find the remote based on the Transport
// instance
- if (this->server_)
- this->remote_ = session->find_host(this->server_host_, true);
+ if (this->is_server_role_)
+ this->remote_ = session->find_host(this->server_ep_, true);
else
{
Transport *t = 0;
@@ -272,11 +328,11 @@ PeerProcess::dump_summary (ostream &strm)
strm << " is a ";
if (this->ssl_)
strm << "secure ";
- if (this->server_)
+ if (this->is_server_role_)
strm << "server at ";
else
strm << "client to ";
- strm << this->server_host_ << this->server_port_;
+ strm << this->server_ep_.host_ << ":" << this->server_ep_.port_;
strm << " with " << num_transports << " connections, ";
strm << " referenced " << this->objects_.current_size()
<< " objects in " << this->invocations_.size() << " invocations";
@@ -288,8 +344,8 @@ PeerProcess::dump_summary (ostream &strm)
Transport *tran = 0;
i.next(tran);
strm << " connection[" << tran->handle_ << "] ";
- strm << (tran->local_is_client_ ? "to " : "from ");
- strm << tran->client_endpoint_;
+ strm << (tran->client_endpoint_.is_client() ? "to " : "from ");
+ strm << tran->client_endpoint_.host_ << ":" << tran->client_endpoint_.port_;
strm << " created line " << tran->open_offset_;
if (tran->close_offset_)
strm << " closed line " << tran->close_offset_;
@@ -302,7 +358,7 @@ PeerProcess::dump_object_detail (ostream &strm)
{
strm << this->objects_.current_size()
<< " Objects referenced";
- if (this->server_)
+ if (this->is_server_role_)
strm << " in ";
else
strm << " by ";
@@ -329,7 +385,7 @@ void
PeerProcess::dump_invocation_detail (ostream &strm)
{
strm << "\n " << this->invocations_.size() << " Invocations ";
- strm << (this->server_ ? "to " : "from ");
+ strm << (this->is_server_role_ ? "to " : "from ");
if (this->remote_)
strm << remote_->proc_name();
else
diff --git a/TAO/utils/logWalker/PeerProcess.h b/TAO/utils/logWalker/PeerProcess.h
index f90e4004c34..91378d7d9dd 100644
--- a/TAO/utils/logWalker/PeerProcess.h
+++ b/TAO/utils/logWalker/PeerProcess.h
@@ -19,13 +19,38 @@ class Invocation;
class Session;
class Thread;
+
+enum EndpointRole {
+ ER_UNKNOWN,
+ ER_CLIENT,
+ ER_SERVER
+};
+
+class Endpoint
+{
+public:
+ Endpoint (void);
+ Endpoint (const Endpoint &other);
+ Endpoint (const char *addr, EndpointRole role = ER_UNKNOWN);
+ void assign (const char *addr, EndpointRole role = ER_UNKNOWN);
+ Endpoint & operator = (const Endpoint &other);
+ bool operator == (const Endpoint &other) const;
+ bool operator < (const Endpoint &other) const;
+ bool is_client (void) const;
+
+ ACE_CString addr_;
+ ACE_CString host_;
+ ACE_CString port_;
+ bool is_localhost_;
+ EndpointRole role_;
+};
+
class Transport
{
public:
Transport (const char *addr, bool is_client, size_t offset);
long handle_;
- ACE_CString client_endpoint_;
- bool local_is_client_;
+ Endpoint client_endpoint_;
size_t open_offset_;
size_t close_offset_;
};
@@ -51,8 +76,8 @@ public:
void match_hosts (Session *session);
void set_server_addr (const ACE_CString &addr);
- ACE_CString server_addr (void) const;
- const ACE_CString &last_client_addr (void) const;
+ const Endpoint &server_addr (void) const;
+ const Endpoint &last_client_addr (void) const;
bool is_server (void) const;
size_t offset (void) const;
@@ -62,7 +87,7 @@ public:
Transport *find_transport (long handle);
bool match_local (const char *addr) const;
- bool match_server_addr (const ACE_CString &addr, Session &session) const;
+ bool match_server_addr (const Endpoint &addr) const;
Invocation *new_invocation (size_t req_id, Thread *thr);
Invocation *find_invocation (size_t req_id, long handle);
@@ -79,13 +104,11 @@ private:
char *origin_;
HostProcess *owner_;
HostProcess *remote_;
- ACE_CString server_port_;
- ACE_CString server_host_;
+ Endpoint server_ep_;
TransportList transports_;
Transport *last_transport_;
- bool server_;
+ bool is_server_role_;
bool ssl_;
- bool localhost_;
size_t origin_offset_;
PeerObjectTable objects_;
InvocationList invocations_;
diff --git a/TAO/utils/logWalker/Session.cpp b/TAO/utils/logWalker/Session.cpp
index 8f194415417..e9490844ad4 100644
--- a/TAO/utils/logWalker/Session.cpp
+++ b/TAO/utils/logWalker/Session.cpp
@@ -2,6 +2,7 @@
#include "Session.h"
#include "HostProcess.h"
+#include "PeerProcess.h"
#include "Log.h"
#include "ace/OS_NS_strings.h"
#include "ace/SString.h"
@@ -10,6 +11,10 @@
long
Session::tao_version_ = 200;
+AltAddresses
+Session::alt_addrs_;
+
+
Session::Session (void)
{
ACE_CString n ("localhost");
@@ -72,7 +77,7 @@ Session::alternate_address (const char *addrspec)
return;
ACE_CString name (addrspec,(equal - addrspec));
ACE_CString value (equal+1);
- this->alt_addrs_.bind(name,value);
+ Session::alt_addrs_.bind(name,value);
}
bool
@@ -81,7 +86,7 @@ Session::is_equivalent (const ACE_CString &primary,
{
ACE_CString test(primary);
ACE_CString alt;
- if (this->alt_addrs_.find(test,alt) == 0)
+ if (Session::alt_addrs_.find(test,alt) == 0)
{
return alt == alternate;
}
@@ -95,13 +100,13 @@ Session::default_service (const char *addrspec)
if (equal == 0)
return;
ACE_CString name (addrspec,(equal - addrspec));
- ACE_CString endpoint (equal+1);
+ Endpoint ep (equal+1);
static long next_def_pid = 0;
--next_def_pid;
HostProcess *hp = new HostProcess ("defaulted",next_def_pid);
hp->proc_name(name);
- hp->add_listen_endpoint (endpoint);
+ hp->add_listen_endpoint (ep);
this->processes_.bind(next_def_pid,hp);
this->procs_by_name_.bind(name,hp);
}
@@ -117,26 +122,36 @@ Session::find_process (long pid)
}
HostProcess *
-Session::find_host (ACE_CString &endpoint, bool server)
+Session::find_host_i (const Endpoint &endpoint, bool server)
{
- ACE_CString test(endpoint);
- ACE_CString alternate;
- size_t sep = test.find(':');
- if (this->alt_addrs_.find(test.substring (0,sep),alternate) == 0)
- {
- test = alternate + test.substring(sep);
- }
for (Processes::ITERATOR i (this->processes_); !i.done(); i.advance())
{
Processes::ENTRY *entry;
if (i.next(entry) == 0)
break;
- if (entry->item()->has_endpoint(test, server))
+ if (entry->item()->has_endpoint(endpoint, server))
return entry->item();
}
return 0;
}
+HostProcess *
+Session::find_host (const Endpoint &endpoint, bool server)
+{
+ HostProcess *result = find_host_i (endpoint, server);
+ if (result != 0)
+ return result;
+
+ Endpoint test (endpoint);
+ ACE_CString alternate;
+ if (Session::alt_addrs_.find(endpoint.host_,alternate) == 0)
+ {
+ test.host_ = alternate;
+ return find_host_i (test, server);
+ }
+ return 0;
+}
+
void
Session::make_dir (const char *dirname)
{
diff --git a/TAO/utils/logWalker/Session.h b/TAO/utils/logWalker/Session.h
index 2f4bfb0c85d..bfb8c8da6aa 100644
--- a/TAO/utils/logWalker/Session.h
+++ b/TAO/utils/logWalker/Session.h
@@ -14,6 +14,7 @@
class Log;
class HostProcess;
+class Endpoint;
typedef ACE_RB_Tree<long, HostProcess *, ACE_Less_Than<long>, ACE_Null_Mutex> Processes;
typedef ACE_RB_Tree<ACE_CString, HostProcess *, ACE_Less_Than<ACE_CString>, ACE_Null_Mutex> Procs_By_Name;
@@ -28,14 +29,14 @@ public:
void add_process (HostProcess *proc);
HostProcess *find_process (long pid);
- HostProcess *find_host (ACE_CString &endpoint, bool server);
+ HostProcess *find_host (const Endpoint &endpoint, bool server);
void reconcile (void);
static bool set_tao_version (ACE_TCHAR *str);
static long tao_version (void);
- void alternate_address (const char *string);
- bool is_equivalent (const ACE_CString &primary,
- const ACE_CString &alternate);
+ static void alternate_address (const char *string);
+ static bool is_equivalent (const ACE_CString &primary,
+ const ACE_CString &alternate);
void default_service (const char *string);
void make_dir (const char * );
@@ -47,14 +48,16 @@ public:
void dump ();
private:
+ HostProcess *find_host_i (const Endpoint &endpoint, bool server);
+
ostream * stream_for ( ostream *, HostProcess * = 0, const char * = 0);
Processes processes_;
Procs_By_Name procs_by_name_;
- AltAddresses alt_addrs_;
ACE_CString base_dir_;
ACE_CString outfile_;
static long tao_version_;
+ static AltAddresses alt_addrs_;
};
#endif // LOG_WALKER_SESSION_H
diff --git a/TAO/utils/logWalker/Thread.cpp b/TAO/utils/logWalker/Thread.cpp
index cb19431f45d..3bd7f206ef4 100644
--- a/TAO/utils/logWalker/Thread.cpp
+++ b/TAO/utils/logWalker/Thread.cpp
@@ -6,6 +6,7 @@
#include "GIOP_Buffer.h"
#include "ace/OS_NS_stdio.h"
#include <stack>
+#include <deque>
Thread::Thread (long tid, const char *alias, size_t offset)
: id_(tid),
@@ -223,13 +224,13 @@ Thread::current_invocation (void) const
}
void
-Thread::dump_detail (ostream &strm) const
+Thread::dump_detail (ostream &strm)
{
strm << " " << this->alias_ << " tid = 0x" << hex << this->id_
<< "\tfirst line " << dec << this->first_line_ << "\t"
<< this->server_encounters_ << " requests sent "
<< this->client_encounters_ << " requests received";
- if (nested_ > 0)
+ if (this->count_nesting () > 0)
strm <<", with " << this->nested_ << " nested upcalls, max depth "
<< this->max_depth_;
strm << endl;
@@ -241,6 +242,7 @@ Thread::get_summary (long &sent_reqs,
size_t &sent_size,
size_t &recv_size)
{
+
for (ACE_DLList_Iterator <Invocation> i(this->invocations_);
!i.done();
i.advance())
@@ -264,7 +266,7 @@ void
Thread::dump_invocations (ostream &strm)
{
size_t total_request_bytes = 0;
- strm << " " << this->alias_ << " handled " << this->invocations_.size()
+ strm << this->alias_ << " handled " << this->invocations_.size()
<< " invocations" << endl;
std::stack<Invocation *> nested;
@@ -272,14 +274,17 @@ Thread::dump_invocations (ostream &strm)
!i.done();
i.advance())
{
- Invocation *inv;
+ Invocation *inv = 0;
i.next(inv);
size_t level = 0;
+
while (!nested.empty ())
{
if (nested.top()->contains (inv->req_line ()))
{
level = nested.size();
+ if (level > this->nested_)
+ this->nested_ = level;
break;
}
nested.pop();
@@ -291,3 +296,76 @@ Thread::dump_invocations (ostream &strm)
}
strm << "total request octet count: " << total_request_bytes;
}
+
+void
+Thread::dump_incidents (ostream &strm)
+{
+ if (this->nested_ == 0)
+ return;
+ strm << "\n" << this->alias_ << " handled " << this->invocations_.size()
+ << " invocations with a max nesting level of " << this->nested_ << endl;
+
+ std::deque<Invocation *> nested_queue;
+ for (ACE_DLList_Iterator <Invocation> i (this->invocations_);
+ !i.done();
+ i.advance())
+ {
+ Invocation *inv = 0;
+ i.next(inv);
+ size_t level = nested_queue.size();
+
+ while (!nested_queue.empty ())
+ {
+ Invocation *prev = nested_queue.back ();
+ if (prev->contains (inv->req_line ()))
+ {
+ break;
+ }
+ nested_queue.pop_back ();
+ level--;
+ prev->dump_finish_line (strm, level);
+ }
+ if (nested_queue.size() > 1)
+ {
+ size_t inv_line = inv->req_line ();
+ for (std::deque<Invocation *>::iterator j = nested_queue.begin ();
+ j != nested_queue.end ();
+ j++)
+ {
+ if ((*j)->repl_line () < inv_line)
+ {
+ (*j)->dump_finish_line (strm, level);
+ }
+ }
+ }
+ nested_queue.push_back (inv);
+ inv->dump_start_line (strm, level);
+ }
+}
+
+size_t
+Thread::count_nesting (void)
+{
+ std::stack<Invocation *> nested;
+ for (ACE_DLList_Iterator <Invocation> i (this->invocations_);
+ !i.done();
+ i.advance())
+ {
+ Invocation *inv = 0;
+ i.next(inv);
+ size_t level = 0;
+ while (!nested.empty ())
+ {
+ level = nested.size();
+ if (level > this->nested_)
+ this->nested_ = level;
+ if (nested.top()->contains (inv->req_line ()))
+ {
+ break;
+ }
+ nested.pop ();
+ }
+ nested.push (inv);
+ }
+ return this->nested_;
+}
diff --git a/TAO/utils/logWalker/Thread.h b/TAO/utils/logWalker/Thread.h
index 9e5da0fec12..180bd1bfc43 100644
--- a/TAO/utils/logWalker/Thread.h
+++ b/TAO/utils/logWalker/Thread.h
@@ -37,8 +37,10 @@ public:
void exit_wait (PeerProcess *, size_t linenum);
GIOP_Buffer *giop_target (void);
void set_giop_target (GIOP_Buffer *buffer);
- void dump_detail (ostream &strm) const;
+ void dump_detail (ostream &strm);
void dump_invocations (ostream &strm);
+ void dump_incidents (ostream &strm);
+
void get_summary (long &sent_reqs, long &recv_reqs, size_t &sent_size, size_t &recv_size);
void push_new_connection (PeerProcess *pp);
@@ -54,13 +56,15 @@ public:
void swap_target (void);
bool has_dup (void);
+ size_t count_nesting (void);
+
private:
long id_;
ACE_CString alias_;
size_t max_depth_;
long client_encounters_;
long server_encounters_;
- long nested_;
+ size_t nested_;
PeerProcessStack pending_;
PeerProcess *incoming_;
PeerProcessStack new_connection_;