1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_statistics_Meter_hpp
10 #define anna_statistics_Meter_hpp
12 #include <anna/timex/Meter.hpp>
18 #include <anna/statistics/Accumulator.hpp>
30 namespace statistics {
36 //------------------------------------------------------------------------------
37 //------------------------------------------------------------------ class Meter
38 //------------------------------------------------------------------------------
40 * Accumulated data information for statistic sample oriented to processing time.
41 * It manage a single concept, with integer nature sample and unit 'milliseconds'.
43 * @short Processing time control
51 Meter(const std::string & description);
60 * Sets the time control point for processing measure
62 void setControlPoint(void) throw() { a_meter.setControlPoint(); }
68 void reset(void) throw() { a_accumulator.reset(); }
72 * Process new value for the sample: milliseconds time since last control point
74 * @return Returns processed delay
76 Millisecond process(void) throw() { a_accumulator.process(a_single_accumulator_concept_id, a_meter.getDelay()); return (a_meter.getDelay()); }
82 * @param Meter Class instance source of data
84 * @return Returns copied reference
86 const Meter & operator = (const Meter & meter);
93 // * Gets accumulator information in order to extract statistics indicators
95 // const Accumulator & getAccumulator(void) const throw() { return (a_accumulator); }
98 * Gets accumulator value information (statistics indicators)
100 * @param operation Solicited operation
102 * @return Value for solicited operation
104 double getAccumulatorValue(const Operation::Type &operation) const throw() { return (a_accumulator.getValue(a_single_accumulator_concept_id, operation)); }
108 * Class string representation
110 * @param numberOfDecimals Number of float decimals at representation string. Default is 2.
112 * @return String with class content
114 std::string asString(const int & numberOfDecimals = 2) const throw();
118 * Class XML representation
120 * @param numberOfDecimals Number of float decimals at XML representation. Default is 2.
122 * @return XML with class content
124 anna::xml::Node* asXML(anna::xml::Node* parent, const int & numberOfDecimals = 2) const throw();
130 timex::Meter a_meter;
131 Accumulator a_accumulator;
132 int a_single_accumulator_concept_id;