contrib/perf.py
changeset 51591 ecf4b959fa74
parent 51590 a6bdd2e6f7cb
child 51592 24844407fa0d
equal deleted inserted replaced
51590:a6bdd2e6f7cb 51591:ecf4b959fa74
   561     profiler=None,
   561     profiler=None,
   562     profiled_runs=(0,),
   562     profiled_runs=(0,),
   563 ):
   563 ):
   564     gc.collect()
   564     gc.collect()
   565     results = []
   565     results = []
   566     begin = util.timer()
       
   567     count = 0
   566     count = 0
   568     if profiler is None:
   567     if profiler is None:
   569         profiler = lambda: NOOPCTX
   568         profiler = lambda: NOOPCTX
   570     for i in range(prerun):
   569     for i in range(prerun):
   571         if setup is not None:
   570         if setup is not None:
   572             setup()
   571             setup()
   573         with context():
   572         with context():
   574             func()
   573             func()
       
   574     begin = util.timer()
   575     keepgoing = True
   575     keepgoing = True
   576     while keepgoing:
   576     while keepgoing:
   577         if count in profiled_runs:
   577         if count in profiled_runs:
   578             prof = profiler()
   578             prof = profiler()
   579         else:
   579         else: