Changeset 4904 for anuga_core/source/anuga/pmesh/timing.py
- Timestamp:
- Jan 4, 2008, 11:50:41 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/pmesh/timing.py
r3535 r4904 5 5 from anuga.pmesh import * 6 6 import time 7 8 def mem_usage(): 9 ''' 10 returns the rss. 11 12 RSS The total amount of physical memory used by the task, in kilo- 13 bytes, is shown here. For ELF processes used library pages are 14 counted here, for a.out processes not. 15 16 Only works on nix systems. 17 ''' 18 import string 19 p=os.popen('ps uwp %s'%os.getpid()) 20 lines=p.readlines() 21 #print "lines", lines 22 status=p.close() 23 if status or len(lines)!=2 or sys.platform == 'win32': 24 return None 25 return int(string.split(lines[1])[4]) 7 26 8 27 9 draw = Draw() 28 29 #draw = Draw() 10 30 #draw.run() 11 n = 400 31 n = 2 32 maxArea = 0.00005 33 #maxArea = 0.1 12 34 times = [] 13 35 tinitial = time.time() 14 times.append(("initial",time.time()-tinitial)) 36 mem_initial = mem_usage() 37 print "mem_initial", mem_initial 15 38 #------------------------------------------ 16 39 mesh = Mesh() … … 37 60 mesh.addUserSegment(v3,v4) 38 61 mesh.addUserSegment(v4,v1) 39 times.append(("user_outline_created",time.time() - tinitial )) 62 mem_now =mem_usage() 63 #print "mem_now", mem_now 64 if mem_now is not None: 65 mem = mem_now - mem_initial 66 else: 67 mem = 0.0 68 times.append(("user_outline_created",time.time() - tinitial, mem )) 40 69 #------------------------------------------ 41 #mesh.auto_segment() 42 #times.append(("mesh_auto_segmented",time.time() - tinitial )) 70 mesh.generateMesh(mode = "Q",maxArea = maxArea) 71 mem_now =mem_usage() 72 #print "mem_now", mem_now 73 if mem_now is not None: 74 mem = mem_now - mem_initial 75 else: 76 mem = 0.0 77 times.append(("mesh_generated",time.time()- tinitial - times[0][1], mem)) 43 78 #------------------------------------------ 44 mesh. generateMesh(mode = "Q",maxArea = 1)45 times.append(("mesh_generated",time.time() - tinitial ))46 # ------------------------------------------47 draw.mesh = mesh 48 draw.selectZoom(1.0) 49 times.append(("zoomed",time.time() - tinitial )) 50 #------------------------------------------ 51 79 mesh.export_mesh_file("dump.msh") 80 mem_now =mem_usage() 81 #print "mem_now", mem_now 82 if mem_now is not None: 83 mem = mem_now - mem_initial 84 else: 85 mem = 0.0 86 times.append(("export_mesh_file",time.time()- tinitial - times[1][1], mem)) 52 87 53 88 #--------------------- 54 print "N is ", n 89 print "Number of user verts. ", n 90 print "maxArea",maxArea 91 print "funtion time memory usage, cumulative, for nix machines" 55 92 for time in times: 56 print "%s %0.12f" %(time[0], time[1])93 print "%s %0.2f %0.2f" %(time[0], time[1], time[2]) 57 94 58 95 """ 59 96 #Results - mesh.py ver 1.84 1.85 60 97 # N 400 … … 64 101 #zoomed 32.81299996 33.5940001 65 102 103 # results on dsg's pc dell precision 390. 104 # anuga version 1497 105 Number of user verts. 2 106 maxArea 0.0001 107 user_outline_created 0.00 108 mesh_generated 4.92 109 export_mesh_file 16.30 110 111 Number of user verts. 2 112 maxArea 0.0001 113 user_outline_created 0.00 114 mesh_generated 4.92 115 export_mesh_file 16.30 116 117 Number of user verts. 2 118 maxArea 5e-005 119 user_outline_created 0.00 120 mesh_generated 15.53 121 export_mesh_file 41.39 122 123 version 4903 124 mem_initial None 125 Number of user verts. 2 126 maxArea 5e-005 127 funtion time memory usage, cumulative, for nix machines 128 user_outline_created 0.49 0.00 129 mesh_generated 1.94 0.00 130 export_mesh_file 2.75 0.00 66 131 67 132 133 Results of tornado head node 134 Number of user verts. 2 135 maxArea 5e-05 136 funtion time memory usage, cumulative, for nix machines 137 user_outline_created 0.14 32.00 138 mesh_generated 18.81 378304.00 139 export_mesh_file 17.79 380620.00 140 141 version 4903 142 mem_initial 77816 143 Number of user verts. 2 144 maxArea 5e-05 145 funtion time memory usage, cumulative, for nix machines 146 user_outline_created 0.15 32.00 147 mesh_generated 1.26 27224.00 148 export_mesh_file 0.82 27224.00 149 150 """
Note: See TracChangeset
for help on using the changeset viewer.