Your IP : 3.144.91.130


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/pstats.cpython-38.opt-2.pyc

U

i�f�j�@s�ddlZddlZddlZddlZddlZddlmZddlmZddgZ	Gdd�de
e�ZGdd�d�ZGdd	�d	�Z
d
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zedk�r|ddlZzddlZWnek
r�YnXGdd�dej�Zeej�dk�rejdZndZzPee�Zejdd�D]Ze� e��q,e!dej"d�e�#�e!dej"d�Wne$k
�rzYnXdS) �N)�Enum)�
cmp_to_key�Stats�SortKeyc@s8eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
d�ZdS)
r)�calls�ncalls)�
cumulative�cumtime)�filename�module�line�name�nfl�pcalls�stdname)�time�tottimecGs@|d}t�||�}||_|dd�D]}||j|<q&||_|S�Nr�)�str�__new__�_value_�_value2member_map_Z_all_values)�cls�values�value�objZother_value�r�+/opt/alt/python38/lib64/python3.8/pstats.pyr-szSortKey.__new__N)
�__name__�
__module__�__qualname__ZCALLSZ
CUMULATIVEZFILENAMEZLINE�NAMEZNFLZPCALLSZSTDNAMEZTIMErrrrrr"sc@s�eZdZdd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdddddddddddddd�
Z	dd�Z
dd�Zdd�Zdd �Z
d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd6d0d1�Zd2d3�Zd4d5�ZdS)7rN)�streamcGsF|ptj|_t|�sd}n|d}|dd�}|�|�|j|�dSr)�sys�stdoutr#�len�init�add)�selfr#�args�argrrr�__init__Ys
zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|�|�z|��Wn8t
k
r�td|jrx|jdnd|jd��YnXdS)NrzInvalid timing data %s������file)�all_callees�files�fcn_list�total_tt�total_calls�
prim_calls�max_name_len�set�	top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats�	Exception�printr#)r)r+rrrr'cs(
��z
Stats.initc	Cs�|dkri|_dSt|t�rxt|d��}t�|�|_W5QRXz"t�|�}t�	|j
�d|}WnYnX|g|_n t|d�r�|�
�|j|_i|_|js�td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)r:�
isinstancer�open�marshal�load�os�statr�ctime�st_mtimer2�hasattrrA�	TypeError�	__class__)r)r+�fZ
file_statsrrrr<vs*



