CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
Stats.h
Go to the documentation of this file.
1
7#if !defined(_STATS_H_)
8#define _STATS_H_
9
10#include "Utils.h"
11
12namespace cmlabs {
13
43class Stats {
44public:
46 static bool UnitTest();
47
49 Stats(uint32 maxCount = 10000);
50 ~Stats();
51
53 bool clear();
55 bool add(double val);
56
57 double getAverage();
58 double getSum();
59 uint32 getCount();
60 double getVariance();
61 double getStdDev();
62 double getMedian();
63
64protected:
65 uint32 maxCount;
67 std::list<double> entries;
68};
69
70
71} // namespace cmlabs
72
73#endif //_STATS_H_
74
Cross-platform utility toolbox for CMSDK: threading, synchronization, shared memory,...
double getMedian()
Definition Stats.cpp:73
double getStdDev()
Definition Stats.cpp:103
Stats(uint32 maxCount=10000)
Create a collector.
Definition Stats.cpp:12
uint32 getCount()
Definition Stats.cpp:107
std::list< double > entries
Definition Stats.h:67
double getSum()
Definition Stats.cpp:38
double getAverage()
Definition Stats.cpp:48
bool clear()
Remove all samples.
Definition Stats.cpp:22
double getVariance()
Definition Stats.cpp:56
bool add(double val)
Add a sample, evicting the oldest when the window is full.
Definition Stats.cpp:29
uint32 maxCount
Definition Stats.h:65
static bool UnitTest()
Self test.
Definition Stats.cpp:116
utils::Mutex mutex
Definition Stats.h:66
Recursive mutual-exclusion lock, optionally named for cross-process use.
Definition Utils.h:463