9 # define _QI_STATS_HPP_
21 MinMaxSum() : _minValue(0), _maxValue(0), _cumulatedValue(0) {}
29 : _minValue(minValue), _maxValue(maxValue), _cumulatedValue(cumulatedValue)
33 const float&
minValue()
const {
return _minValue;}
35 const float&
maxValue()
const {
return _maxValue;}
46 _minValue = _maxValue = _cumulatedValue = val;
49 _cumulatedValue += val;
50 _minValue = (std::min)(_minValue, val);
51 _maxValue = (std::max)(_maxValue, val);
57 _minValue = _maxValue = _cumulatedValue = 0;
68 s << (_cumulatedValue / (float)count) <<
' ' << _minValue <<
' ' << _maxValue;
74 float _cumulatedValue;
92 : _count(count), _wall(wall), _user(user), _system(system)
107 _wall.
push(wall, _count==0);
108 _user.
push(user, _count==0);
109 _system.
push(system, _count==0);
131 const unsigned int&
count()
const {
return _count;}
150 #endif // !_QI_STATS_HPP_
Stores min, max and sum of values fed to it.
void push(float val, bool init=false)
Push a new value, process new min/max and add the value to cumulated.
void push(float wall, float user, float system)
Add value for all tree statistics values.
Store statistics about method calls.
MethodStatistics(unsigned count, MinMaxSum wall, MinMaxSum user, MinMaxSum system)
Constructor and Set.
std::string asString(unsigned int count) const
asString Get a string from min, max and cumulated.
MinMaxSum()
Default constructor.
const unsigned int & count() const
Get number of value added.
const float & cumulatedValue() const
Get sum of all value push value.
void reset()
Reset all value to 0 (count and MinMaxSum of all 3 statistics values)
MethodStatistics()
Constructor.
void reset()
Reset all three values to 0.
MinMaxSum(float minValue, float maxValue, float cumulatedValue)
Constructor.
const MinMaxSum & user() const
Get user MinMaxSum value.
const MinMaxSum & wall() const
Get wall MinMaxSum value.
const MinMaxSum & system() const
Get system MinMaxSum value.
const float & maxValue() const
Get maximum value.
void init(qi::LogLevel verb=qi::LogLevel_Info, qi::LogContext context=qi::LogContextAttr_ShortVerbosity|qi::LogContextAttr_Tid|qi::LogContextAttr_Category, bool synchronous=true)
Initialization of the logging system Creates and registers the default log handler according to QI_DE...
const float & minValue() const
Get minimum value.