/* stax.h (C) 1997 Mark A. Livingston */ /* Any non-commercial use of this code is permitted so long as */ /* the above copyright line appears in the file. Please contact */ /* the author regarding permission for commercial use. */ #ifndef SQR #define SQR(a) ( (a) * (a) ) #endif enum { AVG = 0, MIN, MAX, STD, NSTATS }; typedef struct { double s[ NSTATS ]; int n; } Stat; #define H_MIN 0 /* slot for below least significant cell of histogram */ #define H_MAX 1 /* slot for above most significant cell of histogram */ #define H_BASE 2 /* first slot for within the range of histogram */ typedef struct { int *slot, numSlots; double min, max, width; } Hist; /* Functions for running average, std dev, min and max */ void stxInit( int n ); void stxUpdate( int i, double v ); void stxPrint( int i, char *hdr, char *name ); void stxClear( int i ); /* resets, for per frame stats */ /* Functions for histograms */ void stxHistInit( int n, double *mins, double *maxs, double *widths ); void stxHistUpdate( int i, double v ); void stxHistPrint( int i );