[Git][NTPsec/ntpsec][master] Deleted 1 commit: Call NTPStats.stampfields once per log line, not twice.

Gary E. Miller gitlab at mg.gitlab.com
Fri Aug 19 22:49:46 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:
09024fde by Gary E. Miller at 2016-08-19T15:48:49-07:00
Call NTPStats.stampfields once per log line, not twice.

When you got 2M lines of logs, 2x adds up.

- - - - -


1 changed file:

- pylib/statfiles.py


Changes:

=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -49,11 +49,11 @@ class NTPStats:
             # Filter out blank lines (we don't know where these come from)
             lines = [line.strip(' \0\r\n\t')  \
                      for line in lines if line.strip(' \0\r\n\t')]
-            # Sort by date
-            lines.sort(key=NTPStats.stampfields)
-            # Morph first field into Unix time with fractional seconds 
             if stem != "cputemp":
+                # Morph first field into Unix time with fractional seconds
                 lines = [NTPStats.unixize(line) for line in lines]
+            # Sort by datestamp
+            lines.sort(key=lambda line: line[0])
             setattr(self, stem, lines)
     def clip(self, start, end):
         "Select a range of entries"
@@ -112,7 +112,7 @@ class NTPStats:
             # driver type here.
             if key.startswith("127.127."):
                 (_, _, t, u) = key.split(".")
-                return "REFCLOCK(ttype=%s,unit=%s)" % (t, u) 
+                return "REFCLOCK(ttype=%s,unit=%s)" % (t, u)
             # Ordinary IP address - replace with primary hostname.
             # Punt if the lookup fails.
             try:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/09024fde4418ef61012ed85ed78dea3882582bb1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160819/3c3a795a/attachment.html>


More information about the vc mailing list