1 2# Copyright (C) 2009-2012 Lorenzo Caminiti 3# Distributed under the Boost Software License, Version 1.0 4# (see accompanying file LICENSE_1_0.txt or a copy at 5# http://www.boost.org/LICENSE_1_0.txt) 6# Home at http://www.boost.org/libs/local_function 7 8import sys 9import time 10import os 11 12if len(sys.argv) < 2: 13 print "Usage: python " + sys.argv[0] + " COMMAND [COMMAND_OPTIONS]" 14 print "Measure run-time of executing the specified command." 15 exit(1) 16 17cmd = "" 18for arg in sys.argv[1:]: cmd += str(arg) + " " 19 20start = time.time() 21ret = os.system(cmd) 22sec = time.time() - start 23 24if (ret == 0): print "\n" + str(sec) + "s" 25 26