ATLAS Offline Software
Loading...
Searching...
No Matches
AskForROBs Class Reference
Inheritance diagram for AskForROBs:
Collaboration diagram for AskForROBs:

Public Member Functions

 AskForROBs (const EventContext &context, const ServiceHandle< IROBDataProviderSvc > &svc, uint32_t lvl1ID, const std::vector< eformat::read::ROBFragment > &robs, size_t frac=8)
size_t nrobs () const
virtual void firstCall () override
 a method that will be called to obtain first results from the service It should set the reference quantities
virtual bool callAndCompare () const override
 a function that performs request, and compares the results obtained with the result of the first execution When result differ this function is supposed to return false, otherwise true
bool run (size_t nrepeats)
 runs the stress test by invoking it the firstCall and then repetitively the callAndCompare

Static Public Member Functions

static bool launchTests (size_t nrepeats, const std::vector< ParallelCallTest * > &tests)
 Method to run launch number of tests in parallel (increasing the stress of the calle) It has a potential that also the "first" calls can be launched in parallel and thus be the worse case compared to a situation when the first calls are invoked sequentially while further calls in parallel.

Private Attributes

uint32_t m_lvl1ID
std::vector< uint32_t > m_ROBIDs
EventContext m_context
const ServiceHandle< IROBDataProviderSvc > & m_svc

Detailed Description

Definition at line 29 of file ROBDataProviderMTTest.cxx.

Constructor & Destructor Documentation

◆ AskForROBs()

AskForROBs::AskForROBs ( const EventContext & context,
const ServiceHandle< IROBDataProviderSvc > & svc,
uint32_t lvl1ID,
const std::vector< eformat::read::ROBFragment > & robs,
size_t frac = 8 )
inline

Definition at line 31 of file ROBDataProviderMTTest.cxx.

32 : m_lvl1ID( lvl1ID ),
33 m_context( context ),
34 m_svc( svc ) {
35 // pick some fraction of robs at random
36 for ( size_t el = 0; el < robs.size()/frac; ++el ) {
37 m_ROBIDs.push_back( robs[el].rob_source_id() );
38 }
39 }
EventContext m_context
const ServiceHandle< IROBDataProviderSvc > & m_svc
std::vector< uint32_t > m_ROBIDs

Member Function Documentation

◆ callAndCompare()

virtual bool AskForROBs::callAndCompare ( ) const
inlineoverridevirtual

a function that performs request, and compares the results obtained with the result of the first execution When result differ this function is supposed to return false, otherwise true

Implements ParallelCallTest.

Definition at line 42 of file ROBDataProviderMTTest.cxx.

42 {
44 m_svc->getROBData( m_context, m_ROBIDs, robs );
45 for ( auto& rob: robs ) {
46 if ( rob->rod_lvl1_id() != m_lvl1ID )
47 return false;
48 }
49 return true;
50 }
std::vector< const ROBF * > VROBFRAG

◆ firstCall()

virtual void AskForROBs::firstCall ( )
inlineoverridevirtual

a method that will be called to obtain first results from the service It should set the reference quantities

Implements ParallelCallTest.

Definition at line 41 of file ROBDataProviderMTTest.cxx.

41{}

◆ launchTests()

bool ParallelCallTest::launchTests ( size_t nrepeats,
const std::vector< ParallelCallTest * > & tests )
staticinherited

Method to run launch number of tests in parallel (increasing the stress of the calle) It has a potential that also the "first" calls can be launched in parallel and thus be the worse case compared to a situation when the first calls are invoked sequentially while further calls in parallel.

Definition at line 83 of file ParallelCallTest.cxx.

83 {
84 // Suppress undefined behavior warning resulting from a tbb bug.
85 // /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/sw/lcg/releases/LCG_88/tbb/44_20160413/x86_64-slc6-gcc62-dbg/include/tbb/parallel_reduce.h:177:32: runtime error: member call on address 0x2aab14047b40 which does not point to an object of type 'task'
86 //0x2aab14047b40: note: object has invalid vptr
87 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
88 // cf. https://github.com/RcppCore/RcppParallel/issues/36
89 RedirStderr redir;
90
91 //std::vector<ParallelCallTest*> tests( testList.begin(), testList.end() );
92 return tbb::parallel_reduce( tbb::blocked_range< std::vector<ParallelCallTest*>::const_iterator >( tests.begin(), tests.end() ),
93 true, // initial value
94 [&]( tbb::blocked_range< std::vector<ParallelCallTest*>::const_iterator > groupOfTests, bool statusSoFar ) -> bool {
95 bool success = true;
96 for ( auto test : groupOfTests ) {
97 success = test->run( nrepeats ) and success;
98 }
99 return statusSoFar and success;
100 },
101 []( bool allCallsStatus, bool thisCallStatus ) -> bool { // result accumulation
102 return allCallsStatus and thisCallStatus;
103 } );
104}

◆ nrobs()

size_t AskForROBs::nrobs ( ) const
inline

Definition at line 40 of file ROBDataProviderMTTest.cxx.

40{ return m_ROBIDs.size(); }

◆ run()

bool ParallelCallTest::run ( size_t nrepeats)
inherited

runs the stress test by invoking it the firstCall and then repetitively the callAndCompare

  • nrepeats times (>=1) A single failure of the callAndCompare would result in the whole execution failed

Definition at line 69 of file ParallelCallTest.cxx.

69 {
70 firstCall();
71
72 return tbb::parallel_reduce( tbb::blocked_range<int>( 0, nrepeats, 1 ),
73 true, // initial value
74 [&]( tbb::blocked_range<int>, bool statusSoFar ) -> bool {
75 return callAndCompare() and statusSoFar;
76 },
77 []( bool allCallsStatus, bool thisCallStatus ) -> bool { // result accumulation
78 return allCallsStatus and thisCallStatus;
79 } );
80}
virtual bool callAndCompare() const =0
a function that performs request, and compares the results obtained with the result of the first exec...
virtual void firstCall()=0
a method that will be called to obtain first results from the service It should set the reference qua...

Member Data Documentation

◆ m_context

EventContext AskForROBs::m_context
private

Definition at line 55 of file ROBDataProviderMTTest.cxx.

◆ m_lvl1ID

uint32_t AskForROBs::m_lvl1ID
private

Definition at line 53 of file ROBDataProviderMTTest.cxx.

◆ m_ROBIDs

std::vector<uint32_t> AskForROBs::m_ROBIDs
private

Definition at line 54 of file ROBDataProviderMTTest.cxx.

◆ m_svc

const ServiceHandle<IROBDataProviderSvc>& AskForROBs::m_svc
private

Definition at line 56 of file ROBDataProviderMTTest.cxx.


The documentation for this class was generated from the following file: