summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/startuptime.py
blob: 1bb5b208f66e04a59033b05592397f9a3e1d5562 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Quick script to time startup for various binaries

import subprocess
import sys
import time

NREPS = 100


def main():
    binaries = sys.argv[1:]
    for bin in binaries:
        t0 = time.time()
        for _ in range(NREPS):
            result = subprocess.run([bin, "-c", "pass"])
            result.check_returncode()
        t1 = time.time()
        print(f"{(t1-t0)/NREPS:6.3f} {bin}")


if __name__ == "__main__":
    main()