Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
15 #include <boost/format.hpp>
16 #include <fmt/format.h>
23 constexpr
double minute = 60 *
second;
24 constexpr
double hour = 60 * minute;
25 constexpr
double day = 24 * hour;
26 constexpr
double week = 7 * day;
27 constexpr
double month = 30 * day;
28 constexpr
double year = 365 * day;
69 return "Time User : " +
73 return "Time System : " +
77 return "TimeElapsed: " +
80 std::string
ChronoEntity::format(
const double total,
const double minimal,
const double mean,
const double rms,
81 const double maximal,
const unsigned long number )
const {
84 constexpr
auto fmt =
"Tot={1:5.3g}{0:5} {3} #={2:3}";
85 constexpr
auto stat_fmt =
"Ave/Min/Max={1:8.3g}(+-{2:8.3g})/{3:8.3g}/{4:8.3g}{0:5}";
87 static const std::array<std::tuple<int, double, std::string_view>, 9> tbl{ { { 500,
microsecond,
" [us]" },
90 { 500, minute,
"[min]" },
91 { 500, hour,
" [h]" },
94 { 20, month,
"[mon]" },
95 { -1, year,
" [y]" } } };
97 auto i = find_if(
begin( tbl ), prev(
end( tbl ) ),
98 [&](
const auto& i ) {
return total < std::get<0>( i ) * std::get<1>( i ); } );
99 long double unit = std::get<1>( *i );
100 std::string_view unit_name = std::get<2>( *i );
102 auto stats = [&]() -> std::string {
104 auto i = find_if(
begin( tbl ), prev(
end( tbl ) ),
105 [&](
const auto& i ) {
return total < std::get<0>( i ) * std::get<1>( i ); } );
106 auto unit = std::get<1>( *i );
107 std::string_view unit_name = std::get<2>( *i );
108 return fmt::format( stat_fmt, unit_name, (
double)( mean / unit ), (
double)( rms / unit ),
109 (
double)( minimal / unit ), (
double)( maximal / unit ) );
115 return fmt::format(
fmt, unit_name, (
double)( total / unit ), number, stats() );
137 using namespace boost::io;
138 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
187 _fmt % ( stat->nEntries() )
188 % ( stat->
flag() / _unit )
StatEntity m_user
the actual storage of "user" time
StatEntity m_elapsed
the actual storage of "elapsed" time
double eMinimalTime() const
minimal measurement for elapsed time
double uMinimalTime() const
minimal measurement for user time
IChronoSvc::ChronoStatus stop()
stop the chrono
double eRMSTime() const
r.m.s Elapsed Time
std::string format(const double total, const double minimal, const double mean, const double rms, const double maximal, const unsigned long number) const
format
backward compatible StatEntity class.
double eMeanTime() const
average Elapsed Time
TimeValueType kernelTime() const
Retrieve the kernel time in the requested unit.
double eTotalTime() const
total Elapsed time
double kMinimalTime() const
minimal measurement for kernel time
TimeType
Time type for conversion.
IChronoSvc::ChronoStatus start()
start the current chrono
System::ProcessTime m_delta
delta process times
unsigned long nOfMeasurements() const
number of chrono measurements
IChronoSvc::ChronoStatus m_status
current status of this chrono object;
double uMeanTime() const
average User Time
constexpr double microsecond
std::string outputSystemTime() const
print the chrono ;
double flagMeanErr() const
TimeValueType elapsedTime() const
Retrieve the elapsed time in the requested unit.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
double kRMSTime() const
r.m.s Kernel Time
double kTotalTime() const
total Kernel time
std::string outputElapsedTime() const
print the chrono ;
std::string outputUserTime() const
print the chrono ;
System::ProcessTime m_start
start stamp for current measurement of process times
StatEntity m_kernel
the actual storage of "kernel" time
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
double kMaximalTime() const
maximal measurement for kernel time
double uRMSTime() const
r.m.s User Time
constexpr double nanosecond
double kMeanTime() const
average Kernel Time
constexpr double millisecond
static const System::TimeType TimeUnit
internal unit used for the system time conversion (microseconds)
double uMaximalTime() const
maximal measurement for user time
TimeValueType userTime() const
Retrieve the user time in the requested unit.
GAUDI_API ProcessTime getProcessTime(long pid=-1)
Retrieve the process time data for a process.
std::string outputTime(IChronoSvc::ChronoType typ, std::string_view fmt, System::TimeType unit) const
print the chrono according the format and units
double eMaximalTime() const
maximal measurement for elapsed time
double uTotalTime() const
total user time
ChronoEntity & operator+=(const ChronoEntity &entity)
Compound assignment operator.