mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
f980efeef1
Change-Id: I7d799b5f9d6066d988aa2e101e0fe7b6efe74aea Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
33 lines
919 B
Python
Executable File
33 lines
919 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import optparse
|
|
import os.path
|
|
import subprocess
|
|
import sys
|
|
|
|
parser = optparse.OptionParser()
|
|
parser.add_option("--limit", dest="limit", type=int,
|
|
help="Limit to this number of output entries.", default=0)
|
|
(opts, args) = parser.parse_args()
|
|
|
|
third_party_path = os.path.join(os.path.dirname(sys.argv[0]), "..", "lib")
|
|
|
|
durations = {}
|
|
|
|
cmd = "subunit-1to2 | subunit-ls --times --no-passthrough"
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=sys.stdin, shell=True)
|
|
for l in p.stdout:
|
|
l = l.strip()
|
|
(name, duration) = l.rsplit(" ", 1)
|
|
durations[name] = float(duration)
|
|
|
|
if opts.limit:
|
|
print "Top %d tests by run time:" % opts.limit
|
|
|
|
for i, (name, length) in enumerate(sorted(
|
|
durations.items(), cmp=lambda (k1,v1), (k2, v2): cmp(v1, v2), reverse=True)):
|
|
if opts.limit and i == opts.limit:
|
|
break
|
|
print "%d: %s -> %ds" % (i+1, name, length)
|