Ignore:
Timestamp:
Jan 4, 2008, 11:50:41 AM (17 years ago)
Author:
duncan
Message:

added some timings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/pmesh/timing.py

    r3535 r4904  
    55from anuga.pmesh import *
    66import time
     7 
     8def 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])
    726
    827
    9 draw = Draw()
     28
     29#draw = Draw()
    1030#draw.run()
    11 n = 400
     31n = 2
     32maxArea = 0.00005
     33#maxArea = 0.1
    1234times = []
    1335tinitial = time.time()
    14 times.append(("initial",time.time()-tinitial))
     36mem_initial = mem_usage()
     37print "mem_initial", mem_initial
    1538#------------------------------------------
    1639mesh = Mesh()
     
    3760mesh.addUserSegment(v3,v4)
    3861mesh.addUserSegment(v4,v1)
    39 times.append(("user_outline_created",time.time() - tinitial ))
     62mem_now =mem_usage()
     63#print "mem_now", mem_now
     64if mem_now is not None:
     65    mem = mem_now - mem_initial
     66else:
     67    mem = 0.0
     68times.append(("user_outline_created",time.time() - tinitial, mem ))
    4069#------------------------------------------
    41 #mesh.auto_segment()
    42 #times.append(("mesh_auto_segmented",time.time() - tinitial ))
     70mesh.generateMesh(mode = "Q",maxArea = maxArea)
     71mem_now =mem_usage()
     72#print "mem_now", mem_now
     73if mem_now is not None:
     74    mem = mem_now - mem_initial
     75else:
     76    mem = 0.0
     77times.append(("mesh_generated",time.time()- tinitial - times[0][1], mem))
    4378#------------------------------------------
    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 
     79mesh.export_mesh_file("dump.msh")
     80mem_now =mem_usage()
     81#print "mem_now", mem_now
     82if mem_now is not None:
     83    mem = mem_now - mem_initial
     84else:
     85    mem = 0.0
     86times.append(("export_mesh_file",time.time()- tinitial - times[1][1], mem))
    5287
    5388#---------------------
    54 print "N is ", n
     89print "Number of user verts. ", n
     90print "maxArea",maxArea
     91print "funtion     time   memory usage, cumulative, for nix machines"
    5592for 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])
    5794
    58 
     95"""
    5996#Results - mesh.py ver   1.84           1.85   
    6097# N     400     
     
    64101#zoomed                 32.81299996     33.5940001
    65102
     103# results on dsg's pc dell precision 390.
     104# anuga version 1497
     105Number of user verts.  2
     106maxArea 0.0001
     107user_outline_created   0.00
     108mesh_generated   4.92
     109export_mesh_file   16.30
     110
     111Number of user verts.  2
     112maxArea 0.0001
     113user_outline_created   0.00
     114mesh_generated   4.92
     115export_mesh_file   16.30
     116
     117Number of user verts.  2
     118maxArea 5e-005
     119user_outline_created   0.00
     120mesh_generated   15.53
     121export_mesh_file   41.39
     122
     123version 4903
     124mem_initial None
     125Number of user verts.  2
     126maxArea 5e-005
     127funtion     time   memory usage, cumulative, for nix machines
     128user_outline_created   0.49   0.00
     129mesh_generated   1.94   0.00
     130export_mesh_file   2.75   0.00
    66131
    67132
     133Results of tornado head node
     134Number of user verts.  2
     135maxArea 5e-05
     136funtion     time   memory usage, cumulative, for nix machines
     137user_outline_created   0.14   32.00
     138mesh_generated   18.81   378304.00
     139export_mesh_file   17.79   380620.00
     140
     141version 4903
     142mem_initial 77816
     143Number of user verts.  2
     144maxArea 5e-05
     145funtion     time   memory usage, cumulative, for nix machines
     146user_outline_created   0.15   32.00
     147mesh_generated   1.26   27224.00
     148export_mesh_file   0.82   27224.00
     149
     150"""
Note: See TracChangeset for help on using the changeset viewer.