Commit 27a0feec authored by Sebastien Ponce's avatar Sebastien Ponce Committed by Charles Leggett
Browse files

Fixed indentation of new counters to be backward compatible and added an accumulate helper function

parent 431aa3a9
......@@ -533,7 +533,7 @@ long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
for ( const auto& entry : m_counters ) {
std::ostringstream ost;
entry.second.get().print( ost, entry.first );
msg << "\n |" << ost.str();
msg << "\n" << ost.str();
}
//
msg << endmsg;
......
......@@ -160,7 +160,7 @@ private:
Gaudi::Property<std::string> m_header{
this, "StatTableHeader",
" Counter | # | sum | mean/eff^* | rms/err^* | min | max |",
" | Counter | # | sum | mean/eff^* | rms/err^* | min | max |",
"The header row for the output Stat-table"};
Gaudi::Property<bool> m_useEffFormat{this, "UseEfficiencyRowFormat", true,
"Use the special format for printout of efficiency counters"};
......
......@@ -36,11 +36,11 @@ ChronoStatSvc INFO Time User : Tot=0.527 [s]
******Stat****** INFO ****************************************************************************************************
******Stat****** INFO The Final stat Table (ordered)
******Stat****** INFO ****************************************************************************************************
******Stat****** INFO Counter | # | sum | mean/eff^* | rms/err^* | min | max |
******Stat****** INFO "counter1" | 20000 | -0.452 |-2.2600e-05 | 0.10002 | -0.10005 | 0.10000 |
******Stat****** INFO *"eff" | 20000 | 7991 |( 39.95500 +- 0.3463451)%| ------- | ------- |
******Stat****** INFO "counter3" | 20000 | 13000 | 0.65000 | 0.35000 | 0.30000 | 1.0000 |
******Stat****** INFO "counter2" | 100020000 | -12260.23 |-0.00012258 | 0.10052 | -1.0000 | 0.10000 |
******Stat****** INFO | Counter | # | sum | mean/eff^* | rms/err^* | min | max |
******Stat****** INFO | "counter1" | 20000 | -0.452 |-2.2600e-05 | 0.10002 | -0.10005 | 0.10000 |
******Stat****** INFO |*"eff" | 20000 | 7991 |( 39.95500 +- 0.3463451)%| ------- | ------- |
******Stat****** INFO | "counter3" | 20000 | 13000 | 0.65000 | 0.35000 | 0.30000 | 1.0000 |
******Stat****** INFO | "counter2" | 100020000 | -12260.23 |-0.00012258 | 0.10052 | -1.0000 | 0.10000 |
******Stat****** INFO ****************************************************************************************************
ChronoStatSvc.f... INFO Service finalized successfully
ApplicationMgr INFO Application Manager Finalized successfully
......
......@@ -673,7 +673,7 @@ namespace Gaudi
{
std::string fmt( "#=%|-7lu|" );
if ( tableFormat ) {
fmt = "|%|7d| |";
fmt = "|%|10d| |";
}
o << boost::format{fmt} % this->nEntries();
return o;
......@@ -692,7 +692,7 @@ namespace Gaudi
{
std::string fmt;
if ( tableFormat ) {
fmt = "|%|7d| |%|11.7g| |%|#11.5g| |";
fmt = "|%|10d| |%|11.7g| |%|#11.5g| |";
} else {
fmt = "#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g|";
}
......@@ -714,7 +714,7 @@ namespace Gaudi
{
std::string fmt;
if ( tableFormat ) {
fmt = "|%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |";
fmt = "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |";
} else {
fmt = "#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g|";
}
......@@ -733,7 +733,7 @@ namespace Gaudi
{
std::string fmt;
if ( tableFormat ) {
fmt = "|%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |";
fmt = "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |";
} else {
fmt = "#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|";
}
......@@ -742,6 +742,9 @@ namespace Gaudi
}
};
/**
* A counter dealing with binomial data
*/
template <typename Arithmetic = double, atomicity Atomicity = atomicity::full>
struct BinomialCounter : BufferableCounter<bool, Atomicity, BinomialCounter>,
BinomialAccumulator<Arithmetic, Atomicity> {
......@@ -750,7 +753,7 @@ namespace Gaudi
{
std::string fmt;
if ( tableFormat ) {
fmt = "|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%|";
fmt = "|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%% |";
} else {
fmt = "#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|";
}
......@@ -761,11 +764,23 @@ namespace Gaudi
virtual std::ostream& print( std::ostream& o, const std::string& tag ) const override
{
// override default print to add a '*' in from of the name
o << boost::format{"*| %|-48.48s|%|50t|"} % ( "\"" + tag + "\"" );
o << boost::format{" |*%|-48.48s|%|50t|"} % ( "\"" + tag + "\"" );
return print( o, true );
}
};
/**
* A helper function for accumulating data from a container into a counter
* This is internally using buffers so that the original counter is only
* updated once.
*/
template <typename Counter, typename Container, typename Fun>
void accumulate( Counter& counter, const Container& container, Fun f = Identity{} )
{
auto b = counter.buffer();
for ( const auto& elem : container ) b += f( elem );
}
} // namespace Accumulators
} // namespace Gaudi
......@@ -899,7 +914,7 @@ public:
return o << boost::format{fmt} % BinomialAccParent::nEntries() % sum() % ( efficiency() * 100 ) %
( efficiencyErr() * 100 );
} else {
fmt = "*" + fmtHead + "|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%%| ------- | ------- |";
fmt = " |*" + fmtHead + "|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%%| ------- | ------- |";
return o << boost::format{fmt} % ( "\"" + name + "\"" ) % BinomialAccParent::nEntries() % sum() %
( efficiency() * 100 ) % ( efficiencyErr() * 100 );
}
......@@ -917,7 +932,7 @@ public:
return o << boost::format{fmt} % nEntries() % sum() % mean() % standard_deviation() % min() % max();
} else {
fmt = " " + fmtHead + "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |";
fmt = " | " + fmtHead + "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |";
return o << boost::format{fmt} % ( "\"" + name + "\"" ) % nEntries() % sum() % mean() % standard_deviation() %
min() % max();
}
......
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