mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-08 15:54:09 +00:00
littles changes
This commit is contained in:
parent
c2a09ad7c3
commit
3c2aa557fe
2 changed files with 16 additions and 4 deletions
|
|
@ -34,7 +34,11 @@ class Packet:
|
||||||
self._packet = {"timestamp": time.time()}
|
self._packet = {"timestamp": time.time()}
|
||||||
else:
|
else:
|
||||||
logging.debug("create bwPacket from string")
|
logging.debug("create bwPacket from string")
|
||||||
self._packet = eval(bwPacket)
|
try:
|
||||||
|
self._packet = eval(bwPacket.strip())
|
||||||
|
except:
|
||||||
|
# todo can we repair teh packet anyway?
|
||||||
|
logging.exception("error while create packet from string")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""!Return the intern _packet dict as string"""
|
"""!Return the intern _packet dict as string"""
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class Plugin:
|
||||||
|
|
||||||
# for time counting
|
# for time counting
|
||||||
self._sumTime = 0
|
self._sumTime = 0
|
||||||
|
self._cumTime = 0
|
||||||
self._setupTime = 0
|
self._setupTime = 0
|
||||||
self._alarmTime = 0
|
self._alarmTime = 0
|
||||||
self._teardownTime = 0
|
self._teardownTime = 0
|
||||||
|
|
@ -109,6 +110,7 @@ class Plugin:
|
||||||
|
|
||||||
self._teardownTime = time.time() - self._tmpTime
|
self._teardownTime = time.time() - self._tmpTime
|
||||||
self._sumTime = self._setupTime + self._alarmTime + self._teardownTime
|
self._sumTime = self._setupTime + self._alarmTime + self._teardownTime
|
||||||
|
self._cumTime += self._sumTime
|
||||||
|
|
||||||
self._endTime = time.time()
|
self._endTime = time.time()
|
||||||
logging.debug("[%s] took %0.3f seconds", self._pluginName, self._sumTime)
|
logging.debug("[%s] took %0.3f seconds", self._pluginName, self._sumTime)
|
||||||
|
|
@ -120,9 +122,15 @@ class Plugin:
|
||||||
"""!Returns statistical information's from last plugin run
|
"""!Returns statistical information's from last plugin run
|
||||||
|
|
||||||
@return Statistics as pyton dict"""
|
@return Statistics as pyton dict"""
|
||||||
stats = {"runCount": self._runCount, "sumTime": self._sumTime, "cumTime": self._runCount * self._sumTime,
|
stats = {"runCount": self._runCount,
|
||||||
"setupTime": self._setupTime, "alarmTime": self._alarmTime, "teardownTime": self._teardownTime,
|
"sumTime": self._sumTime,
|
||||||
"setupErrorCount": self._setupErrorCount, "alarmErrorCount": self._alarmErrorCount, "teardownErrorCount": self._teardownErrorCount}
|
"cumTime": self._cumTime,
|
||||||
|
"setupTime": self._setupTime,
|
||||||
|
"alarmTime": self._alarmTime,
|
||||||
|
"teardownTime": self._teardownTime,
|
||||||
|
"setupErrorCount": self._setupErrorCount,
|
||||||
|
"alarmErrorCount": self._alarmErrorCount,
|
||||||
|
"teardownErrorCount": self._teardownErrorCount}
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
def onLoad(self):
|
def onLoad(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue