Hacked By AnonymousFox

Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/profile.cpython-311.opt-1.pyc

�

c��fpY���dZddlZddlZddlZddlZgd�ZGd�d��Zd
d�Zd
d�ZGd	�d
��Z	d�Z
edkre
��dSdS)z Class for profiling Python code.�N)�run�runctx�Profilec�*�eZdZdZd�Zd�Zd�Zd�ZdS)�_Utilsz�Support class for utility functions which are shared by
    profile.py and cProfile.py modules.
    Not supposed to be used directly.
    c��||_dS�N)�profiler)�selfr
s  �./opt/alt/python311/lib64/python3.11/profile.py�__init__z_Utils.__init__0s
�� ��
�
�
�c���|���}	|�|��n#t$rYnwxYw|�|||��dS#|�|||��wxYwr	)r
r�
SystemExit�_show)r�	statement�filename�sort�profs     rrz
_Utils.run3s����}�}����	-��H�H�Y�������	�	�	��D�	����
�J�J�t�X�t�,�,�,�,�,��D�J�J�t�X�t�,�,�,�,���s!�,�A�
9�A�9�A�A.c���|���}	|�|||��n#t$rYnwxYw|�|||��dS#|�|||��wxYwr	)r
rrr)rr�globals�localsrrrs       rrz
_Utils.runctx<s����}�}����	-��K�K�	�7�F�3�3�3�3���	�	�	��D�	����
�J�J�t�X�t�,�,�,�,�,��D�J�J�t�X�t�,�,�,�,���s!�.�A�
;�A�;�A�A0c�b�|�|�|��dS|�|��dSr	)�
dump_stats�print_stats)rrrrs    rrz_Utils._showEs:�����O�O�H�%�%�%�%�%����T�"�"�"�"�"rN)�__name__�
__module__�__qualname__�__doc__r
rrr�rrrr*sZ��������
!�!�!�-�-�-�-�-�-�#�#�#�#�#rr���c�T�tt���|||��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rrQs"���'�?�?���y�(�D�9�9�9rc�X�tt���|||||��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�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�Zd d�Zd�Zd�Zd�Zd�Zd�Zd�Zd!d�Zd�ZdS)"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
jx|_|_|j	|_
n�||_|���}	t|��}|dkr
|j|_
n|j
|_
|tfd�}||_n##t$r||_|j	|_
YnwxYw|���|_|�d��dS)N��c�(�||����Sr	r )�timer�sums  r�get_time_timerz(Profile.__init__.<locals>.get_time_timer�s���3�u�u�w�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)r0r:�lengthr+s      rr
zProfile.__init__�s���������������<��9�D���	��	/�)-�):�:�D�J���"�3�D�O�O��D�J��
�
���A�
/��Q����
�Q�;�;�&*�&9�D�O�O�&*�&;�D�O�*/�C�(�(�(�(� .��
�
���
8�
8�
8� %��
�"&�"7�����
8���� ����������:�&�&�&�&�&s�0B1�1C�Cc�H�|j}|��}|d|dz|jz
|jz
}|dkr|j|_|j||||��r"|��}|d|dz|_dS|��}|d|dz|z
|_dS)Nr��c_call�r)r:r0rr/�dispatch)r�frame�event�argr)r:�rs       rr7zProfile.trace_dispatch�s����
���E�G�G��
�a�D�1�Q�4�K�$�&� �4�9�,���H���"�|�D���4�=����e�A�.�.�	%�����A��q�T�A�a�D�[�D�F�F�F�����A��q�T�A�a�D�[�1�_�D�F�F�Frc���|j}|��|jz
|jz
}|dkr|j|_|j||||��r|��|_dS|��|z
|_dS�Nr?r@�rrBrCrDr)r:s      rr4zProfile.trace_dispatch_i�sz���
���E�G�G�d�f��t�y�(���H���"�|�D���4�=����e�Q�/�/�	!��U�W�W�D�F�F�F��U�W�W�q�[�D�F�F�Frc���|j}|��dz|jz
|jz
}|dkr|j|_|j||||��r|��dz|_dS|��dz|z
|_dS)NgN@r?r@rHs      r�trace_dispatch_maczProfile.trace_dispatch_mac�s����
���E�G�G�D�L�4�6�!�D�I�-���H���"�|�D���4�=����e�Q�/�/�	&��U�W�W�T�\�D�F�F�F��U�W�W�T�\�A�%�D�F�F�Frc���|j}|��|jz
|jz
}|dkr|j|_|j||||��r|��|_dS|��|z
|_dSrG)r3r:r0rr/rA)rrBrCrDr3r:s      rr8zProfile.trace_dispatch_l�sz���=���H�J�J����$�)�+���H���"�|�D���4�=����e�Q�/�/�	$��X�Z�Z�D�F�F�F��X�Z�Z�!�^�D�F�F�Frc�z�|j\}}}}}}||ur|r|�||��S|||z||||f|_dS�Nr>)r-�trace_dispatch_return)	rrBr:�rpt�rit�ret�rfn�rframe�rcurs	         r�trace_dispatch_exceptionz Profile.trace_dispatch_exception�sY��+/�8�(��S�#�s�F�D��%���T���-�-�f�a�8�8�8���A��s�C���5����qrc�t�|jrR|j|jdur>|j\}}}}}}t|tj��s|�|d��|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|vr||
\}}
}}}||
dz|||f||
<n
ddddif||
<dS�N���rr>)r-�f_back�
isinstancer�
fake_framerN�f_code�co_filename�co_firstlineno�co_namer,)rrBr:rOrPrQrRrSrT�fcode�fnr,�cc�ns�tt�ct�callerss                 r�trace_dispatch_callzProfile.trace_dispatch_calls����8�		F���D�H�R�L�8�8�/3�x�,�C��c�3����f�g�&8�9�9�
F��*�*�6�1�5�5�5�������!5�u�}�
E���q�!�R����1����,��
��=�=�&-�b�k�#�B��B��G��b�1�f�b�"�g�5�G�B�K�K��Q��1�b�.�G�B�K��qrc��dd|jf}|dd|||jf|_|j}||vr||\}}}}}	||dz|||	f||<n
ddddif||<dS)Nr&rr>)r/r-r,)
rrBr:rar,rbrcrdrerfs
          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�K��Q��1�b�.�G�B�K��qrc�`�||jdur!|�|jdd��|j\}}}}}}||z}||z}|\}	}
}}}
}|	|
|z||z||
|f|_|j}||\}}}}}|s
||z}|dz}||vr||dz||<nd||<||dz
||z||f||<dSrW)r-rNr,)rrBr:rOrPrQrRrT�frame_total�ppt�pit�pet�pfn�pframe�pcurr,rbrcrdrerfs                     rrNzProfile.trace_dispatch_return"s�������$�$��&�&�t�x��|�Q�7�7�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�L�
�G�C�L��2��6�2��8�R��8�����qr)�call�	exception�returnr?�c_exception�c_returnc�\�|jdrdS||_|�|��dS�Nr!)r-r.r;)rr.s  r�set_cmdzProfile.set_cmdXs3���8�B�<����������3�����rc��eZdZd�Zd�ZdS)�Profile.fake_codec�>�||_||_||_d|_dS�Nr)r]�co_liner_r^)rr�line�names    rr
zProfile.fake_code.__init__^s&��'�D���D�L��D�L�"#�D���rc�D�t|j|j|jf��Sr	)�reprr]r~r_�rs r�__repr__zProfile.fake_code.__repr__ds����)�4�<���F�G�G�GrN)rrrr
r�r rr�	fake_coder{]s7������	$�	$�	$�	H�	H�	H�	H�	Hrr�c��eZdZd�ZdS)�Profile.fake_framec�"�||_||_dSr	)r\rY)r�code�priors   rr
zProfile.fake_frame.__init__hs���D�K��D�K�K�KrN)rrrr
r rrr[r�gs#������	 �	 �	 �	 �	 rr[c��|�dd|��}|jr|jd}nd}|�||��}|jd||d��dS)N�profilerrXrr)r�r-r[rA)rr�r�rprBs     rr;zProfile.simulate_calllsg���~�~�i��D�1�1���8�	��X�b�\�F�F��F�����f�-�-����
�f��d�E�1�-�-�-�-�-rc���|j}|��|jz
}|jdr2|jd||jd|��d}|jd�2|��|z
|_dS)Nr!rtrXr)r3r:r-rA)rr3r:s   r�simulate_cmd_completezProfile.simulate_cmd_completexsx���=���H�J�J������h�r�l�	�
$�D�M�(�#�D�$�(�2�,��:�:�:��A�	�h�r�l�	�
����a�����rr!c��ddl}|�|������|�����dSr})�pstats�Stats�
strip_dirs�
sort_statsr)rrr�s   rrzProfile.print_stats�sC���
�
�
����T���%�%�'�'�2�2�4�8�8��+�-�-�-�-�-rc��t|d��5}|���tj|j|��ddd��dS#1swxYwYdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fs   rrzProfile.dump_stats�s���
�$��
�
�	(���������L���Q�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s�/A
�
A�Ac�V�|���|���dSr	)r��snapshot_statsr�s rr�zProfile.create_stats�s,���"�"�$�$�$��������rc���i|_|j���D]L\}\}}}}}|���}d}|���D]}||z
}�|||||f|j|<�MdSr})r�r,�items�copy�values)	r�funcrbrcrdrerf�nc�callcnts	         rr�zProfile.snapshot_stats�s�����
�/3�|�/A�/A�/C�/C�	7�	7�+�D�+�2�r�2�r�7��l�l�n�n�G��B�"�>�>�+�+�
�
���g�
���!�2�r�2�w�6�D�J�t���	7�	7rc�F�ddl}|j}|�|||��Sr})�__main__�__dict__r)rr.r��dicts    rrzProfile.run�s)������� ���{�{�3��d�+�+�+rc���|�|��tj|j��	t	|||��tjd��n#tjd��wxYw|Sr	)ry�sys�
setprofiler5�exec)rr.rrs    rrzProfile.runctx�sk�����S������t��'�'�'�	!���g�v�&�&�&��N�4� � � � ��C�N�4� � � � �����s�A�A,c���|�t|����tj|j��	||i|��tjd��S#tjd��wxYwr	)ryr�r�r�r5)rr��args�kws    r�runcallzProfile.runcall�sl�����T�$�Z�Z� � � ���t��'�'�'�	!��4��$��$�$��N�4� � � � ��C�N�4� � � � ���s�A�A/c��|jturtd���|j}d|_	|�||��||_S#||_wxYw)Nz&Subclasses must override .calibrate().r)�	__class__rr9r0�_calibrate_inner)r�m�verbose�
saved_biass    r�	calibratezProfile.calibrate�s`���>��(�(��D�E�E�E��Y�
���	�	#��(�(��G�4�4�"�D�I�I��
�D�I�"�"�"�"s�A
�
	Ac��|j}d�}|fd�}||��|��}||��|��}||z
}|rtd|��t��}	|��}|	�dt	��t����|��}||z
}
|rtd|
��d}d}|	j���D]\\}
}}\}}}}}|dvr
||z
}||z
}�|r td|��td	|��||d
zkrtd|z���||z
dz|z}|rtd
|��|S)Nc�.�t|��D]}d}�dSrM��range)�n�i�xs   r�f1z$Profile._calibrate_inner.<locals>.f1�s(���1�X�X�
�
�����
�
rc�@�t|��D]
}|d���dS)N�dr�)r�r�r�s   rr�z#Profile._calibrate_inner.<locals>.f�s0���1�X�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 =)	r3�printrrrrr,r��
ValueError)rr�r�r3r�r��t0�t1�elapsed_noprofile�p�elapsed_profile�total_calls�
reported_timerr�funcnamerbrcrdrerf�means                      rr�zProfile._calibrate_inner�s����=��	�	�	��	�	�	�	�	
��!�����X�Z�Z��	��!����
�X�Z�Z����G���	I��4�6G�H�H�H�

