Rev | Line | |
---|
[8319] | 1 | import sys |
---|
| 2 | import os |
---|
| 3 | import re |
---|
| 4 | |
---|
| 5 | defaultOutputFile ='/nas/gemd/georisk_models/inundation/timing/timing.csv' |
---|
| 6 | timingDelimiter ='#@# ' |
---|
| 7 | if len(sys.argv) < 3: |
---|
| 8 | outputFile = open(defaultOutputFile, "a") |
---|
| 9 | else: |
---|
| 10 | outputFile = open(sys.argv[2], "a") |
---|
| 11 | |
---|
| 12 | dictResults={} |
---|
| 13 | |
---|
| 14 | path = sys.argv[1] |
---|
| 15 | for (path, dirs, files) in os.walk(path): |
---|
| 16 | |
---|
| 17 | for file in files: |
---|
| 18 | if "anuga.log" in file: |
---|
| 19 | for line in open(os.path.join(path,file)): |
---|
| 20 | if line.find(timingDelimiter)>-1: |
---|
| 21 | key =line.split(',')[0].replace(timingDelimiter,'') |
---|
| 22 | value =line.split(',')[1] |
---|
| 23 | dictResults[key]=value |
---|
| 24 | print key +value |
---|
| 25 | try: |
---|
| 26 | #print "numTriangles: "+ dictResults['numTriangles'] + " start: " + dictResults['startMeshTime'] + " end: " \ |
---|
| 27 | #+ dictResults['finishMeshTime'] + " Very end: " + dictResults['finishTime'] |
---|
| 28 | |
---|
| 29 | outputFile.write(dictResults['numTriangles'] + "," + dictResults['startMeshTime'] + "," \ |
---|
| 30 | + dictResults['finishMeshTime'] + "," + dictResults['finishTime']+ "," \ |
---|
| 31 | + dictResults['startMemory'] + "," + dictResults['finishMemory']+ "," \ |
---|
| 32 | + os.path.join(path,file) + '\n') |
---|
| 33 | except: |
---|
| 34 | print os.path.join(path,file) + " not in the right format" |
---|
| 35 | |
---|
| 36 | outputFile.close() |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
Note: See
TracBrowser
for help on using the repository browser.