�zStats.load_statscCs�|j��D]p\}\}}}}}|j|7_|j|7_|j|7_d|krZ|j�|�tt|��|j	kr
tt|��|_	q
dS)N)ZjprofilerZprofiler)
r:�itemsr5r6r4r9r(r&�func_std_stringr7)r)�func�cc�nc�tt�ct�callersrrrr=�szStats.get_top_level_statscGs�|s|St|�D]�}t|�t|�kr,t|�}|j|j7_|j|j7_|j|j7_|j|j7_|jD]}|j�|�qr|j	|j	kr�|j	|_	d|_
|j��D]<\}}||jkr�|j|}nddddif}t
||�|j|<q�q|S�Nr)�reversed�typerr2r5r6r4r9r(r7r3r:rN�add_func_stats)r)�arg_list�itemrPrGZ
old_func_statrrrr(�s(

z	Stats.addc	Cs(t|d��}t�|j|�W5QRXdS)N�wb)rCrD�dumpr:)r)r
rMrrr�
dump_stats�szStats.dump_stats)))rr-z
call count)))�r-zcumulative time))��rz	file name))��rzline number))��rz
function name))rdr`rbzname/file/line)))rr-zprimitive call count)))�rz
standard name)))�r-z
internal time)
rrr	rr
rrr
rrrrrcCst|jsni|_}i}|j��D]>\}}|}|r|s4q||krFd||<q|||<|dd�}q*q|D]
}||=qb|jS)Nrr-)r;�sort_arg_dict_defaultrN)r)�dictZbad_list�word�tupZfragmentrrr�get_sort_arg_defs�s 
zStats.get_sort_arg_defscGs\|sd|_|St|�dkrBt|dt�rBddddd�|dg}n:t|�dkr||dd�D] }t|�t|d�krZtd	��qZ|��}d
}d|_d}|D]B}t|t�r�|j	}|||d}|j|||d7_d}q�g}|j
��D]4\}\}	}
}}}
|�|	|
||f|t
|�|f�q�|jtt|�j�d
�g|_}|D]}|�|d��qB|S)Nrrrrrr)r-rrrgrgzCan't have mixed argument typerr.z, )�keyr-)r3r&rB�intrXrKrl�	sort_typerrr:rN�appendrO�sortr�	TupleComp�compare)r)Zfieldr+Z
sort_arg_defsZ
sort_tupleZ	connectorrjZ
stats_listrPrQrRrSrTrUr3�tuplerrr�
sort_stats�sF��


�
zStats.sort_statscCs|jr|j��|S�N)r3�reverse�r)rrr�
reverse_orders
zStats.reverse_ordercCs�|j}i|_}d}|��D]�\}\}}}}}	t|�}
tt|
��|krRtt|
��}i}|	��D]\}}
|
|t|�<q^|
|kr�t||
|||||f�||
<q|||||f||
<q|j}t�|_}|D]}|�t|��q�||_	d|_
d|_|SrV)r:rN�func_strip_pathr&rOrYr9r8r(r7r3r1)r)ZoldstatsZnewstatsr7rPrQrRrSrTrUZnewfuncZ
newcallers�func2�callerZold_topZnew_toprrr�
strip_dirss0
�
zStats.strip_dirsc
Cst|jr
dSi|_}|j��D]P\}\}}}}}||kr@i||<|��D]$\}}	||kr`i||<|	|||<qHqdSrv)r1r:rN)
r)r1rPrQrRrSrTrUr{r|rrr�calc_callees#s
zStats.calc_calleescCs|}t|t�rpzt�|�}Wn*tjk
rF|d|7}||fYSXg}|D]}|�t|��rP|�|�qPnzt|�}t|t	�r�d|kr�dkr�nnt
||d�}|d|�}n2t|t
�r�d|kr�|kr�nn|}|d|�}t|�t|�k�r|dt|�t|�|f7}||fS)Nz#   <Invalid regular expression %r>
gg�?g�?rz6   List reduced from %r to %r due to restriction <%r>
)rBr�re�compile�error�searchrOrpr&�floatrn)r)Zsel�list�msgZnew_listZrexrP�countrrr�eval_print_amount6s2
""�zStats.eval_print_amountcCs�|j}|jr*|jdd�}d|jd}nt|j���}d}|D]}|�|||�\}}q@t|�}|sld|fSt||j	d�|t|j�kr�d}|D] }tt
|��|kr�tt
|��}q�|d|fS)Nz   Ordered by: �
z!   Random listing order was used
rr/rg)r7r3ror�r:�keysr�r&r?r#rO)r)Zsel_list�widthZ	stat_listr�Z	selectionr�rPrrr�get_print_listPs$zStats.get_print_listcGs�|jD]}t||jd�q|jr,t|jd�d}|jD]}t|t|�|jd�q6t||jdd|jd�|j|jkr�td|jd|jd�td|j|jd�t|jd�|�|�\}}|r�|�	�|D]}|�
|�q�t|jd�t|jd�|S)Nr/�        zfunction calls� ��endr0z(%d primitive calls)zin %.3f seconds)r2r?r#r9�func_get_function_namer5r6r4r��print_title�
print_line)r)�amountr
�indentrPr�r�rrr�print_statshs(

zStats.print_statscGsz|�|�\}}|rv|��|�|d�|D]2}||jkrN|�|||j|�q*|�||i�q*t|jd�t|jd�|S)Nz	called...r/)r�r~�print_call_headingr1�print_call_liner?r#)r)r�r�r�rPrrr�
print_calleess
zStats.print_calleesc
Gsh|�|�\}}|rd|�|d�|D](}|j|\}}}}}	|�|||	d�q"t|jd�t|jd�|S)Nzwas called by...z<-r/)r�r�r:r�r?r#)
r)r�r�r�rPrQrRrSrTrUrrr�
print_callers�szStats.print_callersc
Csvtd�|�||jd�d}|j��D]0\}}}}}|r&tt|����}	t|	t�}qXq&|rrtd|d|jd�dS)Nz	Function r/Fr�z    ncalls  tottime  cumtime)	r?�ljustr#r:r�next�iterrBrt)
r)�	name_sizeZcolumn_titleZ	subheaderrQrRrSrTrUrrrrr��s
zStats.print_call_heading�->cCstt|��|�|d|jd�|s2t|jd�dSt|���}d}|D]�}t|�}||}	t|	t�r�|	\}
}}}
|
|kr�d|
|f}n
d|
f}d|�dd	t	|��t
|�t
|
�|f}|d
}n$d||	t
|j|d�f}|d}t||||jd�d}qFdS)
Nr�r�r/r.z%d/%dz%dz%s %s %s  %srfrgrz	%s(%r) %sr_)r?rOr�r#�sortedr�rBrt�rjustr&�f8r:)r)r��sourceZ	call_dictZarrowZclistr�rPr
rrRrQrSrTZsubstatsZ
left_widthrrrr��s0

