diff --git a/cts/scheduler/594.xml b/cts/scheduler/594.xml
index e25af9a109..a7a4f367f4 100644
--- a/cts/scheduler/594.xml
+++ b/cts/scheduler/594.xml
@@ -1,182 +1,180 @@
-
-
diff --git a/cts/scheduler/662.xml b/cts/scheduler/662.xml
index 78cf89f2fb..d82feaeb73 100644
--- a/cts/scheduler/662.xml
+++ b/cts/scheduler/662.xml
@@ -1,209 +1,207 @@
-
-
diff --git a/cts/scheduler/696.xml b/cts/scheduler/696.xml
index 4e82be17d9..7a9064a156 100644
--- a/cts/scheduler/696.xml
+++ b/cts/scheduler/696.xml
@@ -1,158 +1,156 @@
-
-
diff --git a/cts/scheduler/726.xml b/cts/scheduler/726.xml
index c63d6ee25b..2c8ecbc920 100644
--- a/cts/scheduler/726.xml
+++ b/cts/scheduler/726.xml
@@ -1,188 +1,186 @@
-
-
diff --git a/cts/scheduler/735.xml b/cts/scheduler/735.xml
index 4141ca8c22..0eb450a6eb 100644
--- a/cts/scheduler/735.xml
+++ b/cts/scheduler/735.xml
@@ -1,200 +1,198 @@
-
-
diff --git a/cts/scheduler/764.xml b/cts/scheduler/764.xml
index ccb4d6705c..b41eefed5c 100644
--- a/cts/scheduler/764.xml
+++ b/cts/scheduler/764.xml
@@ -1,238 +1,236 @@
-
-
diff --git a/cts/scheduler/797.xml b/cts/scheduler/797.xml
index 18de6753a7..edb30a79fa 100644
--- a/cts/scheduler/797.xml
+++ b/cts/scheduler/797.xml
@@ -1,259 +1,257 @@
-
-
diff --git a/cts/scheduler/829.xml b/cts/scheduler/829.xml
index 25cc3c98dc..bee15da8ae 100644
--- a/cts/scheduler/829.xml
+++ b/cts/scheduler/829.xml
@@ -1,230 +1,228 @@
-
-
diff --git a/cts/scheduler/attrs1.xml b/cts/scheduler/attrs1.xml
index 7276bda258..73cfd474b0 100644
--- a/cts/scheduler/attrs1.xml
+++ b/cts/scheduler/attrs1.xml
@@ -1,32 +1,31 @@
-
diff --git a/cts/scheduler/attrs2.xml b/cts/scheduler/attrs2.xml
index a26e7e94a9..4bea89717c 100644
--- a/cts/scheduler/attrs2.xml
+++ b/cts/scheduler/attrs2.xml
@@ -1,32 +1,31 @@
-
diff --git a/cts/scheduler/attrs4.xml b/cts/scheduler/attrs4.xml
index 12a2955f3e..83051afb97 100644
--- a/cts/scheduler/attrs4.xml
+++ b/cts/scheduler/attrs4.xml
@@ -1,31 +1,30 @@
-
diff --git a/cts/scheduler/attrs6.xml b/cts/scheduler/attrs6.xml
index 2924643ed3..eee17d20eb 100644
--- a/cts/scheduler/attrs6.xml
+++ b/cts/scheduler/attrs6.xml
@@ -1,31 +1,30 @@
-
diff --git a/cts/scheduler/attrs7.xml b/cts/scheduler/attrs7.xml
index 41ae6ae690..6f3b8608b5 100644
--- a/cts/scheduler/attrs7.xml
+++ b/cts/scheduler/attrs7.xml
@@ -1,31 +1,30 @@
-
diff --git a/cts/scheduler/date-1.xml b/cts/scheduler/date-1.xml
index 93c56770f0..71653afe15 100644
--- a/cts/scheduler/date-1.xml
+++ b/cts/scheduler/date-1.xml
@@ -1,61 +1,60 @@
-
diff --git a/cts/scheduler/group10.xml b/cts/scheduler/group10.xml
index a5ff50c77e..033cdf1e6a 100644
--- a/cts/scheduler/group10.xml
+++ b/cts/scheduler/group10.xml
@@ -1,340 +1,338 @@
-
-
diff --git a/cts/scheduler/group4.xml b/cts/scheduler/group4.xml
index b2968da6ab..04411b9658 100644
--- a/cts/scheduler/group4.xml
+++ b/cts/scheduler/group4.xml
@@ -1,70 +1,69 @@
-
diff --git a/cts/scheduler/interleave-0.xml b/cts/scheduler/interleave-0.xml
index 8e3ff2423e..df28cfa25c 100644
--- a/cts/scheduler/interleave-0.xml
+++ b/cts/scheduler/interleave-0.xml
@@ -1,538 +1,536 @@
-
-
diff --git a/cts/scheduler/interleave-1.xml b/cts/scheduler/interleave-1.xml
index 48022f3dcd..b854148218 100644
--- a/cts/scheduler/interleave-1.xml
+++ b/cts/scheduler/interleave-1.xml
@@ -1,539 +1,537 @@
-
-
diff --git a/cts/scheduler/interleave-2.xml b/cts/scheduler/interleave-2.xml
index 8ff31d7382..f73d7c0bb4 100644
--- a/cts/scheduler/interleave-2.xml
+++ b/cts/scheduler/interleave-2.xml
@@ -1,541 +1,539 @@
-
-
diff --git a/cts/scheduler/interleave-3.xml b/cts/scheduler/interleave-3.xml
index 3bc401dc42..796fce60b5 100644
--- a/cts/scheduler/interleave-3.xml
+++ b/cts/scheduler/interleave-3.xml
@@ -1,541 +1,539 @@
-
-
diff --git a/cts/scheduler/managed-0.xml b/cts/scheduler/managed-0.xml
index d8729376c2..ce723ce404 100644
--- a/cts/scheduler/managed-0.xml
+++ b/cts/scheduler/managed-0.xml
@@ -1,526 +1,524 @@
-
-
diff --git a/cts/scheduler/managed-1.xml b/cts/scheduler/managed-1.xml
index e4d831f6dc..adfa90d853 100644
--- a/cts/scheduler/managed-1.xml
+++ b/cts/scheduler/managed-1.xml
@@ -1,527 +1,525 @@
-
-
diff --git a/cts/scheduler/managed-2.xml b/cts/scheduler/managed-2.xml
index b7237aa9a1..af12dfc31b 100644
--- a/cts/scheduler/managed-2.xml
+++ b/cts/scheduler/managed-2.xml
@@ -1,369 +1,367 @@
-
-
diff --git a/cts/scheduler/master-4.xml b/cts/scheduler/master-4.xml
index 46ffc03bd5..d05086e695 100644
--- a/cts/scheduler/master-4.xml
+++ b/cts/scheduler/master-4.xml
@@ -1,407 +1,406 @@
-
diff --git a/cts/scheduler/master-5.xml b/cts/scheduler/master-5.xml
index dd452c13ae..12ab43f500 100644
--- a/cts/scheduler/master-5.xml
+++ b/cts/scheduler/master-5.xml
@@ -1,408 +1,407 @@
-
diff --git a/cts/scheduler/master-6.xml b/cts/scheduler/master-6.xml
index 0a2a77fc82..d14f42ac55 100644
--- a/cts/scheduler/master-6.xml
+++ b/cts/scheduler/master-6.xml
@@ -1,439 +1,438 @@
-
diff --git a/cts/scheduler/master-7.xml b/cts/scheduler/master-7.xml
index c3ffb3635c..46319ba32e 100644
--- a/cts/scheduler/master-7.xml
+++ b/cts/scheduler/master-7.xml
@@ -1,462 +1,461 @@
-
diff --git a/cts/scheduler/master-8.xml b/cts/scheduler/master-8.xml
index 6b51127373..7a488fc53e 100644
--- a/cts/scheduler/master-8.xml
+++ b/cts/scheduler/master-8.xml
@@ -1,454 +1,453 @@
-
diff --git a/cts/scheduler/master-9.xml b/cts/scheduler/master-9.xml
index 61668acd82..6f80d566ba 100644
--- a/cts/scheduler/master-9.xml
+++ b/cts/scheduler/master-9.xml
@@ -1,301 +1,300 @@
-
diff --git a/cts/scheduler/order-mandatory.xml b/cts/scheduler/order-mandatory.xml
index 0de3a7f8f1..29a885b190 100644
--- a/cts/scheduler/order-mandatory.xml
+++ b/cts/scheduler/order-mandatory.xml
@@ -1,56 +1,55 @@
-
diff --git a/cts/scheduler/order-optional-keyword.xml b/cts/scheduler/order-optional-keyword.xml
index 9260c61ed4..441b274fc3 100644
--- a/cts/scheduler/order-optional-keyword.xml
+++ b/cts/scheduler/order-optional-keyword.xml
@@ -1,56 +1,55 @@
-
diff --git a/cts/scheduler/order-optional.xml b/cts/scheduler/order-optional.xml
index 9260c61ed4..441b274fc3 100644
--- a/cts/scheduler/order-optional.xml
+++ b/cts/scheduler/order-optional.xml
@@ -1,56 +1,55 @@
-
diff --git a/cts/scheduler/order-required.xml b/cts/scheduler/order-required.xml
index c9ef364e15..02ab04ec9c 100644
--- a/cts/scheduler/order-required.xml
+++ b/cts/scheduler/order-required.xml
@@ -1,56 +1,55 @@
-
diff --git a/cts/scheduler/order-wrong-kind.xml b/cts/scheduler/order-wrong-kind.xml
index f889b45c61..ae8e920da4 100644
--- a/cts/scheduler/order-wrong-kind.xml
+++ b/cts/scheduler/order-wrong-kind.xml
@@ -1,63 +1,62 @@
-
diff --git a/cts/scheduler/order3.xml b/cts/scheduler/order3.xml
index 8ccf8e61d1..4126f46794 100644
--- a/cts/scheduler/order3.xml
+++ b/cts/scheduler/order3.xml
@@ -1,69 +1,68 @@
-
diff --git a/cts/scheduler/orphan-0.xml b/cts/scheduler/orphan-0.xml
index 9595cef3a3..f7d55189ae 100644
--- a/cts/scheduler/orphan-0.xml
+++ b/cts/scheduler/orphan-0.xml
@@ -1,135 +1,133 @@
-
-
diff --git a/cts/scheduler/orphan-1.xml b/cts/scheduler/orphan-1.xml
index 183b3c8ab7..b63ae29d8b 100644
--- a/cts/scheduler/orphan-1.xml
+++ b/cts/scheduler/orphan-1.xml
@@ -1,135 +1,133 @@
-
-
diff --git a/cts/scheduler/orphan-2.xml b/cts/scheduler/orphan-2.xml
index df17badda2..c20fe1b0c7 100644
--- a/cts/scheduler/orphan-2.xml
+++ b/cts/scheduler/orphan-2.xml
@@ -1,145 +1,143 @@
-
-
diff --git a/cts/scheduler/params-0.xml b/cts/scheduler/params-0.xml
index 66f3ce9add..b19ab60d41 100644
--- a/cts/scheduler/params-0.xml
+++ b/cts/scheduler/params-0.xml
@@ -1,151 +1,149 @@
-
-
diff --git a/cts/scheduler/params-1.xml b/cts/scheduler/params-1.xml
index 05d397a6c8..a9c3ad1fc5 100644
--- a/cts/scheduler/params-1.xml
+++ b/cts/scheduler/params-1.xml
@@ -1,155 +1,153 @@
-
-
diff --git a/cts/scheduler/params-3.xml b/cts/scheduler/params-3.xml
index ee6e157fb2..aa38e9c2a7 100644
--- a/cts/scheduler/params-3.xml
+++ b/cts/scheduler/params-3.xml
@@ -1,154 +1,152 @@
-
-
diff --git a/cts/scheduler/params-4.xml b/cts/scheduler/params-4.xml
index 09804b0e43..12e176848a 100644
--- a/cts/scheduler/params-4.xml
+++ b/cts/scheduler/params-4.xml
@@ -1,155 +1,153 @@
-
-
diff --git a/cts/scheduler/params-5.xml b/cts/scheduler/params-5.xml
index 842d9c8013..156bd17fb0 100644
--- a/cts/scheduler/params-5.xml
+++ b/cts/scheduler/params-5.xml
@@ -1,151 +1,149 @@
-
-
diff --git a/cts/scheduler/quorum-4.xml b/cts/scheduler/quorum-4.xml
index 5c5f722cb8..905500bc66 100644
--- a/cts/scheduler/quorum-4.xml
+++ b/cts/scheduler/quorum-4.xml
@@ -1,36 +1,34 @@
-
-
diff --git a/cts/scheduler/quorum-5.xml b/cts/scheduler/quorum-5.xml
index 07acd57969..161178c50b 100644
--- a/cts/scheduler/quorum-5.xml
+++ b/cts/scheduler/quorum-5.xml
@@ -1,51 +1,49 @@
-
-
diff --git a/cts/scheduler/quorum-6.xml b/cts/scheduler/quorum-6.xml
index 157f1cc15d..7ca52c0042 100644
--- a/cts/scheduler/quorum-6.xml
+++ b/cts/scheduler/quorum-6.xml
@@ -1,43 +1,41 @@
-
-
diff --git a/cts/scheduler/rec-node-12.xml b/cts/scheduler/rec-node-12.xml
index 066d964484..a1880612d4 100644
--- a/cts/scheduler/rec-node-12.xml
+++ b/cts/scheduler/rec-node-12.xml
@@ -1,127 +1,125 @@
-
-
diff --git a/cts/scheduler/rec-node-15.xml b/cts/scheduler/rec-node-15.xml
index 987023c37d..84efe49a6a 100644
--- a/cts/scheduler/rec-node-15.xml
+++ b/cts/scheduler/rec-node-15.xml
@@ -1,256 +1,255 @@
-
diff --git a/cts/scheduler/simple11.xml b/cts/scheduler/simple11.xml
index 6e69cc10ec..7551866e68 100644
--- a/cts/scheduler/simple11.xml
+++ b/cts/scheduler/simple11.xml
@@ -1,48 +1,47 @@
-
diff --git a/cts/scheduler/simple12.xml b/cts/scheduler/simple12.xml
index 33fdda4a5d..861dd66dec 100644
--- a/cts/scheduler/simple12.xml
+++ b/cts/scheduler/simple12.xml
@@ -1,40 +1,39 @@
-
diff --git a/cts/scheduler/standby.xml b/cts/scheduler/standby.xml
index 5abad36085..3c4198e7eb 100644
--- a/cts/scheduler/standby.xml
+++ b/cts/scheduler/standby.xml
@@ -1,309 +1,308 @@
-
diff --git a/cts/scheduler/target-0.xml b/cts/scheduler/target-0.xml
index 51aa23ba5a..80c056f675 100644
--- a/cts/scheduler/target-0.xml
+++ b/cts/scheduler/target-0.xml
@@ -1,171 +1,169 @@
-
-
diff --git a/cts/scheduler/target-1.xml b/cts/scheduler/target-1.xml
index 1d87282f6b..bac9360e00 100644
--- a/cts/scheduler/target-1.xml
+++ b/cts/scheduler/target-1.xml
@@ -1,195 +1,193 @@
-
-
diff --git a/cts/scheduler/target-2.xml b/cts/scheduler/target-2.xml
index 3f044d54be..6d567d9060 100644
--- a/cts/scheduler/target-2.xml
+++ b/cts/scheduler/target-2.xml
@@ -1,179 +1,177 @@
-
-
diff --git a/cts/scheduler/unrunnable-1.xml b/cts/scheduler/unrunnable-1.xml
index 6a0dde973d..e9a37cd558 100644
--- a/cts/scheduler/unrunnable-1.xml
+++ b/cts/scheduler/unrunnable-1.xml
@@ -1,212 +1,209 @@
-
-
-
diff --git a/tools/pcmk_simtimes.in b/tools/pcmk_simtimes.in
index 6e362243b2..0a9f71405f 100644
--- a/tools/pcmk_simtimes.in
+++ b/tools/pcmk_simtimes.in
@@ -1,101 +1,151 @@
#!@PYTHON@
""" Timing comparisons for crm_simulate profiling output
"""
# Pacemaker targets compatibility with Python 2.7 and 3.2+
from __future__ import print_function, unicode_literals, absolute_import, division
__copyright__ = "Copyright 2019 the Pacemaker project contributors"
__license__ = "GNU General Public License version 2 or later (GPLv2+) WITHOUT ANY WARRANTY"
import io
import re
import sys
import errno
import argparse
DESC = """Compare timings from crm_simulate profiling output"""
# These values must be kept in sync with include/crm/crm.h
class CrmExit(object):
OK = 0
BEFORE_HELP = """Output of "crm_simulate --profile cts/scheduler --repeat " from earlier Pacemaker build"""
# line like: * Testing cts/scheduler/1360.xml ... 0.07 secs
PATTERN = r"""^\s*\*\s+Testing\s+.*/([^/]+)\.xml\s+\.+\s+([.0-9]+)\s+secs\s*$"""
def parse_args(argv=sys.argv):
""" Parse command-line arguments """
parser = argparse.ArgumentParser(description=DESC)
parser.add_argument('-V', '--verbose', action='count',
help='Increase verbosity')
parser.add_argument('-p', '--threshold-percent', type=float, default=0,
help="Don't show tests with less than this percentage difference in times")
parser.add_argument('-s', '--threshold-seconds', type=float, default=0,
help="Don't show tests with less than this seconds difference in times")
+ parser.add_argument('-S', '--sort', choices=['test', 'before', 'after', 'diff', 'percent'],
+ default='test', help="Sort results by this column")
+
+ parser.add_argument('-r', '--reverse', action='store_true',
+ help="Sort results in descending order")
+
parser.add_argument('before_file', metavar='BEFORE',
type=argparse.FileType('r'),
help=BEFORE_HELP)
parser.add_argument('after_file', metavar='AFTER',
type=argparse.FileType('r'),
help='Output of same command from later Pacemaker build')
return parser.parse_args(argv[1:])
def extract_times(infile):
""" Extract test names and times into hash table from file """
result = {}
for line in infile:
match = re.search(PATTERN, line)
if match is not None:
result[match.group(1)] = match.group(2)
return result
def compare_test(test, before, after, args):
""" Compare one test's timings """
try:
before_time = float(before[test])
except KeyError:
if args.verbose > 0:
print("No previous test " + test + " to compare")
- return
+ return None
after_time = float(after[test])
time_diff = after_time - before_time
time_diff_percent = (time_diff / before_time) * 100
if ((abs(time_diff) >= args.threshold_seconds)
and (abs(time_diff_percent) >= args.threshold_percent)):
- print("%-40s %.2fs vs %.2fs (%+.2fs = %+6.2f%%)" % (test, before_time,
- after_time, time_diff, time_diff_percent))
+ return { 'test': test,
+ 'before': before_time,
+ 'after': after_time,
+ 'diff': time_diff,
+ 'percent': time_diff_percent
+ }
+ return None
+
+def sort_diff(result):
+ """ Sort two test results by time difference """
+
+ global sort_field
+
+ return result[sort_field]
+
+
+def print_results(results, sort_reverse):
+ """ Output the comparison results """
+
+ if results == []:
+ return
+
+ # Sort and print test differences
+ results.sort(reverse=sort_reverse, key=sort_diff)
+ for result in results:
+ print("%-40s %6.2fs vs %6.2fs (%+.2fs = %+6.2f%%)" % (result['test'],
+ result['before'], result['after'], result['diff'],
+ result['percent']))
+
+ # Print average differences
+ diff_total = sum(d['diff'] for d in results)
+ percent_total = sum(d['percent'] for d in results)
+ nresults = len(results)
+ print("\nAverages: %+.2fs %+6.2f%%" % ((diff_total / nresults),
+ (percent_total / nresults)))
if __name__ == "__main__":
+ global sort_field
+
try:
args = parse_args()
before = extract_times(args.before_file)
after = extract_times(args.after_file)
+ sort_field = args.sort
+
+ # Build a list of test differences
+ results = []
for test in after.keys():
- compare_test(test, before, after, args)
+ result = compare_test(test, before, after, args)
+ if result is not None:
+ results = results + [ result ]
+
+ print_results(results, sort_reverse=args.reverse)
+
except KeyboardInterrupt:
pass
except IOError as e:
if e.errno != errno.EPIPE:
raise
sys.exit(CrmExit.OK)
# vim: set filetype=python expandtab tabstop=4 softtabstop=4 shiftwidth=4 textwidth=120: