Commit 13988e15 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge branch 'master' into update-versions

parents 42af3178 ef68339e
......@@ -32,12 +32,6 @@ namespace Gaudi::Examples {
m_info += true;
m_info += false; // should do nothing...
}
StatusCode finalize() override {
forEachCounter(
[&]( const std::string& label, const auto& counter ) { counter.print( info(), label ) << endmsg; } );
return StatusCode::SUCCESS;
}
};
DECLARE_COMPONENT( CountingConsumer )
......
......@@ -4,7 +4,7 @@
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v32r0)
running on stbc-i5.nikhef.nl on Sat May 25 13:46:02 2019
running on stbc-i1.nikhef.nl on Fri Jul 5 15:24:29 2019
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
......@@ -97,9 +97,10 @@ CountingConsumer ERROR Suppressing message: 'This is not an error...'
CountingConsumer SUCCESS CountingConsumer: incrementing "This is not a warning" twice
CountingConsumer SUCCESS CountingConsumer: incrementing "This is not info" twice
ApplicationMgr INFO Application Manager Stopped successfully
CountingConsumer INFO | "This is not a warning..." | 4 |
CountingConsumer INFO | "This is not an error..." | 4 |
CountingConsumer INFO | "This is not info..." | 4 |
CountingConsumer INFO Number of counters : 3
| "This is not a warning..." | 4 |
| "This is not an error..." | 4 |
| "This is not info..." | 4 |
EventLoopMgr INFO Histograms converted successfully according to request.
ApplicationMgr INFO Application Manager Finalized successfully
ApplicationMgr INFO Application Manager Terminated successfully
......@@ -43,6 +43,12 @@ public:
return m_counters.size();
}
std::size_t nOfCountersToBePrinted() {
std::lock_guard lock{m_mutex};
return count_if( begin( m_counters ), end( m_counters ),
[]( const auto& c ) { return c.second.get().toBePrinted(); } );
}
void clearCounters() {
std::lock_guard lock{m_mutex};
m_counters.clear();
......
......@@ -576,6 +576,16 @@ namespace Gaudi {
sc = finalize();
}
if ( sc.isSuccess() ) {
if ( auto nCnt = nOfCountersToBePrinted(); nCnt ) {
auto& os = info() << "Number of counters : " << nCnt
<< "\n | Counter |";
forEachCounter( [&]( const std::string& label, const auto& counter ) {
if ( counter.toBePrinted() ) counter.print( os << '\n', label );
} );
os << endmsg;
}
// Indicate that this Algorithm has been finalized to prevent duplicate attempts
m_state = m_targetState;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment