commit c2d99ad9090a3d6d81af42f7a482f180e560a7df parent f9aa154b7db068c57897dc047ee29150cb5d018c Author: Michael Savage <mikejsavage@gmail.com> Date: Tue Jan 19 21:47:03 +0000 Comments Diffstat:
stats.cc | | | 2 | ++ |
diff --git a/stats.cc b/stats.cc @@ -23,6 +23,7 @@ void stats_record( Stats * stats, double x ) { stats->sum += x; stats->sum_of_squares += x * x; + // update min/max if( stats->num_records == 0 ) { stats->min = stats->max = x; } @@ -31,6 +32,7 @@ void stats_record( Stats * stats, double x ) { if( x > stats->max ) stats->max = x; } + // see if we should keep this sample if( stats->num_records < STATS_NUM_QUART_SAMPLES ) { stats->samples[ stats->num_records ] = x; }