def __init__(self, request_profiling_pct, record_request_profile_fn=None,
               request_info_class=None):
    # Assign the hub type to be the special profiling hub class.
    if gevent.hub._threadlocal.Hub:
      raise ValueError('Hub type already assigned')
    gevent.hub._threadlocal.Hub = ProfilingHub

    # Monkey-patch gevent.Greenlet.
    gevent.Greenlet = gevent.greenlet.Greenlet = ProfilingGreenlet

    ProfilingGreenlet._HUB = gevent.hub.get_hub()

    # Monkey-patch gevent.spawn*().
    for attr in ('spawn', 'spawn_later', 'spawn_link', 'spawn_link_value',
                 'spawn_link_exception'):
      setattr(gevent, attr, getattr(ProfilingGreenlet, attr))

    ProfilingGreenlet._REQUEST_PROFILING_PCT = request_profiling_pct

    ProfilingGreenlet._REQUEST_INFO_CLASS = \
      request_info_class if request_info_class else WsgiServerRequestInfo

    ProfilingGreenlet._RECORD_REQUEST_PROFILE_FN = (
      record_request_profile_fn if record_request_profile_fn
      else _default_record_request_profile)
Initialize Gevent profiling.
dataset/ETHPy150Open tellapart/gevent_request_profiler/tellapart/frontend/gevent_profiler.py/Profiler.__init__