
    	^c
                     6    d Z ddlmZ d Z G d d          ZdS )aC  
lsprofcalltree.py - lsprof output which is readable by kcachegrind

Authors:
    * David Allouche <david <at> allouche.net>
    * Jp Calderone & Itamar Shtull-Trauring
    * Johan Dahlin

This software may be used and distributed according to the terms
of the GNU General Public License, incorporated herein by reference.
   )pycompatc                     t          | t                    rdt          j        |           z   S dt          j        | j                  t          j        | j                  | j        fz  S )N   ~s   %s %s:%d)
isinstancestrr   sysbytesco_nameco_filenameco_firstlineno)codes    :/usr/lib/python3/dist-packages/mercurial/lsprofcalltree.pylabelr      sc    $ 
h'----dl++d.//
 
 	
    c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )KCacheGrindc                 F    |                                 | _        d | _        d S )N)getstatsdataout_file)selfprofilers     r   __init__zKCacheGrind.__init__   s     %%''	r   c                     || _         |                    d           |                                  | j        D ]}|                     |           d S )Ns   events: Ticks
)r   write_print_summaryr   _entry)r   r   entrys      r   outputzKCacheGrind.output"   s^     )***Y 	 	EKK	 	r   c                     d}| j         D ])}t          |j        dz            }t          ||          }*| j                            d|z             d S )N      s   summary: %d
)r   int	totaltimemaxr   r   )r   max_costr   r#   s       r   r   zKCacheGrind._print_summary)   s_    Y 	0 	0EEOd233I8Y//HH,x788888r   c                    | j         }|j        }t          |t                    r|                    d           n/|                    dt          j        |j                  z             |                    dt          |          z             t          |j
        dz            }t          |t                    r|                    d|z             n|                    d|j        |fz             |j        r|j        }ng }t          |t                    rd}n|j        }|D ]}|                     ||           |                    d           d S )	Ns   fi=~
s   fi=%s
s   fn=%s
r!   s   0 %d
   %d %d
r       
)r   r   r   r   r   r   r   r
   r   r"   
inlinetimer   calls	_subentry)r   r   r   r   r)   r*   linenosubentrys           r   r   zKCacheGrind._entry0   sT   =zdC   	MNN9%%%%NN:(9$:J(K(KKLLLzE$KK/000)D011
dC   	KNN9z12222NN:)<j(IIJJJ ; 	KEEEdC   	)FF(F 	- 	-HNN68,,,,ur   c                    | j         }|j        }|                    dt          |          z             t	          |t
                    r3|                    d           |                    d|j        z             nS|                    dt          j        |j	                  z             |                    d|j        |j
        fz             t          |j        dz            }|                    d||fz             d S )Ns   cfn=%s
s   cfi=~
s   calls=%d 0
s   cfi=%s
s   calls=%d %d
r!   r'   )r   r   r   r   r   r   	callcountr   r   r
   r   r"   r#   )r   r,   r-   r   r   r#   s         r   r+   zKCacheGrind._subentryQ   s    =}{U4[[0111dC   	NN:&&&NN?X-??@@@@NN;):4;K)L)LLMMMNN H$68K#LL   *T122	zVY$7788888r   N)__name__
__module____qualname__r   r   r   r   r+    r   r   r   r      s`            9 9 9  B9 9 9 9 9r   r   N)__doc__ r   r   r   r3   r   r   <module>r6      sn   
 
      	
 	
 	
B9 B9 B9 B9 B9 B9 B9 B9 B9 B9r   