servod: add padding when trimming data

While trimming extra data outside of test time, for data points
that average over their corresponding sample intervals, a padding
is added to tstart and tend to ensure that only data points with
over half samples between tstart and tend are kept. No padding
is needed for data points that are instant data.

BUG=chromium:806146, b:111616837
TEST=python -m unittest -v timelined_stats_manager_unittest
test_that <dut ip> power_ServodWrapper \
--autotest_dir ~/trunk/src/third_party/autotest/files/ \
--args 'test=power_Dummy servo_host=localhost servo_port=9999 ina_rate=1 vbat_rate=2'

Change-Id: Ie1b895873bbbc8d5fe5b79416cb19d7c9767e11a
Signed-off-by: Mengqi Guo <mqg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1298536
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
3 files changed