def normalise_data(self, timestamp, data):
""" Convert the data if needed """
if self._passthrough:
return
i = 0
for datum in data:
if self.needsfixup[i] is None:
i += 1
continue
if len(datum) == 0:
# Ignore entries with no data - this typically occurs when the
# plugin requests multiple metrics and the metrics do not all appear
# at every timestep
i += 1
continue
if self.accumulator[i] is None:
self.accumulator[i] = numpy.array(datum)
self.last[i] = numpy.array(datum)
else:
self.accumulator[i] += (datum - self.last[i]) % numpy.uint64(1L << self.needsfixup[i]['range'])
numpy.copyto(self.last[i], datum)
numpy.copyto(datum, self.accumulator[i])
i += 1
评论列表
文章目录