archiver-appliance / epicsarchiverap

This is an implementation of an archiver for EPICS control systems that aims to archive millions of PVs.
Other
38 stars 37 forks source link

CSSTUDIO-2134 Two bugfixes to `SummaryStatsPostProcessor` and one bugfix and one improvement to `Optimized`. #200

Closed abrahamwolk closed 5 months ago

abrahamwolk commented 5 months ago

This PR implements two bug-fixes to SummaryStatsPostProcessor and one bug-fix and one improvement to Optimized.

The two bug-fixes added to SummaryStatsPostProcessor are: 1.A Check the time stamps instead of the bin number when deciding whether a data point should be put in a bin. 1.B Ensure that the last sample before the start of the interval is added, unless the start of the interval coincides with a data-point. (Previously, the last sample would only be added if there existed a data point in the specified interval, but the specified interval may of course be empty.)

The improvements to Optimized are: 2.A intervalSecs is now bounded below by 1. (Previously, it could assume the value 0.) 2.B In the computation of intervalSecs, the cast long -> int is now checked for overflow.

Some test cases have been implemented in OptimizedPostProcessorTest.

Question: I am not sure about point 1.A: is it correct to only include data points that are strictly within the specified interval? E.g.: Suppose the specified interval is [0.5, 1.0] but that the first bin covers the interval [0.0, 1.0]. Should then data-points with, e.g., t=0.4 be added to the first bin? I believe, but I am not sure, that they should not, and that is what the PR implements.