diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2011-03-22 22:16:57 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2011-03-22 22:16:57 +0000 |
commit | 33d107e2167613fb86bd92da686a12f336cd47a5 (patch) | |
tree | c7a2d00798568e8053e74230d5737612df1a56bf /TAO | |
parent | 3259338839446c90b07ade1e235ca2d5be5de1e0 (diff) | |
download | ATCD-33d107e2167613fb86bd92da686a12f336cd47a5.tar.gz |
Tue Mar 22 22:09:09 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com>
* utils/logWalker/HostProcess.cpp:
* utils/logWalker/Invocation.cpp:
* utils/logWalker/Log.h:
* utils/logWalker/Log.cpp:
* utils/logWalker/README:
* utils/logWalker/Session.h:
* utils/logWalker/Session.cpp:
* utils/logWalker/Thread.h:
* utils/logWalker/Thread.cpp:
* utils/logWalker/logWalker.cpp:
Incremental improvements to the log walker utility, mostly in
error reporting, also with thread encounter tracking, and source
identification.
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 17 | ||||
-rw-r--r-- | TAO/utils/logWalker/HostProcess.cpp | 4 | ||||
-rw-r--r-- | TAO/utils/logWalker/Invocation.cpp | 2 | ||||
-rw-r--r-- | TAO/utils/logWalker/Log.cpp | 75 | ||||
-rw-r--r-- | TAO/utils/logWalker/Log.h | 1 | ||||
-rw-r--r-- | TAO/utils/logWalker/README | 4 | ||||
-rw-r--r-- | TAO/utils/logWalker/Session.cpp | 13 | ||||
-rw-r--r-- | TAO/utils/logWalker/Session.h | 2 | ||||
-rw-r--r-- | TAO/utils/logWalker/Thread.cpp | 8 | ||||
-rw-r--r-- | TAO/utils/logWalker/Thread.h | 1 | ||||
-rw-r--r-- | TAO/utils/logWalker/logWalker.cpp | 24 |
11 files changed, 116 insertions, 35 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index b12f05b33a8..c0977cea5c0 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,20 @@ +Tue Mar 22 22:09:09 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> + + * utils/logWalker/HostProcess.cpp: + * utils/logWalker/Invocation.cpp: + * utils/logWalker/Log.h: + * utils/logWalker/Log.cpp: + * utils/logWalker/README: + * utils/logWalker/Session.h: + * utils/logWalker/Session.cpp: + * utils/logWalker/Thread.h: + * utils/logWalker/Thread.cpp: + * utils/logWalker/logWalker.cpp: + + Incremental improvements to the log walker utility, mostly in + error reporting, also with thread encounter tracking, and source + identification. + Tue Mar 22 21:40:44 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> * utils/catior/Catior_i.h: diff --git a/TAO/utils/logWalker/HostProcess.cpp b/TAO/utils/logWalker/HostProcess.cpp index e464d3a4647..7b9f9fa8bd5 100644 --- a/TAO/utils/logWalker/HostProcess.cpp +++ b/TAO/utils/logWalker/HostProcess.cpp @@ -164,7 +164,9 @@ HostProcess::add_peer(long handle, PeerProcess *peer) } const ACE_CString &addr = peer->is_server() ? peer->server_addr() : peer->last_client_addr(); - this->by_addr_.bind (addr,peer); + int result = this->by_addr_.bind (addr,peer); + if (result != 0) + ACE_ERROR ((LM_ERROR,"add_peer, cannot bind to addr %s %p\n", addr.c_str(), "by_addr_.bind")); PeerNode *node = new PeerNode (handle,peer); this->by_handle_.insert_tail(node); } diff --git a/TAO/utils/logWalker/Invocation.cpp b/TAO/utils/logWalker/Invocation.cpp index 1fe1e3d533b..fd357bf9d0e 100644 --- a/TAO/utils/logWalker/Invocation.cpp +++ b/TAO/utils/logWalker/Invocation.cpp @@ -528,7 +528,7 @@ Invocation::init (const char * text, size_t offset, Thread *thread) if (size_str == 0 || id == 0) { ACE_ERROR ((LM_ERROR, - "Not a request preamble:\n '%s'\n", + "Not a request preamble line %d:\n '%s'\n",offset, text)); return false; } diff --git a/TAO/utils/logWalker/Log.cpp b/TAO/utils/logWalker/Log.cpp index 5aae755dda6..4e4a311667a 100644 --- a/TAO/utils/logWalker/Log.cpp +++ b/TAO/utils/logWalker/Log.cpp @@ -108,30 +108,30 @@ Log::get_host (long pid) size_t numprocs = this->procs_.size(); hp = new HostProcess (this->origin_,pid); this->procs_.insert_tail(hp); - if (this->alias_.length() > 0) + ACE_CString &procname = this->alias_.length() > 0 ? + this->alias_ : this->origin_; + switch (numprocs) { - switch (numprocs) - { - case 0: - hp->proc_name(alias_); - break; - case 1: - { - ACE_CString a2 = alias_ + "_1"; - HostProcess *first; - if (this->procs_.get(first) == 0) - first->proc_name(a2); - } - //fallthru - default: - { - char ext[10]; - ACE_OS::sprintf(ext,"_" ACE_SIZE_T_FORMAT_SPECIFIER_ASCII,numprocs+1); - ACE_CString a2 = alias_ + ext; - hp->proc_name(a2); - } - } + case 0: + hp->proc_name(procname); + break; + case 1: + { + ACE_CString a2 = procname + "_1"; + HostProcess *first; + if (this->procs_.get(first) == 0) + first->proc_name(a2); + } + //fallthru + default: + { + char ext[10]; + ACE_OS::sprintf(ext,"_" ACE_SIZE_T_FORMAT_SPECIFIER_ASCII,numprocs+1); + ACE_CString a2 = procname + ext; + hp->proc_name(a2); + } } + this->session_.add_process(hp); return hp; } @@ -248,12 +248,11 @@ Log::parse_dump_msg (Log *this_, char *line, size_t offset) return; } -// if (mode < 2) -// thr->enter_wait(pp); Invocation::GIOP_Buffer *target = 0; switch (mode) { case 1: { // receiving request + thr->handle_request(); Invocation *inv = pp->new_invocation (rid,thr); if (inv == 0) { @@ -267,6 +266,8 @@ Log::parse_dump_msg (Log *this_, char *line, size_t offset) break; } case 0: // sending request + thr->enter_wait(pp); + // fall through. case 3: { // receiving reply Invocation *inv = pp->find_invocation(rid, thr->active_handle()); if (inv == 0) @@ -278,6 +279,13 @@ Log::parse_dump_msg (Log *this_, char *line, size_t offset) } inv->init (line, offset, thr); target = inv->octets(mode == 0); + if (target == 0 && mode == 3) + { + ACE_ERROR ((LM_ERROR, + "%d: could not map invocation to target for req_id %d\n", + offset, rid)); + return; + } // if (mode == 3) // thr->exit_wait(pp, offset); break; @@ -463,8 +471,22 @@ Log::parse_wait_for_event (Log *this_, char *line, size_t offset) if (done) thr->exit_wait(pp, offset); - else - thr->enter_wait(pp); +// else +// thr->enter_wait(pp); +} + +void +Log::parse_wait_on_read (Log *this_, char *line, size_t offset) +{ + long pid = 0; + long tid = 0; + this_->get_pid_tid(pid,tid,line); + + HostProcess *hp = this_->get_host(pid); + Thread *thr = hp == 0 ? 0 : hp->find_thread (tid); + PeerProcess *pp = thr->incoming(); + + thr->exit_wait (pp, offset); } void @@ -687,6 +709,7 @@ Log::parse_line (char *line, size_t offset) { "Exclusive_TMS::request_id", parse_exclusive_tms }, { "process_parsed_messages", parse_process_parsed_msgs }, { "wait_for_event", parse_wait_for_event }, + { "Wait_On_Read", parse_wait_on_read }, { "::cleanup_queue, byte_count", parse_cleanup_queue }, { "close_connection_eh", parse_close_connection }, { "IIOP_Connector::begin_connection, to ", parse_begin_connection }, diff --git a/TAO/utils/logWalker/Log.h b/TAO/utils/logWalker/Log.h index b4ba478a517..6d4e2b4da09 100644 --- a/TAO/utils/logWalker/Log.h +++ b/TAO/utils/logWalker/Log.h @@ -53,6 +53,7 @@ private: static void parse_exclusive_tms (Log *this_, char *line, size_t offset); static void parse_process_parsed_msgs (Log *this_, char *line, size_t offset); static void parse_wait_for_event (Log *this_, char *line, size_t offset); + static void parse_wait_on_read (Log *this_, char *line, size_t offset); static void parse_cleanup_queue (Log *this_, char *line, size_t offset); static void parse_close_connection (Log *this_, char *line, size_t offset); static void parse_begin_connection (Log *this_, char *line, size_t offset); diff --git a/TAO/utils/logWalker/README b/TAO/utils/logWalker/README index 6e6409263a6..bc67b032cef 100644 --- a/TAO/utils/logWalker/README +++ b/TAO/utils/logWalker/README @@ -12,10 +12,10 @@ The executable is installed as $ACE_ROOT/bin/tao_logWalker. The command line options are: -t <version> where <version> represents a TAO minor version - number, currently only 1.5 and 1.6 are supported. + number, currently 1.5 through 2.0 are supported. As variations in logfile output bound to version are found, this option will expand and may include - micro release numbers as well. Default is 1.6. + micro release numbers as well. Default is 2.0. -o <filename> redirects the output to the named file rather than standard out. diff --git a/TAO/utils/logWalker/Session.cpp b/TAO/utils/logWalker/Session.cpp index c1b429636c2..1f6dad776e1 100644 --- a/TAO/utils/logWalker/Session.cpp +++ b/TAO/utils/logWalker/Session.cpp @@ -8,7 +8,7 @@ #include "ace/OS_NS_sys_stat.h" long -Session::tao_version_ = 160; +Session::tao_version_ = 200; Session::Session (void) { @@ -27,13 +27,22 @@ Session::~Session (void) } } -void +bool Session::set_tao_version (ACE_TCHAR *str) { if (ACE_OS::strncmp(str, ACE_TEXT("1.5"), 3)== 0) tao_version_ = 150; else if (ACE_OS::strncmp (str, ACE_TEXT("1.6"), 3) == 0) tao_version_ = 160; + else if (ACE_OS::strncmp (str, ACE_TEXT("1.7"), 3) == 0) + tao_version_ = 170; + else if (ACE_OS::strncmp (str, ACE_TEXT("1.8"), 3) == 0) + tao_version_ = 180; + else if (ACE_OS::strncmp (str, ACE_TEXT("2.0"), 3) == 0) + tao_version_ = 200; + else + return false; + return true; } long diff --git a/TAO/utils/logWalker/Session.h b/TAO/utils/logWalker/Session.h index d75480bfa3b..2219921469a 100644 --- a/TAO/utils/logWalker/Session.h +++ b/TAO/utils/logWalker/Session.h @@ -31,7 +31,7 @@ public: HostProcess *find_host (ACE_CString &endpoint, bool server); void reconcile (void); - static void set_tao_version (ACE_TCHAR *str); + static bool set_tao_version (ACE_TCHAR *str); static long tao_version (void); void alternate_address (const char *string); void default_service (const char *string); diff --git a/TAO/utils/logWalker/Thread.cpp b/TAO/utils/logWalker/Thread.cpp index eff70a7e625..9a651816ce3 100644 --- a/TAO/utils/logWalker/Thread.cpp +++ b/TAO/utils/logWalker/Thread.cpp @@ -34,6 +34,14 @@ Thread::pending_peer (void) const } void +Thread::handle_request (void) +{ + this->encounters_++; + if (this->pending_.size() > 1) + this->nested_++; +} + +void Thread::enter_wait (PeerProcess *pp) { this->pending_.push (pp); diff --git a/TAO/utils/logWalker/Thread.h b/TAO/utils/logWalker/Thread.h index 63a3958c756..4660d34a0c1 100644 --- a/TAO/utils/logWalker/Thread.h +++ b/TAO/utils/logWalker/Thread.h @@ -27,6 +27,7 @@ public: void add_invocation (Invocation *); PeerProcess *incoming (void) const; + void handle_request (void); void enter_wait (PeerProcess *); void exit_wait (PeerProcess *, size_t linenum); Invocation::GIOP_Buffer *giop_target (void); diff --git a/TAO/utils/logWalker/logWalker.cpp b/TAO/utils/logWalker/logWalker.cpp index 06a9e992a7f..4e99f33de40 100644 --- a/TAO/utils/logWalker/logWalker.cpp +++ b/TAO/utils/logWalker/logWalker.cpp @@ -107,6 +107,18 @@ parse_manifest (Session &session, ACE_TCHAR *filename) } } +void +print_help (void) +{ + ACE_DEBUG ((LM_DEBUG, "tao_logWalker recongizes the following arguments\n")); + ACE_DEBUG ((LM_DEBUG, "-o <filename> - write all output to specified file\n")); + ACE_DEBUG ((LM_DEBUG, "-d <directory> - create separate output files, one per log, and put them in specified directory.\n Either -o or -d may be set but not both. Default output to stdout.\n")); + ACE_DEBUG ((LM_DEBUG, "-m <manifest> - Take inputs from named manifest file\n")); + ACE_DEBUG ((LM_DEBUG, "-t <1.5 .. 2.0> - set source TAO version, default 2.0\n")); + ACE_DEBUG ((LM_DEBUG, "-a <name=address> - bind an alias to a host address.\n Repeat as many times as necessary.\n")); + ACE_DEBUG ((LM_DEBUG, "-p <service=address> - bind a service such as Naming to a specific endpoint address\n")); +} + int ACE_TMAIN (int argc, ACE_TCHAR **argv) { @@ -144,8 +156,11 @@ ACE_TMAIN (int argc, ACE_TCHAR **argv) } if (ACE_OS::strcasecmp (argv[i], ACE_TEXT("-t")) == 0) { - Session::set_tao_version (argv[++i]); - continue; + if (Session::set_tao_version (argv[++i])) + continue; + else + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("TAO version must be 1.5, 1.6, 1.7, 1.8, or 2.0 \n")), 0); } if (ACE_OS::strcasecmp (argv[i], ACE_TEXT("-a")) == 0) { @@ -157,6 +172,11 @@ ACE_TMAIN (int argc, ACE_TCHAR **argv) session.default_service (ACE_TEXT_ALWAYS_CHAR (argv[++i])); continue; } + if (argv[i][0] == ACE_TEXT('-')) + { + print_help (); + return 0; + } Log log(session); |