File: average

package info (click to toggle)
ledger 3.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,756 kB
  • ctags: 5,063
  • sloc: cpp: 36,839; lisp: 3,959; python: 3,939; perl: 1,309; sh: 473; makefile: 121; cs: 118; yacc: 103
file content (26 lines) | stat: -rwxr-xr-x 419 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python

import getopt
import time
import string
import sys
import os

count = 10

opts, args = getopt.getopt(sys.argv[1:], "n:")
for opt in opts:
    if opt[0] == "-n":
        count = int(opt[1])

length = 0.0

i = 0
while i < count:
    begin = time.time()
    cmd = '"' + string.join(args, '" "') + '"';
    os.system(cmd)
    length += time.time() - begin
    i += 1

print >> sys.stderr, length / count