- Timestamp:
- Feb 2, 2012, 1:08:40 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/mem_time_tests/parameters/nothing/main.py
r8326 r8328 19 19 file = 'ex1.csv' 20 20 file_path = os.path.join(scenariodir, file) 21 store = 'store.txt' 22 file_path_store = os.path.join(scenariodir, store) 21 meta = 'metalog.csv' 22 meta_path = os.path.join(scenariodir, meta) 23 final = 'final.csv' 24 final_path = os.path.join(scenariodir, final) 23 25 24 spamWriter = csv.writer(open(file_path, 'wb')) 25 spamWriter.writerow(['Run Number' , 'Time Taken','Space Used'])26 e = open(file_path_store,'a') #create the file 27 e.close()26 #set up needed files 27 firstex1 = open(file_path, 'wb') 28 spamWriter = csv.writer(firstex1) 29 spamWriter.writerow(['Run Number' , 'Time Taken(s)','Space Used']) 28 30 29 31 #main loop, that stores the current run number so that unique folders exist for the information 30 32 for n in range(0,300,1): 31 32 e = open(file_path_store,'r+') 33 e.write(str(n)) #store the run number 34 35 x = time.clock() #time it 36 subprocess.call(['python2.5', 'ex1.py']) #run script 37 y = time.clock() #time it 33 34 x = time.time() #time it 35 subprocess.call(['python2.5', 'ex1.py' ,str(n)]) #run script 36 y = time.time() #time it 38 37 39 38 spamWriter.writerow([n ,(y-x)]) … … 41 40 print "DONE" 42 41 43 analyse_log(scenariodir, 'metalog.csv') #get the memory usage from the log files 42 analyse_log(scenariodir, os.path.join(scenariodir,'metalog.csv')) #get the memory usage from the log files 43 44 #close ex1.csv so we can read from it for a different csv reader object 45 firstex1.close() 46 47 #merge the metalog useful memory info and the ex1 recorded info into one csv file named final 48 ex1 = csv.reader(open(file_path,'rb')) 49 metalog = csv.reader(open(meta_path,'rb')) 50 final = csv.writer(open(final_path,'wb')) 51 52 53 for row in ex1: 54 d = metalog.next() 55 final.writerow([row[0],row[1],d[0],d[3],d[6],d[9],d[12]])#,d[15],d[18]])
Note: See TracChangeset
for help on using the changeset viewer.