�I�I��
�X�Z�Z��	�������F�H�H�-�-�-�
�X�Z�Z���r�'���	D��1�?�C�C�C����
��	���!�!�	$�	$�A�&�X�t�X�(A��R��R���;�&�&��r�!����#�
���	2��5�}�E�E�E��#�[�1�1�1��!�a�%����?�+�M�N�N�N�� 1�1�S�8�;�F���	G��?��F�F�F��r)NN)r!)r)rrrrr0r
r7r4rJr8rUrgrirNrAryr�r[r;r�rrr�r�rrr�r�r�r rrrrgs�������$�$�L
�D�#'�#'�#'�#'�N
%�
%�
%�$
!�
!�
!�
&�
&�
&�
$�
$�
$�&������,	�	�	�#�#�#�N$�-�'�'�,�)�

�
�H�  � � �
H�H�H�H�H�H�H�H� � � � � � � � �
.�.�.� � � � � � � �
(�(�(�
���7�7�7�,�,�,�
���!�!�!�b	#�	#�	#�	#�<�<�<�<�<rrc�l�ddl}ddlm}d}||���}d|_|�dddd	d�
��|�ddd
dd���|�ddddd�
��t
jdd�s(|���tjd��|�	��\}}|t
jdd�<|j
�$|j�|j
��|_
t|��dk�r|jrddl}d}|j|dd�}n�|d}	t
j�d|j�|	����t'j|	��5}
t+|
���|	d��}ddd��n#1swxYwY|	dddd�}	t/||d|j
|j��nP#t2$r/}dt
_tj|j��Yd}~nd}~wwxYw|���|S)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 classr!r>r'z(run_module(modname, run_name='__main__'))�
run_module�modnamer�r�)�__file__r�__package__�
__cached__)�os�optparser��allow_interspersed_args�
add_optionr��argv�print_usage�exit�
parse_argsr��path�abspathr6r��runpyr��insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)r�r�r��parser�optionsr�r�r��globs�progname�fp�excs            r�mainr�)s���
�I�I�I�%�%�%�%�%�%�[�E�
�\��
&�
&�
&�F�%*�F�"�
���d�K�i�
&���6�6�6�
���d��,�
(�%��9�9�9�
���d�H�6�
N�������8�A�B�B�<���������������'�'�)�)�O�W�d��C�H�Q�Q�Q�K���"��'�/�/�'�/�:�:���
�4�y�y�1�}�}��>�	��L�L�L�=�D�#�.���7���E�E�
�A�w�H��H�O�O�A�r�w���x�8�8�9�9�9���h�'�'�
<�2��r�w�w�y�y�(�F�;�;��
<�
<�
<�
<�
<�
<�
<�
<�
<�
<�
<����
<�
<�
<�
<�%�&�#�"�	��E�	 ��4���g�o�w�|�D�D�D�D���	 �	 �	 ��C�J��H�S�Y�������������	 ����
	�������Ms*�$F3�3F7�:F7�G$�$
H�.%H�Hr�rx)rr�r�r1r��__all__rrrrr�rr rr�<module>r�s���'�&�$
�	�	�	�
�
�
�
���������
&�
&�
&��#�#�#�#�#�#�#�#�N:�:�:�:�N�N�N�N�~�~�~�~�~�~�~�~�D6�6�6�r�z����D�F�F�F�F�F��r

Hacked By AnonymousFox1.0, Coded By AnonymousFox