X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FStatistics.hh;h=41ead1aa8a1c491bdb1d7b721d1b77d02d28a7a0;hb=5b2e9a63a43027c71ac470ac9bdecb72e8974951;hp=3ac5d4379586afadb5bdf636f6ce13bdb2093b69;hpb=1ff86abcd6cd22bffcab7967b0bf7495e83a0de5;p=senf.git diff --git a/senf/Utils/Statistics.hh b/senf/Utils/Statistics.hh index 3ac5d43..41ead1a 100644 --- a/senf/Utils/Statistics.hh +++ b/senf/Utils/Statistics.hh @@ -38,9 +38,10 @@ #include "Exception.hh" #include #include +#include "StatisticAccumulator.hh" //#include "Statistics.mpp" -///////////////////////////////hh.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace senf { @@ -49,13 +50,14 @@ namespace senf { The statistics functionality has two parts: \li the senf::Statistics class + \li the senf::StatisticsAccumulator class \li statistics sources Each senf::Statistics instance collects information about a single parameter. Which parameter is set up by connecting the Statistics instance with an arbitrary statistics source. - %Statistics sources are + %Statistics sources are Boost Signals which are emitted periodically to provide new data. */ @@ -78,7 +80,7 @@ namespace senf { struct OutputEntry; public: - /////////////////////////////////////////////////////////////////////////// + //-//////////////////////////////////////////////////////////////////////// // Types typedef boost::iterator_range CollectorRange; @@ -146,9 +148,9 @@ namespace senf { template friend class OutputProxy; }; - /////////////////////////////////////////////////////////////////////////// + //-//////////////////////////////////////////////////////////////////////// ///\name Accessing the current value - ///\{ + //\{ float min() const; ///< Last min value entered float avg() const; ///< Last avg value entered @@ -159,10 +161,10 @@ namespace senf { /**< \returns number of basic values collected into each new value by this collector. */ - ///\} - /////////////////////////////////////////////////////////////////////////// + //\} + //-//////////////////////////////////////////////////////////////////////// ///\name Child collectors - ///\{ + //\{ Collector & operator[](unsigned rank); ///< Get child collector @@ -172,6 +174,14 @@ namespace senf { collector collects into each combined value. \throws InvalidRankException if \a rank is not a valid registered rank value. */ + Collector const & operator[](unsigned rank) const; + ///< Get child collector + /**< This member will return a const reference to the + collector collecting \a rank values. + \param[in] rank Number of values the requested + collector collects into each combined value. + \throws InvalidRankException if \a rank is not a valid + registered rank value. */ CollectorRange collectors(); ///< List all child collectors /**< \returns iterator range of child collector references */ @@ -196,8 +206,8 @@ namespace senf { is empty, otherwise it is built by joining the collector ranks. */ - ///\} - /////////////////////////////////////////////////////////////////////////// + //\} + //-//////////////////////////////////////////////////////////////////////// ///\name Result generation OutputProxy output(unsigned n = 1u); @@ -213,8 +223,8 @@ namespace senf { \endcode \param[in] n size of sliding average window */ - ///\} - /////////////////////////////////////////////////////////////////////////// + //\} + //-//////////////////////////////////////////////////////////////////////// // Exceptions struct InvalidRankException : public senf::Exception @@ -455,6 +465,18 @@ namespace senf { ///< Same as operator() with \a min == \a avg == \a max /**< Provided so a Statistics instance can be directly used as a signal target. */ + void operator()(StatisticsData const & data); + ///< Same as operator(), but imports statistics data from a StatisticsData object + /**< Provided so a Statistics instance can be directly used + as a signal target. */ + template + void operator()(unsigned n, StatisticAccumulator & sa); + ///< Same as operator() gathers values from StatisticAccumulator + /**< Provided so a Statistics instance can be directly used + as a signal target. Caution: Clears values in + StatisticAccumulator afterwards + \param[in] n number of time-slices + \param[in] sa StatisticAccumulator*/ StatisticsBase::OutputProxy output(unsigned n = 1u); @@ -501,7 +523,7 @@ namespace senf { } -///////////////////////////////hh.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #include "Statistics.cci" //#include "Statistics.ct" #include "Statistics.cti"