[Git][NTPsec/ntpsec][master] Deleted 1 commit: Don't bother to read lof files older than starttime, plus some nits.
Gary E. Miller
gitlab at mg.gitlab.com
Sat Aug 20 06:48:10 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.
Deleted commits:
d4f5fb18 by Gary E. Miller at 2016-08-19T23:47:06-07:00
Don't bother to read lof files older than starttime, plus some nits.
ntpviz now 10x faster than this moning for -p 1
- - - - -
1 changed file:
- pylib/statfiles.py
Changes:
=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -39,28 +39,37 @@ class NTPStats:
lines = []
try:
for logpart in glob.glob(os.path.join(statsdir, stem) + "*"):
+ # skip files older than starttime
+ if starttime > os.path.getmtime(logpart):
+ continue;
if logpart.endswith("gz"):
line = gzip.open(logpart).readlines()
else:
lines += open(logpart).readlines()
except IOError:
pass
- # Filter out blank lines (we don't know where these come from)
- lines = [line.strip(' \0\r\n\t') for line in lines]
+
+ lines1 = []
if stem == "cputemp":
# cputemp is already in UNIX time
- lines = [ line for line in lines if (line != None \
- and int(line.split()[0]) >= starttime and \
- int(line.split()[0]) <= endtime) ]
+ for line in lines:
+ line = line.strip(' \0\r\n\t')
+ if line != None:
+ split = line.split(None, 2)
+ if int(split[0]) >= starttime and \
+ int(split[0]) <= endtime:
+ lines1.append( line)
else:
# Morph first field into Unix time with fractional seconds
- lines = [ NTPStats.unixize(line,starttime, endtime) \
- for line in lines if line != None]
- lines = [ line for line in lines if line != None]
+ for line in lines:
+ line = line.strip(' \0\r\n\t')
+ line = NTPStats.unixize(line,starttime, endtime)
+ if line != None:
+ lines1.append( line)
# Sort by datestamp
- lines.sort(key=lambda line: line.split()[0])
- setattr(self, stem, lines)
+ lines1.sort(key=lambda line: line.split()[0])
+ setattr(self, stem, lines1)
def clip(self, start, end):
"Select a range of entries"
for stem in ("clockstats", "peerstats", "loopstats", "rawstats"):
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d4f5fb18a9056904360fbe6a61e61c2b3628cf05
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160820/38143d04/attachment.html>
More information about the vc
mailing list