GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Basic_Stats.h
blob4cc4bd2d63b3284c2e45d896828b1f92ab5449ae
2 //=============================================================================
3 /**
4 * @file Basic_Stats.h
6 * @author Carlos O'Ryan <coryan@uci.edu>
7 */
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)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
23 /// Collect basic stats about a series of samples
24 /**
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
31 public:
32 #if !defined (ACE_WIN32)
33 typedef ACE_UINT32 scale_factor_type;
34 #else
35 typedef ACE_UINT64 scale_factor_type;
36 #endif
38 /// Constructor
39 /**
40 * The number of samples is pre-allocated, and cannot changes once
41 * the class is initialized.
43 ACE_Basic_Stats (void);
45 /// The number of samples received so far
46 ACE_UINT32 samples_count (void) 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
55 /**
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_;
67 /// The minimum value
68 ACE_UINT64 min_;
70 /// The number of the sample that had the minimum value
71 ACE_UINT32 min_at_;
73 /// The maximum value
74 ACE_UINT64 max_;
76 /// The number of the sample that had the maximum value
77 ACE_UINT32 max_at_;
79 /// The sum of all the values
80 ACE_UINT64 sum_;
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 */