Go to the documentation of this file.
15 #include <boost/format.hpp>
18 #include <fmt/format.h>
34 constexpr
double minute = 60 *
second;
35 constexpr
double hour = 60 * minute;
36 constexpr
double day = 24 * hour;
37 constexpr
double week = 7 * day;
38 constexpr
double month = 30 * day;
39 constexpr
double year = 365 * day;
83 return "Time User : " +
90 return "Time System : " +
96 return "TimeElapsed: " +
103 const double maximal,
const unsigned long number )
const {
106 constexpr
auto fmt =
"Tot={1:5.3g}{0:5} {3} #={2:3}";
107 constexpr
auto stat_fmt =
"Ave/Min/Max={1:8.3g}(+-{2:8.3g})/{3:8.3g}/{4:8.3g}{0:5}";
112 { 500, minute,
"[min]" },
113 { 500, hour,
" [h]" },
114 { 10, day,
"[day]" },
116 { 20, month,
"[mon]" },
117 { -1, year,
" [y]" } } };
119 auto i = find_if(
begin( tbl ), prev(
end( tbl ) ),
120 [&](
const auto& i ) {
return total < std::get<0>( i ) * std::get<1>( i ); } );
121 long double unit = std::get<1>( *i );
122 std::string_view unit_name = std::get<2>( *i );
126 auto i = find_if(
begin( tbl ), prev(
end( tbl ) ),
127 [&](
const auto& i ) {
return total < std::get<0>( i ) * std::get<1>( i ); } );
128 auto unit = std::get<1>( *i );
129 std::string_view unit_name = std::get<2>( *i );
130 return fmt::format( stat_fmt, unit_name, (
double)( mean / unit ), (
double)( rms / unit ),
131 (
double)( minimal / unit ), (
double)( maximal / unit ) );
137 return fmt::format(
fmt, unit_name, (
double)( total / unit ), number, stats() );
171 using namespace boost::io;
172 _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
224 _fmt % ( stat->nEntries() )
225 % ( 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.