Your IP : 3.142.195.79


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/profile.cpython-312.opt-1.pyc

�

�Q�fBZ���dZddlZddlZddlZddlZddlZgd�ZGd�d�Zdd�Z	dd�Z
Gd�d	�Zd
�Ze
dk(re�yy)
z Class for profiling Python code.�N)�run�runctx�Profilec�(�eZdZdZd�Zd�Zd�Zd�Zy)�_Utilsz�Support class for utility functions which are shared by
    profile.py and cProfile.py modules.
    Not supposed to be used directly.
    c��||_y�N)�profiler)�selfr
s  �./opt/alt/python312/lib64/python3.12/profile.py�__init__z_Utils.__init__1s	�� ��
�c��|j�}	|j|�|j|||�y#t$rY�wxYw#|j|||�wxYwr	)r
r�
SystemExit�_show)r�	statement�filename�sort�profs     rrz
_Utils.run4sW���}�}���	-��H�H�Y��
�J�J�t�X�t�,���	��	��
�J�J�t�X�t�,�s!�7�	A�A�A�A�Ac��|j�}	|j|||�|j|||�y#t$rY�wxYw#|j|||�wxYwr	)r
rrr)rr�globals�localsrrrs       rrz
_Utils.runctx=s[���}�}���	-��K�K�	�7�F�3�
�J�J�t�X�t�,���	��	��
�J�J�t�X�t�,�s!�9�	A�A�A�A�Ac�N�|�|j|�y|j|�yr	)�
dump_stats�print_stats)rrrrs    rrz_Utils._showFs"�����O�O�H�%����T�"rN)�__name__�
__module__�__qualname__�__doc__r
rrr�rrrr+s���
!�-�-�#rrc�B�tt�j|||�S)aRun statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    )rrr)rrrs   rrrRs���'�?���y�(�D�9�9rc�F�tt�j|||||�S)z�Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    )rrr)rrrrrs     rrr_s!���'�?�!�!�)�W�f�h��M�Mrc���eZdZdZdZdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
ee
e
ee
e
d
�Zd�ZGd�d�ZGd�d�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd d�Zd�Zy)!raProfiler class.

    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.

    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).

    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:

    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    rNc��i|_d|_d|_d|_|�|j}||_|s.t
