3 //=============================================================================
5 * @file Sample_History.h
7 * @author Carlos O'Ryan <coryan@uci.edu>
9 //=============================================================================
12 #ifndef ACE_SAMPLE_HISTORY_H
13 #define ACE_SAMPLE_HISTORY_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
17 #include "ace/Basic_Types.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 class ACE_Basic_Stats
;
27 /// Save multiple samples in an array
29 * Save multiple samples (usually latency numbers), into an array, and
30 * later print them in several formats.
32 class ACE_Export ACE_Sample_History
35 #if !defined (ACE_WIN32)
36 typedef ACE_UINT32 scale_factor_type
;
38 typedef ACE_UINT64 scale_factor_type
;
43 * The number of samples is pre-allocated, and cannot changes once
44 * the class is initialized.
46 ACE_Sample_History (size_t max_samples
);
49 ~ACE_Sample_History ();
51 /// Record one sample.
53 * Return 0 on success, -1 if the sample could not be stored
55 int sample (ACE_UINT64 value
);
57 /// Returns the maximum number of samples
58 size_t max_samples () const;
60 /// Returns the current number of samples
61 size_t sample_count () const;
63 /// Dump all the samples
65 * Prints out all the samples, using @a msg as a prefix for each
68 void dump_samples (const ACE_TCHAR
*msg
,
69 scale_factor_type scale_factor
) const;
71 /// Collect the summary for all the samples
72 void collect_basic_stats (ACE_Basic_Stats
&) const;
75 ACE_UINT64
get_sample (size_t i
) const;
78 /// The maximum number of samples
81 /// The current number of samples
88 ACE_END_VERSIONED_NAMESPACE_DECL
90 #if defined (__ACE_INLINE__)
91 #include "ace/Sample_History.inl"
92 #endif /* __ACE_INLINE__ */
94 #include /**/ "ace/post.h"
95 #endif /* ACE_SAMPLE_HISTORY_H */