Skip to content
Snippets Groups Projects
Commit 03d5d18d authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Dropped usage of (UN)LIKELY macro

The intention being to measure the impact (if any) on throughput with a
modern compiler
parent e4849b6f
No related branches found
No related tags found
2 merge requests!3788Draft: Update SciFi cluster monitoring,!3698Migrate `IMuonRawBuffer` and `MuonRawBuffer` from LHCb to here
......@@ -49,7 +49,7 @@ namespace {
TESOffsetGuard( GaudiTool& parent, int& parentScope, const std::string& offset )
: m_parent( &parent ), m_parentScope( parentScope ) {
if ( ++m_parentScope != 1 ) return; // not the outermost guard
if ( UNLIKELY( m_parent->msgLevel( MSG::DEBUG ) ) ) m_parent->debug() << " changing rootInTES " << endmsg;
if ( m_parent->msgLevel( MSG::DEBUG ) ) m_parent->debug() << " changing rootInTES " << endmsg;
m_original = m_parent->rootInTES();
StatusCode sc = m_parent->setProperty( "RootInTES", offset );
if ( sc.isFailure() ) {
......@@ -108,7 +108,7 @@ void MuonRawBuffer::handle( const Incident& incident ) {
}
void MuonRawBuffer::clearData() {
if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << " reset all buffers " << endmsg;
if ( msgLevel( MSG::DEBUG ) ) debug() << " reset all buffers " << endmsg;
m_checkTell1HeaderPerformed = false;
m_checkTell1HeaderResult = true;
m_status.reset();
......@@ -324,16 +324,16 @@ StatusCode MuonRawBuffer::decodeTileAndTDCV1( const RawBank* rawdata ) {
unsigned int pp_cnt = *it++;
m_hitNumInPP[tell1Number * 4 + i] = pp_cnt;
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " hit in PP " << pp_cnt << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " hit in PP " << pp_cnt << endmsg;
for ( unsigned int loop = 0; loop < pp_cnt; ++loop ) {
unsigned int add = ( *it ) & ( 0x0FFF );
unsigned int tdc_value = ( ( ( *it ) & ( 0xF000 ) ) >> 12 );
++it;
MuonTileID tile = m_muonDet->getDAQInfo()->getADDInTell1( tell1Number, add );
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " add " << add << ' ' << tile << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " add " << add << ' ' << tile << endmsg;
if ( tile.isValid() ) {
if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << " valid add " << add << ' ' << tile << endmsg;
if ( msgLevel( MSG::DEBUG ) ) debug() << " valid add " << add << ' ' << tile << endmsg;
m_storage[tell1Number].emplace_back( tile, tdc_value );
} else {
m_counter_invalid_hit[tell1Number]++;
......@@ -425,7 +425,7 @@ StatusCode MuonRawBuffer::getTile( const LHCb::RawEvent* raw, std::vector<LHCb::
if ( !sc.isFailure() ) {
const auto& b = raw->banks( RawBank::Muon );
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " tell1 " << b.size() << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " tell1 " << b.size() << endmsg;
// first decode data and insert in buffer
for ( const auto& r : b ) {
......@@ -453,7 +453,7 @@ StatusCode MuonRawBuffer::getTileAndTDC( const LHCb::RawEvent*
if ( !sc.isFailure() ) {
storage.clear();
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " start the real decoding " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " start the real decoding " << endmsg;
const auto& mb = raw->banks( RawBank::Muon );
......@@ -462,7 +462,7 @@ StatusCode MuonRawBuffer::getTileAndTDC( const LHCb::RawEvent*
StatusCode sc = DecodeData( r );
if ( sc.isFailure() ) return sc;
}
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " the decoding is finished " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " the decoding is finished " << endmsg;
// compact data in one container
for ( const auto& r : mb ) {
......@@ -593,7 +593,7 @@ StatusCode MuonRawBuffer::decodeNZSupp( int tell1Number ) {
if ( !raw ) return Error( "Failed to find raw data" );
const auto& b = raw->banks( RawBank::MuonFull );
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " tell1 " << b.size() << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " tell1 " << b.size() << endmsg;
if ( b.empty() ) {
info() << " you have request NZS bank for muon detectorct ---> "
<< "such bank are not presente in input file " << endmsg;
......@@ -603,7 +603,7 @@ StatusCode MuonRawBuffer::decodeNZSupp( int tell1Number ) {
}
StatusCode MuonRawBuffer::decodeNZSupp( const LHCb::RawBank* r ) {
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " start decoding " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " start decoding " << endmsg;
unsigned int tell1Num = ( r )->sourceID();
if ( RawBank::MagicPattern != r->magic() ) {
error() << "magic pattern not correct in muon bank " << endmsg;
......@@ -617,7 +617,7 @@ StatusCode MuonRawBuffer::decodeNZSupp( const LHCb::RawBank* r ) {
// loop on PP
for ( int pp_num = 0; pp_num < 4; pp_num++ ) {
unsigned int off = pp_num * 6;
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " pp 0 " << pp_num << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " pp 0 " << pp_num << endmsg;
// skip first 6 words ... always set to zero
std::advance( it, 6 );
......@@ -645,7 +645,7 @@ StatusCode MuonRawBuffer::decodeNZSupp( const LHCb::RawBank* r ) {
it++;
}
}
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " now fill the buffer " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " now fill the buffer " << endmsg;
// now copy the data to the buffer
for ( int i = 0; i < 24; i++ ) { m_ODEData[tell1Num * 24 + i].setData( data[i] ); }
return StatusCode::SUCCESS;
......@@ -671,7 +671,7 @@ StatusCode MuonRawBuffer::getNZSupp( const LHCb::RawBank*
std::vector<std::pair<LHCb::MuonTileID, unsigned int>>& tileAndTDC ) {
unsigned int tell1Number = r->sourceID();
m_NZSprocessed_bank[tell1Number]++;
if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << " t1 " << tell1Number << endmsg;
if ( msgLevel( MSG::DEBUG ) ) debug() << " t1 " << tell1Number << endmsg;
int fix_size = ( c_NLink * 36 + 8 * 4 ) * 4;
if ( r->size() != fix_size ) return StatusCode::FAILURE;
......@@ -683,7 +683,7 @@ StatusCode MuonRawBuffer::getNZSupp( const LHCb::RawBank*
unsigned int ODE_num = ( m_muonDet->getDAQInfo() )->getODENumberInLink( tell1Number, iLink );
if ( ODE_num > 0 ) {
if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << " ODE " << ODE_num << endmsg;
if ( msgLevel( MSG::DEBUG ) ) debug() << " ODE " << ODE_num << endmsg;
unsigned int ch = 0;
for ( unsigned int iData = 1; iData < c_NLink + 1; iData++ ) {
......@@ -710,7 +710,7 @@ MuonPPEventInfo MuonRawBuffer::getPPInfo( const LHCb::RawBank* r, unsigned int p
unsigned int tell1Number = r->sourceID();
if ( !m_ODEAlreadyDecoded[tell1Number] ) {
StatusCode sc = decodeNZSupp( r );
if ( sc.isFailure() && UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "error in decoding NZSP bank" << endmsg;
if ( sc.isFailure() && msgLevel( MSG::DEBUG ) ) debug() << "error in decoding NZSP bank" << endmsg;
}
return m_PPEventInfo[tell1Number * 4 + pp_num];
}
......@@ -719,7 +719,7 @@ MuonPPEventInfo MuonRawBuffer::getPPInfo( unsigned int tell1Number, unsigned int
if ( !m_ODEAlreadyDecoded[tell1Number] ) {
// serach for bank and decode it
StatusCode sc = decodeNZSupp( tell1Number );
if ( sc.isFailure() && UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "error in decoding NZSP bank" << endmsg;
if ( sc.isFailure() && msgLevel( MSG::DEBUG ) ) debug() << "error in decoding NZSP bank" << endmsg;
}
return m_PPEventInfo[tell1Number * 4 + pp_num];
}
......@@ -751,7 +751,7 @@ StatusCode MuonRawBuffer::getNZSupp( const LHCb::RawEvent*
TESOffsetGuard guard{*this, m_TESChanged, offset};
const auto& b = raw->banks( RawBank::MuonFull );
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " tell1 " << b.size() << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " tell1 " << b.size() << endmsg;
if ( b.empty() ) {
info() << " you have request NZS bank for muon detectorct ---> "
<< "such bank ar enot presente in input file " << endmsg;
......@@ -900,16 +900,16 @@ std::vector<std::pair<MuonTell1Header, unsigned int>> MuonRawBuffer::getHeaders(
}
StatusCode MuonRawBuffer::checkAllHeaders( const LHCb::RawEvent* raw ) {
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " check headers consistency " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " check headers consistency " << endmsg;
if ( m_checkTell1HeaderPerformed ) return StatusCode{m_checkTell1HeaderResult};
m_checkTell1HeaderPerformed = true;
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " check headers consistency not yet done" << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " check headers consistency not yet done" << endmsg;
const auto& b = raw->banks( RawBank::Muon );
if ( b.empty() ) {
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " no muon banks in event" << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " no muon banks in event" << endmsg;
for ( int i = 0; i < static_cast<int>( MuonDAQHelper_maxTell1Number ); i++ ) {
m_status->addStatus( i, RawBankReadoutStatus::Status::Missing );
}
......@@ -930,7 +930,7 @@ StatusCode MuonRawBuffer::checkAllHeaders( const LHCb::RawEvent* raw ) {
if ( iList != tell1InEvent.end() ) {
m_checkTell1HeaderResult = false;
m_checkTell1HeaderPerformed = true;
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " failed " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " failed " << endmsg;
foundError = true;
m_status->addStatus( tell1Number, RawBankReadoutStatus::Status::NonUnique );
break;
......@@ -964,7 +964,7 @@ StatusCode MuonRawBuffer::checkAllHeaders( const LHCb::RawEvent* raw ) {
m_status->addStatus( ( *ibad )->sourceID(), RawBankReadoutStatus::Status::Tell1Error );
return StatusCode::FAILURE; // return m_checkTell1HeaderResult;
}
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " test successeful " << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " test successeful " << endmsg;
return StatusCode::SUCCESS;
}
......@@ -973,7 +973,7 @@ void MuonRawBuffer::fillTell1Header( unsigned int tell1Number, unsigned int data
if ( m_already_decoded_headerTell1[tell1Number] ) return;
MuonTell1Header dataWord( data );
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << dataWord.getError() << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << dataWord.getError() << endmsg;
if ( dataWord.getError() ) m_tell1_header_error[tell1Number]++;
if ( dataWord.getOROfODEErrors() ) m_tell1_header_ORODE_error[tell1Number]++;
......@@ -993,8 +993,7 @@ void MuonRawBuffer::putStatusOnTES() {
if ( !status ) {
std::stringstream type;
type << toString( m_status->key() );
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) )
verbose() << "Status for bankType " << type.str() << " created now" << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << "Status for bankType " << type.str() << " created now" << endmsg;
status = new Status( *m_status );
statuss->insert( status );
......@@ -1002,8 +1001,7 @@ void MuonRawBuffer::putStatusOnTES() {
std::stringstream type;
type << toString( m_status->key() );
if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
debug() << "Status for bankType " << type.str() << " already exists" << endmsg;
if ( msgLevel( MSG::DEBUG ) ) debug() << "Status for bankType " << type.str() << " already exists" << endmsg;
if ( status->status() != m_status->status() ) {
Warning( "Status for bankType " + type.str() + " already exists with different status value -> merge both",
StatusCode::SUCCESS )
......@@ -1015,5 +1013,5 @@ void MuonRawBuffer::putStatusOnTES() {
void MuonRawBuffer::initStatus() {
if ( !m_status ) { m_status.emplace( RawBank::Muon ); }
if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) verbose() << " init " << m_status->key() << " " << *m_status << endmsg;
if ( msgLevel( MSG::VERBOSE ) ) verbose() << " init " << m_status->key() << " " << *m_status << endmsg;
}
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