Back to index

plone3  3.1.7
Functions | Variables
ExtendedPathIndex.ptests.testProfiling Namespace Reference

Functions

def profile
def createContent

Variables

string epi_path = '/'
tuple index = ExtendedPathIndex( 'path' )

Function Documentation

def ExtendedPathIndex.ptests.testProfiling.createContent (   index,
  f1 = 9,
  f2 = 50,
  f3 = 10 
)

Definition at line 30 of file testProfiling.py.

00030 
00031 def createContent(index, f1=9, f2=50, f3=10):
00032     count = 0
00033     for i in range(f1):
00034         meth1 = index.search
00035         args = ()
00036         kwargs = {"path": '/plone/f-0/f-0-0/f-0-0-0',
00037                   "navtree": 1,
00038                   "depth": 1}
00039         prof_id = 'profile_EPI_%s.prof'%count
00040         result = profile(prof_id, meth1, args, kwargs)
00041         print 'num of results: %s'%len(result.keys())
00042         f1id = 'f-%d' % i
00043         folder1 = Dummy("/plone/%s" % f1id)
00044         count += 1
00045         index.index_object(count, folder1)
00046 
00047         for j in range(f2):
00048             f2id = 'f-%d-%d' % (i, j)
00049             folder2 = Dummy("/plone/%s/%s" % (f1id, f2id))
00050             count += 1
00051             index.index_object(count, folder2)
00052 
00053             for k in range(f3):
00054                 f3id = 'f-%d-%d-%d' % (i, j, k)
00055                 folder3 = Dummy("/plone/%s/%s/%s" % (f1id, f2id, f3id))
00056                 count += 1
00057                 index.index_object(count, folder3)
00058 
00059                 for m in range(100):
00060                     docid = 'f-%d-%d-%d-%d' % (i, j, k, m)
00061                     doc = Dummy("/plone/%s/%s/%s/%s" % (f1id, f2id, f3id, docid))
00062                     count += 1
00063                     index.index_object(count, doc)
00064     prof_id = 'profile_EPI_%s.prof'%count
00065     result = profile(prof_id, meth1, args, kwargs)
00066     print 'num of results: %s'%len(result.keys())
00067     print 'Created %s entries' % count
00068 
createContent(index)

Here is the call graph for this function:

def ExtendedPathIndex.ptests.testProfiling.profile (   prof_name,
  method,
  args = (),
  kwargs = {},
  times = 100 
)

Definition at line 14 of file testProfiling.py.

00014 
00015 def profile(prof_name, method, args=(), kwargs={}, times=100):
00016         def run_multiple(method, args, kwargs):
00017             for i in range(times):
00018                r = method(*args, **kwargs)
00019             return r
00020         prof = hotshot.Profile(prof_name)
00021         result = prof.runcall(run_multiple, method, args, kwargs)
00022         prof.close()
00023         print prof_name
00024         stats = hotshot.stats.load(prof_name)
00025         # Print calls ordered by time
00026         stats.strip_dirs()
00027         stats.sort_stats('time', 'calls')
00028         stats.print_stats(15)
00029         return result

Here is the caller graph for this function:


Variable Documentation

Definition at line 7 of file testProfiling.py.

tuple ExtendedPathIndex.ptests.testProfiling.index = ExtendedPathIndex( 'path' )

Definition at line 11 of file testProfiling.py.