Skip to content
Snippets Groups Projects
Commit dccbe386 authored by Werner Wiedenmann's avatar Werner Wiedenmann
Browse files

Updates for HltROBDataProviderSvc

- try to release early possible locks in tbb::concurrent_unordered_map (see also ATR-22112)
- put clearing and size allocation for output arrays of the eventCache_checkRobListToCache function
  at the begin of the function
parent 65581519
No related branches found
No related tags found
No related merge requests found
...@@ -219,11 +219,9 @@ void HltROBDataProviderSvc::addROBData(const EventContext& context, const std::v ...@@ -219,11 +219,9 @@ void HltROBDataProviderSvc::addROBData(const EventContext& context, const std::v
// allocate vector of missing ROB Ids // allocate vector of missing ROB Ids
std::vector<uint32_t> robIds_missing ; std::vector<uint32_t> robIds_missing ;
robIds_missing.reserve( robIds.size() ) ;
// allocate vector with existing ROB fragments in cache // allocate vector with existing ROB fragments in cache
std::vector<const ROBF*> robFragments_inCache ; std::vector<const ROBF*> robFragments_inCache ;
robFragments_inCache.reserve( robIds.size() ) ;
// check input ROB list against cache // check input ROB list against cache
eventCache_checkRobListToCache(cache,robIds, robFragments_inCache, robIds_missing ) ; eventCache_checkRobListToCache(cache,robIds, robFragments_inCache, robIds_missing ) ;
...@@ -325,7 +323,6 @@ void HltROBDataProviderSvc::getROBData(const EventContext& context, ...@@ -325,7 +323,6 @@ void HltROBDataProviderSvc::getROBData(const EventContext& context,
// allocate vector of missing ROB Ids // allocate vector of missing ROB Ids
std::vector<uint32_t> robIds_missing ; std::vector<uint32_t> robIds_missing ;
robIds_missing.reserve( robIds.size() ) ;
// check input ROB list against cache // check input ROB list against cache
eventCache_checkRobListToCache(cache, robIds, robFragments, robIds_missing) ; eventCache_checkRobListToCache(cache, robIds, robFragments, robIds_missing) ;
...@@ -375,8 +372,6 @@ void HltROBDataProviderSvc::getROBData(const EventContext& context, ...@@ -375,8 +372,6 @@ void HltROBDataProviderSvc::getROBData(const EventContext& context,
eventCache_addRobData(cache, robFragments_missing) ; eventCache_addRobData(cache, robFragments_missing) ;
// return all the requested ROB fragments from the cache // return all the requested ROB fragments from the cache
robFragments.clear() ;
robIds_missing.clear() ;
eventCache_checkRobListToCache(cache, robIds, robFragments, robIds_missing) ; eventCache_checkRobListToCache(cache, robIds, robFragments, robIds_missing) ;
} }
...@@ -534,7 +529,7 @@ void HltROBDataProviderSvc::eventCache_clear(EventCache* cache) ...@@ -534,7 +529,7 @@ void HltROBDataProviderSvc::eventCache_clear(EventCache* cache)
cache->globalEventNumber = 0; cache->globalEventNumber = 0;
cache->eventStatus = 0; cache->eventStatus = 0;
cache->isEventComplete = false; cache->isEventComplete = false;
cache->robmap.clear(); { cache->robmap.clear(); }
} }
void HltROBDataProviderSvc::eventCache_checkRobListToCache(EventCache* cache, const std::vector<uint32_t>& robIds_toCheck, void HltROBDataProviderSvc::eventCache_checkRobListToCache(EventCache* cache, const std::vector<uint32_t>& robIds_toCheck,
...@@ -543,6 +538,15 @@ void HltROBDataProviderSvc::eventCache_checkRobListToCache(EventCache* cache, co ...@@ -543,6 +538,15 @@ void HltROBDataProviderSvc::eventCache_checkRobListToCache(EventCache* cache, co
{ {
ATH_MSG_VERBOSE("start of " << __FUNCTION__ << " number of ROB Ids to check = " << robIds_toCheck.size()); ATH_MSG_VERBOSE("start of " << __FUNCTION__ << " number of ROB Ids to check = " << robIds_toCheck.size());
// clear output arrays
robFragments_inCache.clear();
robIds_missing.clear();
// allocate sufficient space for output arrays
robFragments_inCache.reserve( robIds_toCheck.size() );
robIds_missing.reserve( robIds_toCheck.size() );
// check input ROB ids
for (uint32_t id : robIds_toCheck) { for (uint32_t id : robIds_toCheck) {
// check for duplicate IDs on the list of missing ROBs // check for duplicate IDs on the list of missing ROBs
...@@ -553,12 +557,13 @@ void HltROBDataProviderSvc::eventCache_checkRobListToCache(EventCache* cache, co ...@@ -553,12 +557,13 @@ void HltROBDataProviderSvc::eventCache_checkRobListToCache(EventCache* cache, co
} }
// check if ROB is already in cache // check if ROB is already in cache
ROBMAP::const_iterator map_it = cache->robmap.find(id); { ROBMAP::const_iterator map_it = cache->robmap.find(id);
if (map_it != cache->robmap.end()) { if (map_it != cache->robmap.end()) {
ATH_MSG_VERBOSE(__FUNCTION__ << " ROB Id 0x" << MSG::hex << id << MSG::dec ATH_MSG_VERBOSE(__FUNCTION__ << " ROB Id 0x" << MSG::hex << id << MSG::dec
<< " found for (global Id, L1 Id) = (" << cache->globalEventNumber << "," << cache->currentLvl1ID <<")" ); << " found for (global Id, L1 Id) = (" << cache->globalEventNumber << "," << cache->currentLvl1ID <<")" );
robFragments_inCache.push_back( &(map_it->second) ); robFragments_inCache.push_back( &(map_it->second) );
continue; continue;
}
} }
// check if ROB is actually enabled for readout // check if ROB is actually enabled for readout
...@@ -603,11 +608,12 @@ void HltROBDataProviderSvc::eventCache_addRobData(EventCache* cache, const std:: ...@@ -603,11 +608,12 @@ void HltROBDataProviderSvc::eventCache_addRobData(EventCache* cache, const std::
} }
// check if ROB is already in cache // check if ROB is already in cache
ROBMAP::const_iterator it = cache->robmap.find(id); { ROBMAP::const_iterator it = cache->robmap.find(id);
if (it != cache->robmap.end()) { if (it != cache->robmap.end()) {
ATH_MSG_VERBOSE(__FUNCTION__ << " Duplicate ROB Id 0x" << MSG::hex << id << MSG::dec ATH_MSG_VERBOSE(__FUNCTION__ << " Duplicate ROB Id 0x" << MSG::hex << id << MSG::dec
<< " found for (global Id, L1 Id) = (" << cache->globalEventNumber << "," << cache->currentLvl1ID <<")" ); << " found for (global Id, L1 Id) = (" << cache->globalEventNumber << "," << cache->currentLvl1ID <<")" );
continue; continue;
}
} }
// check for ROBs with no data // check for ROBs with no data
...@@ -632,12 +638,12 @@ void HltROBDataProviderSvc::eventCache_addRobData(EventCache* cache, const std:: ...@@ -632,12 +638,12 @@ void HltROBDataProviderSvc::eventCache_addRobData(EventCache* cache, const std::
} }
// add ROB to map // add ROB to map
cache->robmap[id] = rob; { cache->robmap[id] = rob; }
} }
} }
HltROBDataProviderSvc::EventCache::~EventCache() HltROBDataProviderSvc::EventCache::~EventCache()
{ {
// delete event; // delete event;
robmap.clear(); { robmap.clear(); }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment