Not sure if this is Math, Stats or Data Science, but I figured I would post it here to get the site used.As a programmer, when you have a system/component implemented, you might want to allow some performance monitoring. For example to query how often a function call was used, how long it took and so on. So typically you care about count, means/percentile, max/min and similiar statistics. This could be measurements since startup, but also a rolling average or window.I wonder if there is a good data structure which can be updated efficiently concurrently which can be used as the source for most of those queries. For example having a ringbuffer of rollup-metrics (count, sum, min, max) over increasing periods of time and a background aggregate process triggered regularly.The focus here (for me) is on in-memory data structures with limited memory consumption. (For other things I would use a RRD type of library).
Versatile data structure for combined statistics
dataset;statistics;algorithms
It sounds like you would like the Boost Accumulators library:Boost.Accumulators is both a library for incremental statistical  computation as well as an extensible framework for incremental  calculation in general. The library deals primarily with the concept  of an accumulator, which is a primitive computational entity that  accepts data one sample at a time and maintains some internal state.  These accumulators may offload some of their computations on other  accumulators, on which they depend. Accumulators are grouped within an  accumulator set. Boost.Accumulators resolves the inter-dependencies  between accumulators in a set and ensures that accumulators are  processed in the proper order.