read/write counter
This commit is contained in:
parent
31cf5ceb5a
commit
080b22646d
@ -253,13 +253,13 @@ class CmdInterpreter(cmd.Cmd):
|
|||||||
|
|
||||||
def do_stats(self, arg):
|
def do_stats(self, arg):
|
||||||
for i, r in enumerate(self.registers):
|
for i, r in enumerate(self.registers):
|
||||||
processCount = readCount + writeCount
|
processCount = r.readCount + r.writeCount
|
||||||
if processCount == 0:
|
if processCount == 0:
|
||||||
ratio = -1
|
ratio = -1
|
||||||
else:
|
else:
|
||||||
ratio = float(r.errorCount) / float(processCount)
|
ratio = float(r.errorCount) / float(processCount)
|
||||||
self.__println("#{0:2d}: {1:15s} ({2:2d}, {3:5d}), rc: {4:7d}, wc: {4:7d}, pc: {4:7d}, ec: {5:7d}, q: {6:1.4f}"
|
self.__println("#{0:2d}: {1:15s} ({2:2d}, {3:5d}), rc: {4:7d}, wc: {5:7d}, pc: {6:7d}, ec: {7:7d}, q: {8:1.4f}"
|
||||||
.format(i, r.label, r.unit, r.address, r.readCount, r.writeCount
|
.format(i, r.label, r.unit, r.address, r.readCount, r.writeCount,
|
||||||
processCount, r.errorCount, ratio))
|
processCount, r.errorCount, ratio))
|
||||||
|
|
||||||
def help_stats(self):
|
def help_stats(self):
|
||||||
|
@ -128,11 +128,11 @@ class CoilDatapoint(AbstractModbusDatapoint):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return ("{0}, {1}: unit: {2}, address: {3}, scanRate: {4}, "
|
return ("{0}, {1}: unit: {2}, address: {3}, scanRate: {4}, "
|
||||||
"enqueued: {5}, lastContact: {6}, errorCount: {7}, processCount: {8}, "
|
"enqueued: {5}, lastContact: {6}, errorCount: {7}, readCount: {8}, "
|
||||||
"publishTopic: {9}, subscribeTopic: {10}, feedbackTopic: {11}"
|
"writeCount: {9}, publishTopic: {10}, subscribeTopic: {11}, feedbackTopic: {12}"
|
||||||
.format(self.type, self.label, self.unit, self.address,
|
.format(self.type, self.label, self.unit, self.address,
|
||||||
self.scanRate, self.enqueued, self.lastContact,
|
self.scanRate, self.enqueued, self.lastContact,
|
||||||
self.errorCount, self.processCount,
|
self.errorCount, self.readCount, self.writeCount,
|
||||||
self.publishTopic, self.subscribeTopic, self.feedbackTopic))
|
self.publishTopic, self.subscribeTopic, self.feedbackTopic))
|
||||||
|
|
||||||
def onMessage(self, value):
|
def onMessage(self, value):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user