rcrowley/go-metrics — pull request #26 by albanpeignier (2013-11-06 18:51:27+00:00)
Title: Compute Histogram statistics from Sample values

As discussed by email, here is a PR to compute `Histogram` Max/Min/Mean/Sum/Variance/StdDev/Percentile from Sample values.

It uses a `Snapshot` struct which copies values. By this way, all statistics can be computed with the same values.

This PR doesn't change current `Histogram`#Max/Min/.. methods.

According to us, the `Histogram` statistics should be delegated to a Snapshot to be consistant with current Sample values (according its implementation, like a SlidingTimeWindowSample). For example, the Percentile(1) result should be the Max() result.

The current overall Histogram statistics (which depends on Clear() usage) could be provided in dedicated methods (or sub structure).