Commit 63158211 authored by Rich Prohaska's avatar Rich Prohaska

refs #6633 support float engine status values

parent 876a1ea9
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
import time import time
...@@ -12,23 +12,34 @@ def usage(): ...@@ -12,23 +12,34 @@ def usage():
print "[--sleeptime=SLEEPTIME] (default: 10 seconds)" print "[--sleeptime=SLEEPTIME] (default: 10 seconds)"
return 1 return 1
def convert(v):
if type(v) == type('str'):
try:
v = int(v)
except:
v = float(v)
return v
def printit(stats, rs, sleeptime): def printit(stats, rs, sleeptime):
# print rs # print rs
for t in rs: for t in rs:
l = len(t) # grab the last 2 fields in t l = len(t) # grab the last 2 fields in t
k = t[l-2] k = t[l-2]
v = t[l-1] v = t[l-1]
# print k, v # print k, v # debug
# try to convert v
try:
v = convert(v)
except:
pass
if stats.has_key(k): if stats.has_key(k):
oldv = stats[k] oldv = stats[k]
if v != oldv: if v != oldv:
print k, "|", oldv, "|", v, print k, "|", oldv, "|", v,
try: try:
vi = int(v) d = v - oldv
oldvi = int(oldv) if d == 0:
d = vi - oldvi d = float(v - oldv)
if d <= 0 or d < sleeptime:
raise "invalid"
print "|", d, "|", d / sleeptime print "|", d, "|", d / sleeptime
except: except:
print print
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment