
    6h
                    :    S r SSKJr  SSKJr  S r " S S5      rg)	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.
    )annotations   )pycompatc                    [        U [        5      (       a  S[        R                  " U 5      -   $ S[        R                  " U R                  5      [        R                  " U R
                  5      U R                  4-  $ )N   ~s   %s %s:%d)
isinstancestrr   sysbytesco_nameco_filenameco_firstlineno)codes    :/usr/lib/python3/dist-packages/mercurial/lsprofcalltree.pylabelr      sf    $h''---dll+d../
 
 	
    c                  2    \ rS rSrS rS rS rS rS rSr	g)	KCacheGrind   c                <    UR                  5       U l        S U l        g )N)getstatsdataout_file)selfprofilers     r   __init__KCacheGrind.__init__   s    %%'	r   c                    Xl         UR                  S5        U R                  5         U R                   H  nU R	                  U5        M     g )Ns   events: Ticks
)r   write_print_summaryr   _entry)r   r   entrys      r   outputKCacheGrind.output#   s:     )*YYEKK r   c                    SnU R                    H&  n[        UR                  S-  5      n[        X5      nM(     U R                  R                  SU-  5        g )Nr     s   summary: %d
)r   int	totaltimemaxr   r   )r   max_costr!   r'   s       r   r   KCacheGrind._print_summary*   sL    YYEEOOd23I8/H  	,x78r   c                   U R                   nUR                  n[        U[        5      (       a  UR	                  S5        O2UR	                  S[
        R                  " UR                  5      -  5        UR	                  S[        U5      -  5        [        UR                  S-  5      n[        U[        5      (       a  UR	                  SU-  5        O UR	                  SUR                  U4-  5        UR                  (       a  UR                  nO/ n[        U[        5      (       a  SnOUR                  nU H  nU R                  Xg5        M     UR	                  S5        g )	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    KCacheGrind._entry1   s   ==zzdC  NN9%NN:(9(9$:J:J(KKLzE$K/0))D01
dC  NN9z12NN:)<)<j(IIJ ;;KKEEdC  F((FHNN6,  	ur   c                
   U R                   nUR                  nUR                  S[        U5      -  5        [	        U[
        5      (       a0  UR                  S5        UR                  SUR                  -  5        O\UR                  S[        R                  " UR                  5      -  5        UR                  SUR                  UR                  4-  5        [        UR                  S-  5      nUR                  SX4-  5        g )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   r1   r2   r   r   r'   s         r   r0   KCacheGrind._subentryR   s    ==}}{U4[01dC  NN:&NN?X-?-??@NN;):):4;K;K)LLMNN H$6$68K8K#LL **T12	zV$778r   )r   r   N)
__name__
__module____qualname____firstlineno__r   r"   r   r    r0   __static_attributes__ r   r   r   r      s    9B9r   r   N)__doc__
__future__r    r   r   r   r<   r   r   <module>r@      s#   
 # 	
B9 B9r   