�
zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz-   ncalls  tottime  percall  cumtime  percallr�r�zfilename:lineno(function)r/�r?r#rxrrrr��szStats.print_titlecCs�|j|\}}}}}t|�}||kr4|dt|�}t|�d�d|jd�tt|�d|jd�|dkrxtdd|jd�ntt||�d|jd�tt|�d|jd�|dkr�tdd|jd�ntt||�d|jd�tt|�|jd�dS)N�/�	r�r�rr�r/)r:rr?r�r#r�rO)r)rPrQrRrSrTrU�crrrr��szStats.print_line)r�)rr r!r,r'r<r=r(r^rhrlruryr}r~r�r�r�r�r�r�r�r�r�rrrrr7sD"

�'
c@seZdZdd�Zdd�ZdS)rrcCs
||_dSrv��comp_select_list)r)r�rrrr,�szTupleComp.__init__cCsF|jD]:\}}||}||}||kr0|S||kr|SqdSrVr�)r)�left�right�index�	direction�l�rrrrrs�s

zTupleComp.compareN)rr r!r,rsrrrrrr�srrcCs|\}}}tj�|�||fSrv)rF�path�basename)�	func_namer
rr
rrrrz�s
rzcCs|dS)Nrgr)rPrrrr��sr�cCsN|dd�dkrB|d}|�d�r<|�d�r<d|dd�S|Snd|SdS)	Nrg)�~r�<�>z{%s}rr-z	%s:%d(%s))�
startswith�endswith)r�r
rrrrO�srOcCs@|\}}}}}|\}}}	}
}||||||	||
t||�fSrv)�add_callers)�targetr�rQrRrSrTrUZt_ccZt_ncZt_ttZt_ctZ	t_callersrrrrYs
�rYcCs�i}|��D]\}}|||<q|��D]V\}}||krtt|t�rbtdd�t|||�D��||<q||||7<q&|||<q&|S)Ncss|]\}}||VqdSrvr)�.0�i�jrrr�	<genexpr>szadd_callers.<locals>.<genexpr>)rNrBrt�zip)r�r�Znew_callersrPr|rrrr�s

