Downsampled aggregated values for more realistic values.

Downsampled aggregated values for more realistic values.
Used regularly-spaced timestamps (using downsampling) to feed aggregation.
- The default regular interval is ten seconds and configurable.
- Used the same function for downsamplings before and after aggregation.
- Fixing to regular timestamps is skipped unless downsampling is requested.
- Used the downsampling size specified at query if it is smaller than the regular interval.