Skip to content

Commit

Permalink
Merge pull request #86 from Luos-io/statistics
Browse files Browse the repository at this point in the history
Statistics
  • Loading branch information
Salem-Tho committed Nov 27, 2020
2 parents 996cac0 + 6a4acd6 commit ae06dd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions pyluos/containers/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self,
self._uuid = [0, 0, 0]
self._killed = False
self._last_update = time.time()
self._luos_statistics = [0, 0, 0, 0, 0]
self._luos_statistics = {}

def __repr__(self):
return ('<{self.type} '
Expand Down Expand Up @@ -103,15 +103,17 @@ def uuid(self):
def luos_statistics(self):
self._push_value('luos_statistics', "")
time.sleep(0.3)
max_table = [self._luos_statistics[0], self._luos_statistics[1], self._luos_statistics[2]]
max_table = [self._luos_statistics["msg_stack"], self._luos_statistics["luos_stack"]]
max_val = max(max_table)
s = self.alias + " statistics :"
s = s + "\n.luos allocated RAM occupation \t= " + repr(max_val)
s = s + "%\n\t.Allocator stack \t= " + repr(self._luos_statistics[0])
s = s + "%\n\t.Message stack \t\t= " + repr(self._luos_statistics[1])
s = s + "%\n\t.Luos stack \t\t= " + repr(self._luos_statistics[2])
s = s + "%\n.Dropped messages number \t= " + repr(self._luos_statistics[3])
s = s + "\n.Max luos loop delay \t\t= " + repr(self._luos_statistics[4]) + "ms"
s = s + "%\n\t.Message stack \t\t= " + repr(self._luos_statistics["msg_stack"])
s = s + "%\n\t.Luos stack \t\t= " + repr(self._luos_statistics["luos_stack"])
s = s + "%\n.Dropped messages number \t= " + repr(self._luos_statistics["msg_drop"])
s = s + "\n.Max luos loop delay \t\t= " + repr(self._luos_statistics["loop_ms"])
s = s + "ms\n.Msg fail ratio \t\t= " + repr(self._luos_statistics["fail_ratio"])
s = s + "%\n.Nak msg max number \t\t= " + repr(self._luos_statistics["nak_max"])
s = s + "\n.Collision msg max number \t= " + repr(self._luos_statistics["collision_max"])
print(s)

def rename(self, name):
Expand Down
2 changes: 1 addition & 1 deletion pyluos/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '1.2.4'
version = '1.3.0'

0 comments on commit ae06dd7

Please sign in to comment.