"
r�cCsd}|��D]}||7}q|SrV)r)rUrRrrrr�count_callss
r�cCsd|S)Nz%8.3fr)�xrrrr�(sr��__main__c@s�eZdZd6dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7�ProfileBrowserNcCs6tj�|�d|_d|_tj|_|dk	r2|�|�dS)N�% )	�cmd�Cmdr,�promptr:r$r%r#�do_read)r)�profilerrrr,7szProfileBrowser.__init__c	Cs�|��}g}|D]�}z|�t|��WqWntk
r>YnXz<t|�}|dksZ|dkrltd|jd�Wq|�|�WqWntk
r�YnX|�|�q|jr�t|j|�|�ntd|jd�dS)Nrrz#Fraction argument must be in [0, 1]r/�No statistics object is loaded.)	�splitrprn�
ValueErrorr�r?r#r:�getattr)r)�fnrr*Z	processedZtermZfracrrr�generic?s,
zProfileBrowser.genericcCsXtd|jd�td|jd�td|jd�td|jd�td|jd�td|jd�dS)NzArguments may be:r/z0* An integer maximum number of entries to print.z:* A decimal fractional number between 0 and 1, controllingz-  what fraction of selected entries to print.z8* A regular expression; only entries with function namesz  that match it are printed.r�rxrrr�generic_helpWszProfileBrowser.generic_helpc
Csd|jrRz|j�|�Wq`tk
rN}ztd||f|jd�W5d}~XYq`Xntd|jd�dS)Nz$Failed to load statistics for %s: %sr/r�r)r:r(�OSErrorr?r#)r)r�errr�do_add_s*zProfileBrowser.do_addcCstd|jd�dS)Nz>Add profile info from given file to current statistics object.r/r�rxrrr�help_addhszProfileBrowser.help_addcCs|�d|�S)Nr��r��r)rrrr�
do_calleeskszProfileBrowser.do_calleescCstd|jd�|��dS)Nz6Print callees statistics from the current stat object.r/�r?r#r�rxrrr�help_calleesmszProfileBrowser.help_calleescCs|�d|�S)Nr�r�r�rrr�
do_callersqszProfileBrowser.do_callerscCstd|jd�|��dS)Nz6Print callers statistics from the current stat object.r/r�rxrrr�help_callerssszProfileBrowser.help_callerscCstd|jd�dS)Nr.r/rr�r�rrr�do_EOFwszProfileBrowser.do_EOFcCstd|jd�dS�NzLeave the profile browser.r/r�rxrrr�help_EOFzszProfileBrowser.help_EOFcCsdS)Nrrr�rrr�do_quit}szProfileBrowser.do_quitcCstd|jd�dSr�r�rxrrr�	help_quitszProfileBrowser.help_quitc
Cs�|r�zt|�|_Wnztk
rN}zt|jd|jd�WY�dSd}~XYn@tk
r�}z"t|jjd||jd�WY�dSd}~XYnX|d|_	n6t
|j	�dkr�|j	dd�}|�|�ntd|jd�dS)	Nrr/�:r�rg���z1No statistics object is current -- cannot reload.r)rr:r�r?r*r#r>rLrr�r&r�)r)r�errrrrr��szProfileBrowser.do_readcCs td|jd�td|jd�dS)Nz+Read in profile data from a specified file.r/z*Without argument, reload the current file.r�rxrrr�	help_read�szProfileBrowser.help_readcCs$|jr|j��ntd|jd�dS)Nr�r/r)r:ryr?r#r�rrr�
do_reverse�szProfileBrowser.do_reversecCstd|jd�dS)Nz/Reverse the sort order of the profiling report.r/r�rxrrr�help_reverse�szProfileBrowser.help_reversecs�|jstd|jd�dS|j���|rRt�fdd�|��D��rR|jj|���n<td|jd�tj�	�D]"\}}td||df|jd�qjdS)	Nr�r/c3s|]}|�kVqdSrvr)r�r��Zabbrevsrrr��sz)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
r:r?r#rl�allr�rurrhrN)r)rrmrrr�r�do_sort�s
zProfileBrowser.do_sortcCs td|jd�td|jd�dS)Nz.Sort profile data according to specified keys.r/z3(Typing `sort' without arguments lists valid keys.)r�rxrrr�	help_sort�szProfileBrowser.help_sortcs�fdd�tjD�S)Ncsg|]}|���r|�qSr)r�)r��a��textrr�
<listcomp>�s
z0ProfileBrowser.complete_sort.<locals>.<listcomp>)rrh)r)r�r*rr�r�
complete_sort�szProfileBrowser.complete_sortcCs|�d|�S)Nr�r�r�rrr�do_stats�szProfileBrowser.do_statscCstd|jd�|��dS)Nz.Print statistics from the current stat object.r/r�rxrrr�
help_stats�szProfileBrowser.help_statscCs$|jr|j��ntd|jd�dS)Nr�r/)r:r}r?r#r�rrr�do_strip�szProfileBrowser.do_stripcCstd|jd�dS)Nz<Strip leading path information from filenames in the report.r/r�rxrrr�
help_strip�szProfileBrowser.help_stripcCstd|jd�dS)NzShow help for a given command.r/r�rxrrr�	help_help�szProfileBrowser.help_helpcCs|r|SdSrvr)r)�stoprrrr�postcmd�szProfileBrowser.postcmd)N)rr r!r,r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�6s4
	r�rrgz*Welcome to the profile statistics browser.r/zGoodbye.)%r$rFrrDr�enumr�	functoolsr�__all__rrrrrrzr�rOrYr�r�r�rr��readline�ImportErrorr�r�r&�argvZinitprofileZbrowserr�r�r?r#Zcmdloop�KeyboardInterruptrrrr�<module>sP 


?>