Add a trivial script to extract the times from *.report.txt files.
[llvm-testsuite.git] / tools / get-report-time
blobe1b9618eb40ec2e51ac64ec7824606420d99c3b0
1 #!/usr/bin/env python
3 import re
4 import optparse
6 def main():
7 parser = optparse.OptionParser("""\
8 usage: %prog [options] <path>
10 Reads the file at the given path and extracts any "program times" as used by the
11 LLVM test-suite Makefiles.""")
12 opts,args = parser.parse_args()
13 if len(args) != 1:
14 parser.error('invalid number of arguments')
16 file = open(args[0])
17 try:
18 re_pattern = re.compile(r"program ([0-9]+\.[0-9]+)")
20 data = file.read()
21 for match in re_pattern.finditer(data):
22 print match.group(1)
23 finally:
24 file.close()
26 if __name__ == '__main__':
27 main()