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

L2SS-244: Expose last received packet literally

parent cec7ab37
No related branches found
No related tags found
1 merge request!56L2SS-244: Expose the SSTs in MPs
......@@ -50,6 +50,7 @@ class Statistics(hardware_device):
# SST client annotation consists of a dict that contains the parameter name that needs to be read.
# Example: comms_annotation={"parameter": "this_value_R"}
nof_packets_R = attribute_wrapper(comms_annotation={"parameter": "nof_packets"}, datatype=numpy.uint64)
last_packet_R = attribute_wrapper(comms_annotation={"parameter": "last_packet"}, dims=(9000,), datatype=numpy.uint8)
last_packet_timestamp_R = attribute_wrapper(comms_annotation={"parameter": "last_packet_timestamp"}, datatype=numpy.uint64)
queue_fill_percentage_R = attribute_wrapper(comms_annotation={"parameter": "queue_fill_percentage"}, datatype=numpy.float32)
......
......@@ -159,6 +159,7 @@ class SST_collector(Thread):
self.parameters = {
"nof_packets": numpy.uint64(0),
"last_packet": numpy.zeroes((9000,), dtype=numpy.uint8),
"last_packet_timestamp": numpy.uint64(0),
"queue_fill_percentage": numpy.float32(100 * self.queue.qsize() / self.queue.maxsize if self.queue.maxsize else 0),
......@@ -199,6 +200,7 @@ class SST_collector(Thread):
def process_packet(self, packet):
self.parameters["nof_packets"] += numpy.uint64(1)
self.parameters["last_packet"][:len(packet)] = numpy.frombuffer(packet, dtype=numpy.uint8)
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment