Skip to content
Snippets Groups Projects
Commit aeee7d90 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-244: Make sure counters stay of type uint64

parent 938a4494
No related branches found
No related tags found
1 merge request!56L2SS-244: Expose the SSTs in MPs
...@@ -202,7 +202,7 @@ class SST_collector(Thread): ...@@ -202,7 +202,7 @@ class SST_collector(Thread):
super().join(timeout) super().join(timeout)
def process_packet(self, packet): def process_packet(self, packet):
self.parameters["nof_packets"] += 1 self.parameters["nof_packets"] += numpy.uint64(1)
self.parameters["last_packet_timestamp"] = numpy.uint64(int(time.time())) self.parameters["last_packet_timestamp"] = numpy.uint64(int(time.time()))
self.parameters["queue_fill_percentage"] = numpy.double(100 * self.queue.qsize() / self.queue.maxsize if self.queue.maxsize else 0) self.parameters["queue_fill_percentage"] = numpy.double(100 * self.queue.qsize() / self.queue.maxsize if self.queue.maxsize else 0)
...@@ -210,28 +210,28 @@ class SST_collector(Thread): ...@@ -210,28 +210,28 @@ class SST_collector(Thread):
fields = StatisticsPacket(packet) fields = StatisticsPacket(packet)
except ValueError: except ValueError:
# could not parse header # could not parse header
self.parameters["nof_invalid_packets"] += 1 self.parameters["nof_invalid_packets"] += numpy.uint64(1)
return return
if fields.marker != 'S': if fields.marker != 'S':
# packet is not SST # packet is not SST
self.parameters["nof_invalid_packets"] += 1 self.parameters["nof_invalid_packets"] += numpy.uint64(1)
return return
input_index = fields.sst_signal_input_index input_index = fields.sst_signal_input_index
if input_index >= self.MAX_INPUTS: if input_index >= self.MAX_INPUTS:
# packet describes an input that is out of bounds for us # packet describes an input that is out of bounds for us
self.parameters["nof_invalid_packets"] += 1 self.parameters["nof_invalid_packets"] += numpy.uint64(1)
return return
if fields.payload_error: if fields.payload_error:
# cannot trust the data if a payload error is reported # cannot trust the data if a payload error is reported
self.parameters["nof_payload_errors"][input_index] += 1 self.parameters["nof_payload_errors"][input_index] += numpy.uint64(1)
return return
# process the packet # process the packet
self.parameters["nof_valid_packets"][input_index] += 1 self.parameters["nof_valid_packets"][input_index] += numpy.uint64(1)
self.parameters["last_values"][input_index][:fields.nof_statistics_per_packet] = fields.payload_sst self.parameters["last_values"][input_index][:fields.nof_statistics_per_packet] = fields.payload_sst
self.parameters["last_timestamps"][input_index] = numpy.float64(fields.timestamp().timestamp()) self.parameters["last_timestamps"][input_index] = numpy.float64(fields.timestamp().timestamp())
self.parameters["integration_intervals"][input_index] = fields.integration_interval() self.parameters["integration_intervals"][input_index] = fields.integration_interval()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment