def timed(f):
    '''
    Wrap a function and time all of its execution calls in milliseconds.
    '''
    fname = os.path.basename(f.__code__.co_filename) or '_'
    line_no = repr(f.__code__.co_firstlineno)
    name = 'timed.{0}[{1}:{2}](ms)'.format(f.__name__, fname, line_no)

    @functools.wraps(f)
    def g(*a, **kw):
        s = faststat.nanotime()
        r = f(*a, **kw)
        context.get_context().stats[name].add((faststat.nanotime() - s) / 1e6)
        return r
    return g
dataset/ETHPy150Open paypal/support/support/async.py/timed/original