#include <SGHiveMgrSvc.h>
|
| virtual StatusCode | selectStore (size_t slotIndex) override |
| | Activate an given 'slot' for all subsequent calls within the same thread id.
|
| virtual StatusCode | clearStore (size_t slotIndex) override |
| | Clear a given 'slot'.
|
| virtual StatusCode | setNumberOfStores (size_t slots) override |
| | Set the number of 'slots'.
|
| virtual size_t | getNumberOfStores () const override |
| | Get the number of 'slots'.
|
| virtual bool | exists (const DataObjID &) override |
| | Check if a data object exists in store.
|
| virtual size_t | allocateStore (int evtnumber) override |
| | Allocate a store slot for new event.
|
| virtual StatusCode | freeStore (size_t slotIndex) override |
| | Free a store slot.
|
| virtual size_t | getPartitionNumber (int eventnumber) const override |
| | Get the slot number corresponding to a given event.
|
| virtual size_t | freeSlots () override |
| | Get free slots number.
|
| virtual StatusCode | initialize () override |
| virtual StatusCode | finalize () override |
| virtual StatusCode | start () override |
| | HiveMgrSvc (const std::string &name, ISvcLocator *svc) |
| | Standard Service Constructor. sets active store to default event store.
|
| virtual | ~HiveMgrSvc () |
|
| static void | setNumProcs (size_t numProcs) |
| | Set number of concurrent processes.
|
Definition at line 30 of file SGHiveMgrSvc.h.
◆ HiveMgrSvc()
| HiveMgrSvc::HiveMgrSvc |
( |
const std::string & | name, |
|
|
ISvcLocator * | svc ) |
Standard Service Constructor. sets active store to default event store.
Definition at line 17 of file SGHiveMgrSvc.cxx.
18 : base_class(name, svc),
21{
23 declareProperty(
"NSlots",
m_nSlots,
"number of event slots");
24}
ServiceHandle< StoreGateSvc > m_hiveStore
static const std::string & storeName(const StoreID::type &s)
◆ ~HiveMgrSvc()
| virtual SG::HiveMgrSvc::~HiveMgrSvc |
( |
| ) |
|
|
inlinevirtual |
◆ allocateStore()
| size_t HiveMgrSvc::allocateStore |
( |
int | evtNumber | ) |
|
|
overridevirtual |
Allocate a store slot for new event.
- Parameters
-
| evtnumber | [IN] Event number |
| slot | [OUT] Returned slot or slot number |
- Returns
- Slot number (npos to indicate an error).
Definition at line 98 of file SGHiveMgrSvc.cxx.
98 {
100 error() <<
"No slots available for event number " << evtNumber <<
endmsg;
101 return std::string::npos;
102 }
103 std::scoped_lock lock{
m_mutex};
105 if(
m_slots[index].eventNumber == evtNumber) {
106 error() <<
"Attempt to allocate an event slot for an event that is still active: event number " << evtNumber <<
endmsg;
107 return std::string::npos;
108 }
else if (
m_slots[index].eventNumber == -1) {
111 <<
" allocated to event number "<< evtNumber <<
endmsg;
114 }
115 }
116 error() <<
"No slots available for event number " << evtNumber <<
endmsg;
117 return std::string::npos;
118}
std::atomic< size_t > m_freeSlots
std::vector< SG::HiveEventSlot > m_slots
◆ clearStore()
| StatusCode HiveMgrSvc::clearStore |
( |
size_t | slotIndex | ) |
|
|
overridevirtual |
Clear a given 'slot'.
- Parameters
-
| slot | [IN] Slot number (event slot) * |
- Returns
- Status code indicating failure or success.
Definition at line 57 of file SGHiveMgrSvc.cxx.
57 {
60 rc=
m_slots[slotIndex].pEvtStore->clearStore();
61 if (
rc.isSuccess())
debug() <<
"cleared store " << slotIndex <<
endmsg;
62 }
63 if (!
rc.isSuccess())
error() <<
"could not clear store " << slotIndex <<
endmsg;
65}
::StatusCode StatusCode
StatusCode definition for legacy code.
◆ exists()
| bool HiveMgrSvc::exists |
( |
const DataObjID & | id | ) |
|
|
overridevirtual |
Check if a data object exists in store.
TODO: remove the method ASA a cross-experiment event data store interface emerges
- Returns
- boolean
Definition at line 161 of file SGHiveMgrSvc.cxx.
161 {
162
163
164 std::string
key =
id.key();
165 key.erase(0,
key.find(
'+')+1);
166
167 if (id.clid() == 0) {
168
169
170
171 std::string
cl =
id.fullKey();
172 cl.erase(
cl.find(
'/'),
cl.length());
173
174 DataObjID
d2(std::move(cl),key);
176 } else {
177 return m_hiveStore->transientContains(
id.clid(), key);
178 }
179
180}
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
◆ finalize()
| StatusCode HiveMgrSvc::finalize |
( |
| ) |
|
|
overridevirtual |
Definition at line 220 of file SGHiveMgrSvc.cxx.
220 {
222
223 for (SG::HiveEventSlot& s :
m_slots) {
224
225
226 CHECK(
s.pEvtStore->finalize() );
227 s.pEvtStore->release();
228 }
229
230 return StatusCode::SUCCESS;
231}
#define CHECK(...)
Evaluate an expression and check for errors.
◆ freeSlots()
| size_t HiveMgrSvc::freeSlots |
( |
| ) |
|
|
overridevirtual |
◆ freeStore()
| StatusCode HiveMgrSvc::freeStore |
( |
size_t | slotIndex | ) |
|
|
overridevirtual |
Free a store slot.
- Parameters
-
- Returns
- Status code indicating failure or success.
Definition at line 125 of file SGHiveMgrSvc.cxx.
125 {
127 std::scoped_lock lock{
m_mutex};
128 if (
m_slots[slotIndex].eventNumber == -1) {
129 debug() <<
"Slot " << slotIndex <<
" is already free" <<
endmsg;
130 }
131 else {
132 m_slots[slotIndex].eventNumber = -1;
135 }
136 return StatusCode::SUCCESS;
137 } else {
139 return StatusCode::FAILURE;
140 }
141}
◆ getNumberOfStores()
| size_t HiveMgrSvc::getNumberOfStores |
( |
| ) |
const |
|
overridevirtual |
Get the number of 'slots'.
- Returns
- Number of event stores allocated in the whiteboard
Definition at line 86 of file SGHiveMgrSvc.cxx.
◆ getPartitionNumber()
| size_t HiveMgrSvc::getPartitionNumber |
( |
int | evtNumber | ) |
const |
|
overridevirtual |
Get the slot number corresponding to a given event.
- Parameters
-
| evtnumber | [IN] Event number |
- Returns
- slot number (npos to indicate an error).
- Parameters
-
| evtNumber | [IN] Event number |
- Returns
- slot number (npos to indicate an error).
Definition at line 149 of file SGHiveMgrSvc.cxx.
149 {
150 std::scoped_lock lock{
m_mutex};
152 if(
m_slots[index].eventNumber == evtNumber)
return index;
153 }
154 return std::string::npos;
155}
◆ initialize()
| StatusCode HiveMgrSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 182 of file SGHiveMgrSvc.cxx.
182 {
184
185 if ( !(Service::initialize().isSuccess()) ) {
186 fatal() <<
"Unable to initialize base class" <<
endmsg;
187 return StatusCode::FAILURE;
188 }
189
191 fatal() <<
"Unable to get hive event store" <<
endmsg;
192 return StatusCode::FAILURE;
193 }
194
195
196 Service* child(0);
197 SGImplSvc* pSG(0);
198
200 std::ostringstream oss;
203 child->initialize().isSuccess() &&
204 0 != (pSG = dynamic_cast<SGImplSvc*>(child)) )
205 {
207 m_slots.push_back(SG::HiveEventSlot(pSG));
208 } else {
209 fatal() <<
"Unable to clone event store " << oss.str() <<
endmsg;
210 return StatusCode::FAILURE;
211 }
212 }
213
215 Gaudi::Concurrency::ConcurrencyFlags::setNumConcEvents(
m_nSlots );
216
218}
virtual StatusCode selectStore(size_t slotIndex) override
Activate an given 'slot' for all subsequent calls within the same thread id.
StatusCode clone(const IService *parent, const std::string &childName, Service *&child)
given a reference to a parent svc sets a reference to a cloned child
◆ selectStore()
| StatusCode HiveMgrSvc::selectStore |
( |
size_t | slotIndex | ) |
|
|
overridevirtual |
Activate an given 'slot' for all subsequent calls within the same thread id.
- Parameters
-
| slot | [IN] Slot number (event slot) * |
- Returns
- Status code indicating failure or success.
Definition at line 46 of file SGHiveMgrSvc.cxx.
46 {
49 return StatusCode::SUCCESS;
50}
__thread HiveEventSlot * s_current(0)
static void setSlot(SG::HiveEventSlot *pSlot)
set the hive event slot pointer: used by the event loop mgrs
◆ setNumberOfStores()
| StatusCode HiveMgrSvc::setNumberOfStores |
( |
size_t | slots | ) |
|
|
overridevirtual |
Set the number of 'slots'.
- Parameters
-
| slot | [IN] Slot number (event slot) * |
- Returns
- Status code indicating failure or success.
Definition at line 72 of file SGHiveMgrSvc.cxx.
72 {
73
74 if(FSMState() == Gaudi::StateMachine::INITIALIZED) {
75 fatal() <<
"Too late to change the number of slots!" <<
endmsg;
76 return StatusCode::FAILURE;
77 } else {
81 Gaudi::Concurrency::ConcurrencyFlags::setNumConcEvents( slots );
82 return StatusCode::SUCCESS;
83 }
84}
◆ setNumProcs()
| void HiveMgrSvc::setNumProcs |
( |
size_t | numProcs | ) |
|
|
staticprivate |
Set number of concurrent processes.
This can only be called by "friends" of this class. Its sole purpose is to have a common entry point within ATLAS to call the private methods of Gaudi::ConcurrencyFlags.
- Parameters
-
| numProcs | [IN] Number of concurrent processes |
Definition at line 35 of file SGHiveMgrSvc.cxx.
36{
37 Gaudi::Concurrency::ConcurrencyFlags::setNumProcs(numProcs);
38}
◆ start()
| StatusCode HiveMgrSvc::start |
( |
| ) |
|
|
overridevirtual |
Definition at line 234 of file SGHiveMgrSvc.cxx.
235{
236
237
238
239
240 for (SG::HiveEventSlot& slot :
m_slots) {
241 slot.pEvtStore->mergeStringPool (*
m_hiveStore->currentStore());
242 }
243 return StatusCode::SUCCESS;
244}
◆ ::HltEventLoopMgr
◆ TestSGHiveMgrSvc
| friend class TestSGHiveMgrSvc |
|
friend |
◆ m_freeSlots
| std::atomic<size_t> SG::HiveMgrSvc::m_freeSlots {0} |
|
private |
◆ m_hiveStore
◆ m_mutex
| std::mutex SG::HiveMgrSvc::m_mutex |
|
mutableprivate |
◆ m_nSlots
| size_t SG::HiveMgrSvc::m_nSlots |
|
private |
◆ m_slots
The documentation for this class was generated from the following files: