2 //=============================================================================
6 * @author Carlos O'Ryan <coryan@uci.edu>
8 //=============================================================================
10 #ifndef ACE_BASIC_STATS_H
11 #define ACE_BASIC_STATS_H
12 #include /**/ "ace/pre.h"
14 #include /**/ "ace/config-all.h"
15 #include "ace/Basic_Types.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
23 /// Collect basic stats about a series of samples
25 * Compute the average and standard deviation (aka jitter) for an
26 * arbitrary number of samples, using constant space.
27 * Normally used for latency statistics.
29 class ACE_Export ACE_Basic_Stats
32 #if !defined (ACE_WIN32)
33 typedef ACE_UINT32 scale_factor_type
;
35 typedef ACE_UINT64 scale_factor_type
;
40 * The number of samples is pre-allocated, and cannot changes once
41 * the class is initialized.
45 /// The number of samples received so far
46 ACE_UINT32
samples_count () const;
48 /// Record one sample.
49 void sample (ACE_UINT64 value
);
51 /// Update the values to reflect the stats in @a rhs.
52 void accumulate (const ACE_Basic_Stats
&rhs
);
54 /// Dump all the samples
56 * Prints out the results, using @a msg as a prefix for each message and
57 * scaling all the numbers by @a scale_factor. The latter is useful because
58 * high resolution timer samples are acquired in clock ticks, but often
59 * presented in microseconds.
61 void dump_results (const ACE_TCHAR
*msg
,
62 scale_factor_type scale_factor
) const;
64 /// The number of samples
65 ACE_UINT32 samples_count_
;
70 /// The number of the sample that had the minimum value
76 /// The number of the sample that had the maximum value
79 /// The sum of all the values
83 ACE_END_VERSIONED_NAMESPACE_DECL
85 #if defined (__ACE_INLINE__)
86 #include "ace/Basic_Stats.inl"
87 #endif /* __ACE_INLINE__ */
89 #include /**/ "ace/post.h"
90 #endif /* ACE_BASIC_STATS_H */