jx|_|_|j|_
n\||_|j�}	t|�}|dk(r|j|_
n|j|_
|tfd�}||_|j�|_|j#d�y#t$r||_|j|_
Y�JwxYw)N��c��||��Sr	r )�timer�sums  r�get_time_timerz(Profile.__init__.<locals>.get_time_timer�s���u�w�<�'rr
)�timings�cur�cmd�c_func_name�bias�time�process_timer(�get_time�trace_dispatch_i�
dispatcher�len�trace_dispatch�trace_dispatch_lr)�	TypeError�t�
simulate_call)rr(r/r9�lengthr*s      rr
zProfile.__init__�s����������������<��9�9�D���	��)-�):�):�:�D�J���"�3�3�D�O��D�J��
�
��A�
/��Q���
�Q�;�&*�&9�&9�D�O�&*�&;�&;�D�O�*/�C�(� .��
����������:�&��#�
8� %��
�"&�"7�"7���
8�s�:C%�%!D	�D	c�2�|j}|�}|d|dz|jz
|jz
}|dk(r|j|_|j
||||�r|�}|d|dz|_y|�}|d|dz|z
|_y)Nr��c_call�r(r9r/rr.�dispatch)r�frame�event�argr(r9�rs       rr6zProfile.trace_dispatch�s����
�
���G��
�a�D�1�Q�4�K�$�&�&� �4�9�9�,���H��"�|�|�D���4�=�=����e�A�.���A��q�T�A�a�D�[�D�F���A��q�T�A�a�D�[�1�_�D�Frc���|j}|�|jz
|jz
}|dk(r|j|_|j
||||�r
|�|_y|�|z
|_y�Nr>r?�rrArBrCr(r9s      rr3zProfile.trace_dispatch_i�se���
�
���G�d�f�f��t�y�y�(���H��"�|�|�D���4�=�=����e�Q�/��W�D�F��W�q�[�D�Frc��|j}|�dz|jz
|jz
}|dk(r|j|_|j
||||�r|�dz|_y|�dz|z
|_y)NgN@r>r?rGs      r�trace_dispatch_maczProfile.trace_dispatch_mac�sr���
�
���G�D�L�4�6�6�!�D�I�I�-���H��"�|�|�D���4�=�=����e�Q�/��W�T�\�D�F��W�T�\�A�%�D�Frc���|j}|�|jz
|jz
}|dk(r|j|_|j
||||�r
|�|_y|�|z
|_yrF)r2r9r/rr.r@)rrArBrCr2r9s      rr7zProfile.trace_dispatch_l�se���=�=���J�����$�)�)�+���H��"�|�|�D���4�=�=����e�Q�/��Z�D�F��Z�!�^�D�Frc�z�|j\}}}}}}||ur|r|j||�S|||z||||f|_y�Nr=)r,�trace_dispatch_return)	rrAr9�rpt�rit�ret�rfn�rframe�rcurs	         r�trace_dispatch_exceptionz Profile.trace_dispatch_exception�sP��+/�8�8�(��S�#�s�F�D��%��T��-�-�f�a�8�8���A��s�C���5���rc���|jrZ|j|jdur?|j\}}}}}}t|tj�s|j|d�|j}	|	j|	j|	jf}
|dd|
||jf|_|j}|
|vr||
\}}
}}}||
dz|||f||
<yddddif||
<y�N���rr=)r,�f_back�
isinstancer�
fake_framerM�f_code�co_filename�co_firstlineno�co_namer+)rrAr9rNrOrPrQrRrS�fcode�fnr+�cc�ns�tt�ct�callerss                 r�trace_dispatch_callzProfile.trace_dispatch_calls����8�8����D�H�H�R�L�8�/3�x�x�,�C��c�3����f�g�&8�&8�9��*�*�6�1�5���������!5�!5�u�}�}�
E���q�!�R�����1����,�,��
��=�&-�b�k�#�B��B��G��b�1�f�b�"�g�5�G�B�K���Q��1�b�.�G�B�K�rc��dd|jf}|dd|||jf|_|j}||vr||\}}}}}	||dz|||	f||<yddddif||<y)Nr%rr=)r.r,r+)
rrAr9r`r+rarbrcrdres
          r�trace_dispatch_c_callzProfile.trace_dispatch_c_calls����!�T�%�%�
&���q�!�R�����1����,�,��
��=�&-�b�k�#�B��B��G��b��d�B��G�3�G�B�K���Q��1�b�.�G�B�K�rc�f�||jdur|j|jdd�|j\}}}}}}||z}||z}|\}	}
}}}
}|	|
|z||z||
|f|_|j}||\}}}}}|s
||z}|dz}||vr||dz||<nd||<||dz
||z||f||<yrV)r,rMr+)rrAr9rNrOrPrQrS�frame_total�ppt�pit�pet�pfn�pframe�pcurr+rarbrcrdres                     rrMzProfile.trace_dispatch_return#s���������$��&�&�t�x�x��|�Q�7�
+/�(�(�'��S�#�s�E�4��A�g���C�i��+/�(��S�#�s�F�D���c�	�3��#4�c�6�4�G����,�,��")�#�,���B��B���
�k�!�B��a��B��'�>�"�3�<�!�+�G�C�L�
�G�C�L��2��6�2��8�R��8����r)�call�	exception�returnr>�c_exception�c_returnc�T�|jdry||_|j|�y�N���)r,r-r:)rr-s  r�set_cmdzProfile.set_cmdYs$���8�8�B�<��������3�rc��eZdZd�Zd�Zy)�Profile.fake_codec�<�||_||_||_d|_y�Nr)r\�co_liner^r])rr�line�names    rr
zProfile.fake_code.__init___s ��'�D���D�L��D�L�"#�D�rc�Z�t|j|j|jf�Sr	)�reprr\r~r^�rs r�__repr__zProfile.fake_code.__repr__es"����)�)�4�<�<����F�G�GrN)rrrr
r�r rr�	fake_coder{^s
��	$�	Hrr�c��eZdZd�Zy)�Profile.fake_framec� �||_||_yr	)r[rX)r�code�priors   rr
zProfile.fake_frame.__init__is���D�K��D�KrN)rrrr
r rrrZr�hs��	 rrZc��|jdd|�}|jr|jd}nd}|j||�}|jd||d�y)N�profilerrWrq)r�r,rZr@)rr�r�rorAs     rr:zProfile.simulate_callmsT���~�~�i��D�1���8�8��X�X�b�\�F��F�����f�-����
�
�f��d�E�1�-rc���|j}|�|jz
}|jdr6|jd||jd|�d}|jdr�6|�|z
|_y)NrxrsrWr)r2r9r,r@)rr2r9s   r�simulate_cmd_completezProfile.simulate_cmd_completeysh���=�=���J�������h�h�r�l�
$�D�M�M�(�#�D�$�(�(�2�,��:��A�	�h�h�r�l�
��a���rc��ddl}|j|�j�j|�j	�yr})�pstats�Stats�
strip_dirs�
sort_statsr)rrr�s   rrzProfile.print_stats�s,������T��%�%�'�2�2�4�8��+�-rc��t|d�5}|j�tj|j|�ddd�y#1swYyxYw)N�wb)�open�create_stats�marshal�dump�stats)r�file�fs   rrzProfile.dump_stats�s8��
�$��
�������L�L����Q�'��
�
�s�1A�Ac�D�|j�|j�yr	)r��snapshot_statsr�s rr�zProfile.create_stats�s���"�"�$����rc���i|_|jj�D]K\}\}}}}}|j�}d}|j	�D]}||z
}�	|||||f|j|<�Myr})r�r+�items�copy�values)	r�funcrarbrcrdre�nc�callcnts	         rr�zProfile.snapshot_stats�st����
�/3�|�|�/A�/A�/C�+�D�+�2�r�2�r�7��l�l�n�G��B�"�>�>�+���g�
��,�!�2�r�2�w�6�D�J�J�t��0Drc�H�ddl}|j}|j|||�Sr})�__main__�__dict__r)rr-r��dicts    rrzProfile.run�s#���� � ���{�{�3��d�+�+rc���|j|�tj|j�	t	|||�tjd�|S#tjd�wxYwr	)ry�sys�
setprofiler4�exec)rr-rrs    rrzProfile.runctx�sP�����S�����t���'�	!���g�v�&��N�N�4� ����
�N�N�4� �s�
A�A-c���|jt|��tj|j�	||i|��tjd�S#tjd�wxYwr	)ryr�r�r�r4)rr��args�kws    r�runcallzProfile.runcall�sM�����T�$�Z� ����t���'�	!���$��$��N�N�4� ��C�N�N�4� �s�A�A/c��|jturtd��|j}d|_	|j	||�||_S#||_wxYw)Nz&Subclasses must override .calibrate().r)�	__class__rr8r/�_calibrate_inner)r�m�verbose�
saved_biass    r�	calibratezProfile.calibrate�sN���>�>��(��D�E�E��Y�Y�
���	�	#��(�(��G�4�"�D�I��
�D�I�s�A�	Ac�<�|j}d�}|fd�}||�|�}||�|�}||z
}|rtd|�t�}	|�}|	jdt	�t��|�}||z
}
|rtd|
�d}d}|	jj�D]\\}
}}\}}}}}|dvs�||z
}||z
}� |rtd|�td	|�||d
zk7rtd|z��||z
dz|z}|rtd
|�|S)Nc�(�t|�D]}d}�yrL��range)�n�i�xs   r�f1z$Profile._calibrate_inner.<locals>.f1�s���1�X����rc�4�t|�D]
}|d��y)N�dr�)r�r�r�s   rr�z#Profile._calibrate_inner.<locals>.f�s���1�X���3��rz elapsed time without profiling =zf(m)zelapsed time with profiling =g)r�r�z!'CPU seconds' profiler reported =ztotal # calls =r=z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)	r2�printrrrrr+r��
ValueError)rr�r�r2r�r��t0�t1�elapsed_noprofile�p�elapsed_profile�total_calls�
reported_timerr�funcnamerarbrcrdre�means                      rr�zProfile._calibrate_inner�sN���=�=��	��	�	
�!���Z��	�!��
�Z����G����4�6G�H�

�I��
�Z��	������F�H�-�
�Z���r�'����1�?�C����
��	�	���!�
B�&�X�t�X�(A��R��R���;�&��r�!����#�
�"�
��5�}�E��#�[�1��!�a�%���?�+�M�N�N�� 1�1�S�8�;�F����?��F��r)NN)rx)r)rrrrr/r
r6r3rIr7rTrfrhrMr@ryr�rZr:r�rrr�r�rrr�r�r�r rrrrhs���$�L
�D�#'�N
%�$
!�
&�
$�&��,	�#�N$�-�'�'�,�)�

�H�  �
H�H� � �
.� � �
(�
�7�,�
�!�b	#�<rrc���ddl}ddlm}d}||��}d|_|j	dddd	d�
�|j	ddd
dd��|j	ddddd�
�t
jdds%|j�tjd�|j�\}}|t
jdd|j�*|jj|j�|_
t|�dkD�r|jrddl}d}|j |dd�}n�|d}	t
jj#d|jj%|	��t'j(|	�5}
t+|
j-�|	d�}ddd�t.j0j3dd|	��}||j4|j6ddd�}	t9|d|j|j:�|S|j�|S#1swY�xYw#t<$r5}dt
_tj|j@�Yd}~|Sd}~wwxYw)Nr)�OptionParserzMprofile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-m�module�
store_truezProfile a library module.)r��actionr�r�z-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrxr=r&z(run_module(modname, run_name='__main__'))�
run_module�modnamer�r�)r��loader�origin)�__spec__�__file__r�__package__�
__cached__)!�os�optparser��allow_interspersed_args�
add_optionr��argv�print_usage�exit�
parse_argsr��path�abspathr5r��runpyr��insert�dirname�io�	open_code�compile�read�	importlib�	machinery�
ModuleSpecr�r�rr�BrokenPipeError�stdout�errno)
r�r�r��parser�optionsr�r�r��globs�progname�fp�spec�excs
             r�mainr�*s��
�%�[�E�
��
&�F�%*�F�"�
���d�K�i�
&���6�
���d��,�
(�%��9�
���d�H�6�
N�����8�8�A�B�<�����������'�'�)�O�W�d��C�H�H�Q�K����"��'�'�/�/�'�/�/�:���
�4�y�1�}��>�>��=�D�#�.�.���7��E�
�A�w�H��H�H�O�O�A�r�w�w���x�8�9����h�'�2��r�w�w�y�(�F�;��(��&�&�1�1�z�$�9A�2�C�D�!� �K�K� �I�I�#�"��E�	 ��4���g�o�o�w�|�|�D��M�	�����M�'(�'���	 ��C�J��H�H�S�Y�Y����M��
	 �s$�:H�#H �H� 	I�)*I�Ir�rw)r�importlib.machineryr�r�r�r0r��__all__rrrrr�rr rr�<module>rs]��'�$�	�
���
&��#�#�N:�N�~�~�D9�x�z���F�r

?>