diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-11-25 04:06:28 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-11-25 04:06:28 +0000 |
commit | af16cc4c4e61c6426a91b2379c19948fbe032582 (patch) | |
tree | ab8f0e34133a36086f2e0d7310dd15d86ddb8048 /ace/Stats.h | |
parent | c33adf90d9599a7fa62deb72206ea96d33d79c1d (diff) | |
download | ATCD-af16cc4c4e61c6426a91b2379c19948fbe032582.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.h | 22 |
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 "ient); @@ -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. }; |