diff options
author | wilsond <wilsond@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-08-13 18:58:01 +0000 |
---|---|---|
committer | wilsond <wilsond@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-08-13 18:58:01 +0000 |
commit | 1b54dadf27412a4be9ecfbe7afa66ea29b9c397d (patch) | |
tree | c16534d6f3ac1b33f35a59c595f3ff67413e700a /TAO | |
parent | 6b16f5c4e428b553509738cdd30d4c5895c3df25 (diff) | |
download | ATCD-1b54dadf27412a4be9ecfbe7afa66ea29b9c397d.tar.gz |
ChangeLogTag: Mon Aug 13 18:57:05 UTC 2007 Dale Wilson <wilsond@ociweb.com>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 7 | ||||
-rw-r--r-- | TAO/tao/Transport_Cache_Manager.cpp | 85 | ||||
-rw-r--r-- | TAO/tao/Transport_Cache_Manager.h | 21 | ||||
-rw-r--r-- | TAO/tao/Transport_Cache_Manager.inl | 16 |
4 files changed, 62 insertions, 67 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 6275aa0b618..0c8fe6df665 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,10 @@ +Mon Aug 13 18:57:05 UTC 2007 Dale Wilson <wilsond@ociweb.com> + + * tao/Transport_Cache_Manager.h: + * tao/Transport_Cache_Manager.inl: + * tao/Transport_Cache_Manager.cpp: + Optimize the most common path thru cache manager. + Mon Aug 13 17:53:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> * performance-tests/POA/Demux/Demux.mpc: diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp index 9fba9c07255..3a630bfe8cb 100644 --- a/TAO/tao/Transport_Cache_Manager.cpp +++ b/TAO/tao/Transport_Cache_Manager.cpp @@ -168,15 +168,10 @@ namespace TAO return CACHE_FOUND_NONE; } - // Compose the ExternId - Cache_ExtId ext_id (prop); - Cache_IntId int_id; - - Transport_Cache_Manager::Find_Result find_result = this->find (ext_id, - int_id, busy_count); + Transport_Cache_Manager::Find_Result find_result = this->find ( + prop, transport, busy_count); if (find_result != CACHE_FOUND_NONE) { - transport = int_id.relinquish_transport (); if (find_result == CACHE_FOUND_AVAILABLE) { if (transport->wait_strategy ()->non_blocking () == 0 && @@ -210,49 +205,31 @@ namespace TAO } Transport_Cache_Manager::Find_Result - Transport_Cache_Manager::find (const Cache_ExtId &key, - Cache_IntId &value, - size_t &busy_count) + Transport_Cache_Manager::find_i ( + TAO_Transport_Descriptor_Interface *prop, + TAO_Transport *&transport, + size_t &busy_count) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->cache_lock_, - Transport_Cache_Manager::CACHE_FOUND_NONE)); - - Transport_Cache_Manager::Find_Result status = this->find_i (key, - value, busy_count); - - if (status != CACHE_FOUND_NONE) - { - // Update the purging strategy information while we - // are holding our lock - this->purging_strategy_->update_item (value.transport ()); - } - - return status; - } - Transport_Cache_Manager::Find_Result - Transport_Cache_Manager::find_i (const Cache_ExtId &key, - Cache_IntId &value, - size_t & busy_count) - { - HASH_MAP_ENTRY *entry = 0; - busy_count = 0; + // Compose the ExternId + Cache_IntId value; // Get the entry from the Hash Map Transport_Cache_Manager::Find_Result found = CACHE_FOUND_NONE; // Make a temporary object. It does not do a copy. - Cache_ExtId tmp_key (key.property ()); + Cache_ExtId key (prop); + HASH_MAP_ENTRY *entry = 0; + busy_count = 0; int cache_status = 0; + HASH_MAP_ENTRY *found_entry = 0; // loop until we find a usable transport, or until we've checked // all cached entries for this endpoint while (found != CACHE_FOUND_AVAILABLE && cache_status == 0) { entry = 0; - cache_status = this->cache_map_.find (tmp_key, + cache_status = this->cache_map_.find (key, entry); if (cache_status == 0 && entry) { @@ -261,13 +238,9 @@ namespace TAO // Successfully found a TAO_Transport. found = CACHE_FOUND_AVAILABLE; + found_entry = entry; entry->item ().recycle_state (ENTRY_BUSY); - // NOTE: This assignment operator indirectly incurs two - // lock operations since it duplicates and releases - // TAO_Transport objects. - value = entry->item (); - if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, @@ -294,10 +267,7 @@ namespace TAO // if this is the first interesting entry if (found != CACHE_FOUND_CONNECTING) { - // NOTE: This assignment operator indirectly incurs two - // lock operations since it duplicates and releases - // TAO_Transport objects. - value = entry->item (); + found_entry = entry; found = CACHE_FOUND_CONNECTING; } } @@ -306,7 +276,7 @@ namespace TAO // if this is the first busy entry if (found == CACHE_FOUND_NONE && busy_count == 0) { - value = entry->item (); + found_entry = entry; found = CACHE_FOUND_BUSY; } busy_count += 1; @@ -324,18 +294,19 @@ namespace TAO } // Bump the index up - tmp_key.incr_index (); - } - - if (TAO_debug_level > 6 && found != CACHE_FOUND_AVAILABLE) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport_Cache_Manager::find_i, " - "no idle transport is available for hash {%d}\n", - tmp_key.hash () - )); + key.incr_index (); } - + if (found_entry != 0) + { + transport = found_entry->item ().transport (); + transport->add_reference (); + if (found == CACHE_FOUND_AVAILABLE) + { + // Update the purging strategy information while we + // are holding our lock + this->purging_strategy_->update_item (transport); + } + } return found; } diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h index e95edd40092..8466ef4f236 100644 --- a/TAO/tao/Transport_Cache_Manager.h +++ b/TAO/tao/Transport_Cache_Manager.h @@ -113,9 +113,10 @@ namespace TAO /// Check the Transport Cache to check whether the connection exists /// in the Cache and return the connection - Find_Result find_transport (TAO_Transport_Descriptor_Interface *prop, - TAO_Transport *&transport, - size_t & busy_count); + Find_Result find_transport ( + TAO_Transport_Descriptor_Interface *prop, + TAO_Transport *&transport, + size_t & busy_count); /// Remove entries from the cache depending upon the strategy. int purge (void); @@ -168,9 +169,10 @@ namespace TAO /// Lookup entry<key,value> in the cache. Grabs the lock and calls the /// implementation function find_i. - Find_Result find (const Cache_ExtId &key, - Cache_IntId &value, - size_t & busy_count); + Find_Result find ( + TAO_Transport_Descriptor_Interface *prop, + TAO_Transport *&transport, + size_t & busy_count); /** * Non-Locking version and actual implementation of bind () @@ -187,9 +189,10 @@ namespace TAO * Hash_Map_Manager. If the find succeeds, it calls the * get_idle_transport (). */ - Find_Result find_i (const Cache_ExtId &key, - Cache_IntId &value, - size_t & busy_count); + Find_Result find_i ( + TAO_Transport_Descriptor_Interface *prop, + TAO_Transport *&transport, + size_t & busy_count); /// Non-locking version and actual implementation of make_idle (). int make_idle_i (HASH_MAP_ENTRY *entry); diff --git a/TAO/tao/Transport_Cache_Manager.inl b/TAO/tao/Transport_Cache_Manager.inl index 9fc679f8c61..68ffeb47eaf 100644 --- a/TAO/tao/Transport_Cache_Manager.inl +++ b/TAO/tao/Transport_Cache_Manager.inl @@ -72,7 +72,6 @@ namespace TAO if(entry == 0) return; - // Double checked locking ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->cache_lock_)); this->mark_invalid_i (entry); @@ -100,6 +99,21 @@ namespace TAO } } + ACE_INLINE Transport_Cache_Manager::Find_Result + Transport_Cache_Manager::find ( + TAO_Transport_Descriptor_Interface *prop, + TAO_Transport *&transport, + size_t &busy_count) + { + ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + guard, + *this->cache_lock_, + Transport_Cache_Manager::CACHE_FOUND_NONE)); + + return this->find_i (prop, transport, busy_count); + } + + ACE_INLINE int Transport_Cache_Manager::close (Connection_Handler_Set &handlers) { |