def function_runner(method_name, number=10000):
    """ Simulate calling the event function with the different event types.

    Parameters
    ----------
    method_name : string
        The name of the method to use.

    number : int
        The number of events to create for each event type.

    """
    for method_names, cls in method_map:
        if method_name in method_names:
            break
    else:
        raise ValueError('could not find method {0}'.format(method_name))

    monitor = cls()
    method = getattr(monitor, method_name)

    frame = inspect.currentframe()
    for i in range(number):
        method(frame, 'call', method)
    for i in range(number):
        method(frame, 'return', method)
    for i in range(number):
        method(frame, 'exception', method)
    for i in range(number):
        method(frame, 'c_call', method)
    for i in range(number):
        method(frame, 'c_return', method)
    for i in range(number):
        method(frame, 'c_exception', method)
dataset/ETHPy150Open enthought/pikos/pikos/benchmark/function_events.py/function_runner/original