NAME

ACE_Stats - Provides simple statistical analysis.

SYNOPSIS

#include <ace/Stats.h>

class ACE_Stats { public: ACE_Stats (void); int sample (const ACE_INT32 value); ACE_UINT32 samples (void) const; ACE_INT32 min_value (void) const; ACE_INT32 max_value (void) const; void mean ( ACE_Stats_Value &mean, const ACE_UINT32 scale_factor = 1 ); int std_dev ( ACE_Stats_Value &std_dev, const ACE_UINT32 scale_factor = 1 ); int print_summary ( const u_int precision, const ACE_UINT32 scale_factor = 1, FILE * = stdout ) const; void reset (void); static void quotient ( const ACE_UINT64 dividend, const ACE_UINT32 divisor, ACE_Stats_Value &quotient ); static void quotient ( const ACE_Stats_Value &dividend, const ACE_UINT32 divisor, ACE_Stats_Value &quotient ); static void square_root ( const ACE_UINT64 n, ACE_Stats_Value &square_root ); void dump (void) const; private: u_int overflow_; ACE_UINT32 number_of_samples_; ACE_INT32 min_; ACE_INT32 max_; ACE_Unbounded_Queue <ACE_INT32> samples_; };

DESCRIPTION

Simple statistical analysis package. Prominent features are: 1) It does not use any floating point arithmetic. 2) It handles positive and/or negative sample values. The sample value type is ACE_INT32. 3) It uses 64 bit unsigned, but not 64 bit signed, quantities internally. 4) It checks for overflow of internal state. 5) It has no static variables of other than built-in types.

Example usage: ACE_Stats stats; for (u_int i = 0; i n; ++i) { const ACE_UINT32 sample = /* ... */; stats.sample (sample); } stats.print_summary (3);

PUBLIC MEMBERS

ACE_Stats (void);

int sample (const ACE_INT32 value);

ACE_UINT32 samples (void) const;

ACE_INT32 min_value (void) const;

ACE_INT32 max_value (void) const;

void mean (ACE_Stats_Value &mean, const ACE_UINT32 scale_factor = 1);

int std_dev (
    ACE_Stats_Value &std_dev,
    const ACE_UINT32 scale_factor = 1
    );

int print_summary (
    const u_int precision,
    const ACE_UINT32 scale_factor = 1,
    FILE * = stdout
    ) const;

void reset (void);

static void quotient (
    const ACE_UINT64 dividend,
    const ACE_UINT32 divisor,
    ACE_Stats_Value &quotient
    );

static void quotient (
    const ACE_Stats_Value &dividend,
    const ACE_UINT32 divisor,
    ACE_Stats_Value &quotient
    );

static void square_root (
    const ACE_UINT64 n,
    ACE_Stats_Value &square_root
    );

void dump (void) const;

PRIVATE MEMBERS

u_int overflow_;

ACE_UINT32 number_of_samples_;

ACE_INT32 min_;

ACE_INT32 max_;

ACE_Unbounded_Queue <ACE_INT32> samples_;

AUTHORS

David L. Levine

LIBRARY

ace