#include <GaudiKernel/ChronoEntity.h>
|
| std::string | format (const double total, const double minimal, const double mean, const double rms, const double maximal, const unsigned long number) const |
| | format More...
|
| |
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local timer
- Author
- Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
- Date
- December 1, 1999
Definition at line 26 of file ChronoEntity.h.
◆ ChronoEntity()
| ChronoEntity::ChronoEntity |
( |
| ) |
|
|
default |
◆ delta()
return the last delta-time of type "type"
Definition at line 184 of file ChronoEntity.h.
◆ eMaximalTime()
| double ChronoEntity::eMaximalTime |
( |
| ) |
const |
|
inline |
◆ eMeanErrorTime()
| double ChronoEntity::eMeanErrorTime |
( |
| ) |
const |
|
inline |
◆ eMeanTime()
| double ChronoEntity::eMeanTime |
( |
| ) |
const |
|
inline |
◆ eMinimalTime()
| double ChronoEntity::eMinimalTime |
( |
| ) |
const |
|
inline |
◆ eRMSTime()
| double ChronoEntity::eRMSTime |
( |
| ) |
const |
|
inline |
◆ eTotalTime()
| double ChronoEntity::eTotalTime |
( |
| ) |
const |
|
inline |
◆ format()
| std::string ChronoEntity::format |
( |
const double |
total, |
|
|
const double |
minimal, |
|
|
const double |
mean, |
|
|
const double |
rms, |
|
|
const double |
maximal, |
|
|
const unsigned long |
number |
|
) |
| const |
|
protected |
format
- Todo:
- : cache the format
Definition at line 80 of file ChronoEntity.cpp.
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() );
◆ kMaximalTime()
| double ChronoEntity::kMaximalTime |
( |
| ) |
const |
|
inline |
◆ kMeanErrorTime()
| double ChronoEntity::kMeanErrorTime |
( |
| ) |
const |
|
inline |
◆ kMeanTime()
| double ChronoEntity::kMeanTime |
( |
| ) |
const |
|
inline |
◆ kMinimalTime()
| double ChronoEntity::kMinimalTime |
( |
| ) |
const |
|
inline |
◆ kRMSTime()
| double ChronoEntity::kRMSTime |
( |
| ) |
const |
|
inline |
◆ kTotalTime()
| double ChronoEntity::kTotalTime |
( |
| ) |
const |
|
inline |
◆ nOfMeasurements()
| unsigned long ChronoEntity::nOfMeasurements |
( |
| ) |
const |
|
inline |
◆ operator+=()
◆ outputElapsedTime() [1/2]
| std::string ChronoEntity::outputElapsedTime |
( |
| ) |
const |
print the chrono ;
Definition at line 76 of file ChronoEntity.cpp.
77 return "TimeElapsed: " +
◆ outputElapsedTime() [2/2]
| std::string ChronoEntity::outputElapsedTime |
( |
std::string_view |
fmt, |
|
|
System::TimeType |
unit |
|
) |
| const |
|
inline |
print the chrono according the format and units
- Parameters
-
| fmt | the format string |
| unit | the unit |
- Returns
- the string representations
- See also
- boost::format
Definition at line 225 of file ChronoEntity.h.
◆ outputSystemTime() [1/2]
| std::string ChronoEntity::outputSystemTime |
( |
| ) |
const |
print the chrono ;
Definition at line 72 of file ChronoEntity.cpp.
73 return "Time System : " +
◆ outputSystemTime() [2/2]
| std::string ChronoEntity::outputSystemTime |
( |
std::string_view |
fmt, |
|
|
System::TimeType |
unit |
|
) |
| const |
|
inline |
print the chrono according the format and units
- Parameters
-
| fmt | the format string |
| unit | the unit |
- Returns
- the string representations
- See also
- boost::format
Definition at line 215 of file ChronoEntity.h.
◆ outputTime()
print the chrono according the format and units
The format fields are:
- number of entries
- total time (in the specified units)
- mean time (in the specified units)
- r.m.s. time (in the specified units)
- error in mean time (in the specified units)
- minimal time (in the specified units)
- maximal time (in the specified units)
- Parameters
-
| typ | the chrono type |
| fmt | the format string |
| unit | the unit |
- Returns
- the string representations
- See also
- boost::format
Definition at line 134 of file ChronoEntity.cpp.
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 )
◆ outputUserTime() [1/2]
| std::string ChronoEntity::outputUserTime |
( |
| ) |
const |
print the chrono ;
Definition at line 68 of file ChronoEntity.cpp.
69 return "Time User : " +
◆ outputUserTime() [2/2]
| std::string ChronoEntity::outputUserTime |
( |
std::string_view |
fmt, |
|
|
System::TimeType |
unit |
|
) |
| const |
|
inline |
print the chrono according the format and units
- Parameters
-
| fmt | the format string |
| unit | the unit |
- Returns
- the string representations
- See also
- boost::format
Definition at line 205 of file ChronoEntity.h.
◆ start()
◆ status()
◆ stop()
◆ totalTime()
| double ChronoEntity::totalTime |
( |
| ) |
const |
|
inline |
◆ uMaximalTime()
| double ChronoEntity::uMaximalTime |
( |
| ) |
const |
|
inline |
◆ uMeanErrorTime()
| double ChronoEntity::uMeanErrorTime |
( |
| ) |
const |
|
inline |
◆ uMeanTime()
| double ChronoEntity::uMeanTime |
( |
| ) |
const |
|
inline |
◆ uMinimalTime()
| double ChronoEntity::uMinimalTime |
( |
| ) |
const |
|
inline |
◆ uRMSTime()
| double ChronoEntity::uRMSTime |
( |
| ) |
const |
|
inline |
◆ uTotalTime()
| double ChronoEntity::uTotalTime |
( |
| ) |
const |
|
inline |
◆ operator<
comparison operator
Definition at line 88 of file ChronoEntity.h.
89 return std::make_tuple( lhs.totalTime(), lhs.m_user, lhs.m_kernel, lhs.m_elapsed ) <
90 std::make_tuple( rhs.totalTime(), rhs.m_user, rhs.m_kernel, rhs.m_elapsed );
◆ m_delta
◆ m_elapsed
◆ m_kernel
◆ m_start
start stamp for current measurement of process times
Definition at line 152 of file ChronoEntity.h.
◆ m_status
◆ m_user
◆ TimeUnit
internal unit used for the system time conversion (microseconds)
Definition at line 160 of file ChronoEntity.h.
The documentation for this class was generated from the following files:
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 ChronoTime
Type of the delta-time.
double uMinimalTime() const
minimal measurement for user time
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
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
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
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