contrib/perf.py
changeset 31397 8f5ed8fa39f8
parent 30977 5a9e4dc8e4fd
child 31476 413b44003462
equal deleted inserted replaced
31396:ab3e9eab754f 31397:8f5ed8fa39f8
    18 # - make perf command for recent feature work correctly with early
    18 # - make perf command for recent feature work correctly with early
    19 #   Mercurial
    19 #   Mercurial
    20 
    20 
    21 from __future__ import absolute_import
    21 from __future__ import absolute_import
    22 import functools
    22 import functools
       
    23 import gc
    23 import os
    24 import os
    24 import random
    25 import random
    25 import sys
    26 import sys
    26 import time
    27 import time
    27 from mercurial import (
    28 from mercurial import (
   187 
   188 
   188 def stub_timer(fm, func, title=None):
   189 def stub_timer(fm, func, title=None):
   189     func()
   190     func()
   190 
   191 
   191 def _timer(fm, func, title=None):
   192 def _timer(fm, func, title=None):
       
   193     gc.collect()
   192     results = []
   194     results = []
   193     begin = util.timer()
   195     begin = util.timer()
   194     count = 0
   196     count = 0
   195     while True:
   197     while True:
   196         ostart = os.times()
   198         ostart = os.times()