LiquidFun
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
b2Stat.h
1 /*
2 * Copyright (c) 2013 Google, Inc.
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 * 3. This notice may not be removed or altered from any source distribution.
17 */
18 #ifndef B2_STAT
19 #define B2_STAT
20 
22 
24 class b2Stat
25 {
26 public:
27  b2Stat();
28 
30  void Record( float32 t );
31 
33  int GetCount() const;
34 
37  float32 GetMean() const;
38 
41  float32 GetMin() const;
42 
45  float32 GetMax() const;
46 
48  void Clear();
49 private:
50 
51  int m_count;
52  float64 m_total;
53  float32 m_min;
54  float32 m_max;
55 };
56 
57 #endif
void Record(float32 t)
Record a sample.
Definition: b2Stat.cpp:28
float32 GetMax() const
Definition: b2Stat.cpp:55
float32 GetMin() const
Definition: b2Stat.cpp:50
void Clear()
Erase all recorded samples.
Definition: b2Stat.cpp:60
int GetCount() const
Returns the number of recorded samples.
Definition: b2Stat.cpp:36
float32 GetMean() const
Definition: b2Stat.cpp:41
Calculates min/max/mean of a set of samples.
Definition: b2Stat.h:24