ó
è¾bc           @   sY   d  Z  d d l Z d d l m Z d d l m Z e d d d ƒd d
 d	 „  ƒ  YZ d S(   s6   High-perfomance logging profiler, mostly written in C.iÿÿÿÿN(   t   ProfilerError(   t   warnpy3ksO   The 'hotshot' module is not supported in 3.x, use the 'profile' module instead.t
   stackleveli   t   Profilec           B   s_   e  Z d  d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z	 d
 „  Z
 RS(   i    i   c         C   s˜   | r d p d |  _  | r' | r' d p* d |  _ t j | |  j  |  j ƒ |  _ } |  j t k r” | j |  _ | j |  _ | j	 |  _	 | j
 |  _
 n  d  S(   Ni   i    (   t
   lineeventst   linetimingst   _hotshott   profilert   _proft	   __class__R   t   closet   startt   stopt   addinfo(   t   selft   logfnR   R   t   p(    (    s&   /usr/lib/python2.7/hotshot/__init__.pyt   __init__   s    c         C   s   |  j  j ƒ  d S(   s-   Close the logfile and terminate the profiler.N(   R   R
   (   R   (    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR
      s    c         C   s   |  j  j ƒ  S(   s6   Return the file descriptor of the profiler's log file.(   R   t   fileno(   R   (    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR      s    c         C   s   |  j  j ƒ  d S(   s   Start the profiler.N(   R   R   (   R   (    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR   "   s    c         C   s   |  j  j ƒ  d S(   s   Stop the profiler.N(   R   R   (   R   (    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR   &   s    c         C   s   |  j  j | | ƒ d S(   s3   Add an arbitrary labelled value to the profile log.N(   R   R   (   R   t   keyt   value(    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR   *   s    c         C   s(   d d l  } | j } |  j | | | ƒ S(   s»   Profile an exec-compatible string in the script
        environment.

        The globals from the __main__ module are used as both the
        globals and locals for the script.
        iÿÿÿÿN(   t   __main__t   __dict__t   runctx(   R   t   cmdR   t   dict(    (    s&   /usr/lib/python2.7/hotshot/__init__.pyt   run1   s    	c         C   s,   t  | d d ƒ } |  j j | | | ƒ |  S(   s‡   Evaluate an exec-compatible string in a specific
        environment.

        The string is compiled before profiling begins.
        s   <string>t   exec(   t   compileR   t   runcode(   R   R   t   globalst   localst   code(    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR   <   s    c         O   s   |  j  j | | | ƒ S(   s  Profile a single call of a callable.

        Additional positional and keyword arguments may be passed
        along; the result of the call is returned, and exceptions are
        allowed to propagate cleanly, while ensuring that profiling is
        disabled on the way out.
        (   R   t   runcall(   R   t   funct   argst   kw(    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR!   F   s    (   t   __name__t
   __module__R   R
   R   R   R   R   R   R   R!   (    (    (    s&   /usr/lib/python2.7/hotshot/__init__.pyR   
   s   							
(    (   t   __doc__R   R    t   warningsR   t	   _warnpy3kR   (    (    (    s&   /usr/lib/python2.7/hotshot/__init__.pyt   <module>   s   	