source: trunk/misc/tools/log_analysis/timingScript.py @ 8319

Last change on this file since 8319 was 8319, checked in by gray, 12 years ago

Vanessa's log scripts.

File size: 1.4 KB
Line 
1import sys
2import os
3import re
4
5defaultOutputFile ='/nas/gemd/georisk_models/inundation/timing/timing.csv'
6timingDelimiter ='#@# '
7if len(sys.argv) < 3:
8    outputFile = open(defaultOutputFile, "a")
9else:
10    outputFile = open(sys.argv[2], "a")
11
12dictResults={}
13
14path = sys.argv[1]
15for (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
36outputFile.close()
37
38
39
40   
41
42
43
44   
45 
Note: See TracBrowser for help on using the repository browser.