summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/local_function/example/chrono.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/local_function/example/chrono.py')
-rwxr-xr-xsrc/boost/libs/local_function/example/chrono.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/boost/libs/local_function/example/chrono.py b/src/boost/libs/local_function/example/chrono.py
new file mode 100755
index 000000000..84d6dfb3a
--- /dev/null
+++ b/src/boost/libs/local_function/example/chrono.py
@@ -0,0 +1,25 @@
+
+# Copyright (C) 2009-2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://www.boost.org/libs/local_function
+
+import sys
+import time
+import os
+
+if len(sys.argv) < 2:
+ print "Usage: python " + sys.argv[0] + " COMMAND [COMMAND_OPTIONS]"
+ print "Measure run-time of executing the specified command."
+ exit(1)
+
+cmd = ""
+for arg in sys.argv[1:]: cmd += str(arg) + " "
+
+start = time.time()
+ret = os.system(cmd)
+sec = time.time() - start
+
+if (ret == 0): print "\n" + str(sec) + "s"
+