Add accessor for totals to histogram class

numSamples, sum, and avg can now be accessed in a clean way via the
:totals() method. This fixes a problem whereby the fields could be
accessed while they were in dirty state.