summaryrefslogtreecommitdiff
path: root/ace/Stats.h
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-25 04:06:28 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-25 04:06:28 +0000
commit877c27e29a3cf44b4d7776121bdf74989c20006a (patch)
treeab8f0e34133a36086f2e0d7310dd15d86ddb8048 /ace/Stats.h
parent138b16f8862f2abb08c390789fd0edb1c506059a (diff)
downloadATCD-877c27e29a3cf44b4d7776121bdf74989c20006a.tar.gz
(mean): removed caching. It didn't account for the fact that it could
be called with different scale factors. (std_dev): fixed sum_of_squares calculation to always use 64-bit arithmetic. (print_summary): if the std dev calculation overflows, retry with smaller scale factor, until 0 is reached.
Diffstat (limited to 'ace/Stats.h')
-rw-r--r--ace/Stats.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/ace/Stats.h b/ace/Stats.h
index df4ae1eedbb..7a7214f993b 100644
--- a/ace/Stats.h
+++ b/ace/Stats.h
@@ -68,6 +68,9 @@ public:
// value up by <precision> decimal digits, so that no precision will
// be lost. It assumes that <whole_> is >= 0.
+ void dump (void) const;
+ // Print to stdout.
+
private:
ACE_UINT32 whole_;
// The integer portion of the value.
@@ -112,7 +115,7 @@ public:
int sample (const ACE_INT32 value);
// Provide a new sample. Returns 0 on success, -1 if it fails due
- // to running out of memory.
+ // to running out of memory, or to rolling over of the sample count.
ACE_UINT32 samples (void) const;
// Access the number of samples provided so far.
@@ -139,15 +142,13 @@ public:
FILE * = stdout) const;
// Print summary statistics. If scale_factor is not 1, then the
// results are divided by it, i.e., each of the samples is scaled
- // down by it. Returns -1 if internal overflow had been reached.
- // If that happens, you might retry with a smaller precision.
+ // down by it. If internal overflow is reached with the specified
+ // scale factor, it successively tries to reduce it. Returns -1 if
+ // there is overflow even with a 0 scale factor.
void reset ();
// Initialize internal state.
- void dump (void) const;
- // Print summary statictics to stdout.
-
static void quotient (const ACE_UINT64 dividend,
const ACE_UINT32 divisor,
ACE_Stats_Value &quotient);
@@ -164,9 +165,13 @@ public:
// method. It's not fast, but it doesn't require floating point
// support.
+ void dump (void) const;
+ // Print summary statistics to stdout.
+
private:
u_int overflow_;
- // Internal indication of whether there has been overflow.
+ // Internal indication of whether there has been overflow. Contains
+ // the errno corresponding to the cause of overflow.
ACE_UINT32 number_of_samples_;
// Number of samples.
@@ -177,9 +182,6 @@ private:
ACE_INT32 max_;
// Maximum sample value.
- ACE_Stats_Value cached_mean_;
- // Cached mean value, because std_dev () needs to know the mean.
-
ACE_Unbounded_Queue <ACE_INT32> samples_;
// The samples.
};