ROOTPLOIT
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: ws67150586 (67150586)
PHP: 8.3.36
Disabled: NONE
Upload Files
File: //kunden/kunden/kunden/lib/python3/dist-packages/mercurial/__pycache__/statprof.cpython-313.pyc
�

6�hY���@�SrSSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK
Jr SSKJrJr \R$r\R&r/SQr1SkrS	r"S
S5r\"5r"SS
5r"SS5rSr\R8"5rSrSrSq S)Sjr!Sr"Sr#Sr$S*Sjr%\S5r&"SS5r'"SS5r(S+Sjr)Sr*Sr+S*S jr,S,S!jr-S-S"jr.0r/S#r0S$r1S.S%jr2S&r3S*S'jr4\5S(:Xa\
Rl"\4"55 gg)/a�

statprof is intended to be a fairly simple statistical profiler for
python. It was ported directly from a statistical profiler for guile,
also named statprof, available from guile-lib [0].

[0] http://wingolog.org/software/guile-lib/statprof/

To start profiling, call statprof.start():
>>> start()

Then run whatever it is that you want to profile, for example:
>>> import test.pystone; test.pystone.pystones()

Then stop the profiling and print out the results:
>>> stop()
>>> display()
  %   cumulative      self
 time    seconds   seconds  name
 26.72      1.40      0.37  pystone.py:79:Proc0
 13.79      0.56      0.19  pystone.py:133:Proc1
 13.79      0.19      0.19  pystone.py:208:Proc8
 10.34      0.16      0.14  pystone.py:229:Func2
  6.90      0.10      0.10  pystone.py:45:__init__
  4.31      0.16      0.06  pystone.py:53:copy
    ...

All of the numerical data is statistically approximate. In the
following column descriptions, and in all of statprof, "time" refers
to execution time (both user and system), not wall clock time.

% time
    The percent of the time spent inside the procedure itself (not
    counting children).

cumulative seconds
    The total number of seconds spent in the procedure, including
    children.

self seconds
    The total number of seconds spent in the procedure itself (not
    counting children).

name
    The name of the procedure.

By default statprof keeps the data collected from previous runs. If you
want to clear the collected data, call reset():
>>> reset()

reset() can also be used to change the sampling frequency from the
default of 1000 Hz. For example, to tell statprof to sample 50 times a
second:
>>> reset(50)

This means that statprof will sample the call stack after every 1/50 of
a second of user + system time spent running on behalf of the python
process. When your process is idle (for example, blocking in a read(),
as is the case at the listener), the clock does not advance. For this
reason statprof is not currently not suitable for profiling io-bound
operations.

The profiler uses the hash of the code object itself to identify the
procedures, so it won't confuse different procedures with the same name.
They will show up as two different rows in the output.

Right now the profiler is quite simplistic.  I cannot provide
call-graphs or other higher level information.  What you see in the
table is pretty much all there is. Patches are welcome :-)


Threading
---------

Because signals only get delivered to the main thread in Python,
statprof only profiles the main thread. However because the time
reporting function uses per-process timers, the results can be
significantly off if other threads' work patterns are not similar to the
main thread's work patterns.
�)�annotationsN)�List�)�encoding�pycompat)�start�stop�reset�display�profile>�
util.py:check�hg.py:<module>�dispatch.py:run�pager.py:pagecmd�color.py:colorcmd�dispatch.py:<lambda>�dispatch.py:dispatch�dispatch.py:_dispatch�dispatch.py:_runcatch�dispatch.py:checkargs�extensions.py:closure�dispatch.py:runcommand�dispatch.py:_runcommand�evolve.py:warnobserrorsc�L�[R"5nUSUS-US4$)Nrr�)�os�times)rs �4/usr/lib/python3/dist-packages/mercurial/statprof.py�clockr �s)���H�H�J�E��!�H�u�Q�x���q��*�*�c�P�\rSrSr%S\S'SSjrSSjrSrSr\	S	5r
S
rg)�ProfileState�zList[Sample]�samplesNc�4�URU5 SUlg)N�cpu)r
�track��self�	frequencys  r�__init__�ProfileState.__init__�s���
�
�9����
r!c��SUlSUlU(aSU-UlO[US5(dSUlOSUlSUl/Ulg)N)�r/g�?�sample_interval���MbP?r)�accumulated_time�last_start_timer0�hasattr�remaining_prof_time�
profile_levelr%r)s  rr
�ProfileState.reset�sS�� *���#����#&��?�D� ���0�1�1�#/�D� �
�#'�� ������r!c��USURS-
USURS-
4nURSUS-URSUS-4Ulg�Nrr)r3r2)r*�	stop_time�	increments   r�accumulate_time�ProfileState.accumulate_time�sq���a�L�4�/�/��2�2��a�L�4�/�/��2�2�
�	�

�!�!�!�$�y��|�3��!�!�!�$�y��|�3�!
��r!c�`�URUR[UR5-$�N)r2�timeidx�lenr%�r*s r�seconds_per_sample�ProfileState.seconds_per_sample�s%���$�$�T�\�\�2�S����5F�F�Fr!c�&�URS:Xagg)Nsrealrr)r(rBs rr@�ProfileState.timeidx�s���:�:�� ��r!)r2r3r6r5r0r%r(r?)�__name__�
__module__�__qualname__�__firstlineno__�__annotations__r,r
r<rC�propertyr@�__static_attributes__�r!rr#r#�s1��
����(
�G����r!r#c�P�\rSrSr0rSrSrSrSr\	S5r
SrSrS	r
S
rg)�CodeSite��)�path�lineno�function�sourcec��[U[5(deXlX l[U[5(deX0lSUlgr?)�
isinstance�bytesrRrSrTrU)r*rRrSrTs    rr,�CodeSite.__init__�s>���$��&�&�&�&��	����(�E�*�*�*�*� �
���r!c��URUR:H=(a URUR:H$! g=f)NF)rSrR)r*�others  r�__eq__�CodeSite.__eq__�s6��	��;�;�%�,�,�.�J�4�9�9��
�
�3J�J��	��s�8;�?c�D�[URUR45$r?)�hashrSrRrBs r�__hash__�CodeSite.__hash__�s���T�[�[�$�)�)�,�-�-r!c�z�X4nURU$![a U"XU5nXPRU'Us$f=fr?)�cache�KeyError)�clsrRrSrT�k�vs      r�get�CodeSite.get�sG��
�N��	��9�9�Q�<����	��D�(�+�A��I�I�a�L��H�	�s��#:�:c��URcsURS-
n[URS5n[	U5H!upEXB:XdMUR5Ul O SSS5 URcSUlURn[
U5U:�aUSUS-
S-nU$!,(df   NJ=f! NQ=f)Nr�rbr!�s...)rUrS�openrR�	enumerate�striprA)r*�lengthrS�fp�i�linerUs       r�	getsource�CodeSite.getsource�s����;�;��
����q����$�)�)�T�*�b�#,�R�=����;�*.�*�*�,�D�K�!�$1�+��{�{�"�!��������v�;����N�v��z�+�f�4�F��
�+�*��

��s.�%B:�B)�B)�%B:�)
B7�3B:�7B:�:B>c�T�[RRUR5$r?)rrR�basenamerBs r�filename�CodeSite.filenames���w�w����	�	�*�*r!c�D�UR5<SUR<3$)N�:)rxrTrBs r�skipname�CodeSite.skipname	s���-�-�/�4�=�=�9�9r!)rTrSrRrUN)rGrHrIrJrc�	__slots__r,r\r`�classmethodrhrtrxr|rMrNr!rrPrP�s>���E�8�I���.������&+�:r!rPc�.�\rSrSrSrSr\S5rSrg)�Samplei
��stack�timec��XlX lgr?r�)r*r�r�s   rr,�Sample.__init__s���
��	r!c	�T�/nU(a�UR[R[R"UR
R5UR[R"UR
R555 URnU(aM�[X25$r?)�appendrPrhr�sysbytes�f_code�co_filename�f_lineno�co_name�f_backr�)re�framer�r�s    r�
from_frame�Sample.from_framesx������L�L�����%�%�e�l�l�&>�&>�?��N�N��%�%�e�l�l�&:�&:�;��
��L�L�E��e��e�"�"r!N)	rGrHrIrJr~r,rr�rMrNr!rr�r�
s ��!�I���
#��
#r!r�c��[RS:�a�[5n[RU5 [R[R
n[RR[RX55 [R"[R[RS5 U[lgg)Nrr/)�stater6r r<r2r@r%r�r�r��signal�	setitimer�ITIMER_PROFr0r3)�signumr��now�	timestamps    r�profile_signal_handlerr�)s������Q���g��
���c�"��*�*�5�=�=�9�	�
�
�
���V�.�.�u�@�A�����+�+�U�-B�-B�C�H� #���r!c��[R5(d�[5n[R	U5 [
R"5Un[R[Rn[RR[RX#55 U[l
[R"[R 5 [R5(dM�[R#5 gr?)�
stopthread�is_setr r�r<�sys�_current_framesr2r@r%r�r�r�r3r��sleepr0�clear)�tidr�r�r�s    r�
samplerthreadr�8s������!�!��g��
���c�"��#�#�%�c�*���*�*�5�=�=�9�	�
�
�
���V�.�.�u�@�A� #����
�
�5�(�(�)����!�!����r!c�(�[RS:�$�Nr)r�r6rNr!r�	is_activer�Ls������"�"r!c��U[l[=RS-
sl[RS:XGa>[5[l[R
nS[lUqUS:Xag[R"[R[5 [R"[RU=(d [RS5 gUS:Xa�[R"5n[R "5R#5VVs/sHupEXS:XdMUPM snnSn[$R&"[(U4SS9[l[R*R-5 gggs snnf)	z:Install the profiling signal handler, and start profiling.rN�signalr/�threadrr�)�target�args�name)r�r(r6r r3r5�
lastmechanismr��SIGPROFr�r�r�r0�inspect�currentframer�r��items�	threading�Threadr��threadr)�	mechanismr(�rptr�rf�fr�s       rrrSs���E�K�	���1������a�� %�����'�'��$(��!�"�
��	�!��M�M�&�.�.�*@�A�����"�"�C�$@�5�+@�+@�#�
��)�
#��(�(�*�E�!$�!4�!4�!6�!<�!<�!>�M�!>���!�*�1�!>�M�a�P�C�$�+�+�$�C�6���E�L�
�L�L��� �
$� ��Ns�E9�'E9c�x�[=RS-sl[RS:XGa[S:Xah[R"[R
SS5n[R"[R[R5 US[lO<[S:Xa2[R5 [RR5 [R[55 S[l[ R"R%S5nU(a['U5 [$)z;Stop profiling, and uninstall the profiling signal handler.rrr�r/r�Ns
STATPROF_DEST)r�r6r�r�r�r�r��SIG_IGNr5r��setr��joinr<r r3r�environrh�	save_data)r��statprofpaths  rr	r	ms���	���1������a���I�%��"�"�6�#5�#5�s�C�@�C��M�M�&�.�.�&�.�.�9�(+�A��E�%�
�i�
'��N�N���L�L����
���e�g�&� $����'�'�+�+�,<�=����l�#��Lr!c
���[US5nURS[R-5 [RH�nUR
nURnUVs/sHAnSRURSUR-=(d SUR/5PMC nnURSUSRU54-5 M� SSS5 gs snf!,(df   g=f)N�w+bs%f %f
�s%d���s%d%s
�)rm�writer�r2r%r�r�r�rRrSrT)rR�file�sampler�r��s�sitess       rr�r��s���	
�d�E�	�d��
�
�:�� 6� 6�6�7��m�m�F��;�;�D��L�L�E����A��
�
�A�F�F�E�A�H�H�$4�$:��A�J�J�G�H��
��
�J�J�{�d�E�J�J�u�,=�%>�>�?�$�
�	��
�
�	�s�AC �AC�'+C �C � 
C.c�p�[US5nUR5R5nSSS5 WSR5Vs/sHn[	U5PM sn[
l/[
lUSSH�nURS5n[	US5nUSSn/nUHLn	U	RS5n
UR[RU
S[U
S5U
S55 MN [
RR[X�55 M� g!,(df   N�=fs snf)Nrkrrr�r��)
rm�read�
splitlines�split�floatr�r2r%r�rPrh�intr�)rRrq�lines�valuers�partsr��rawsitesr��rawsite�	sitepartss           r�	load_datar��s���	
�d�D�	�R����	�$�$�&��
�9>�a����8H�I�8H�u�e�E�l�8H�I�E���E�M��a�b�	���
�
�5�!���U�1�X������9�����G��
�
�e�,�I��L�L����Y�q�\�3�y��|�+<�i��l�K�
� �	�
�
���V�E�0�1��
�	��Js�D"�	D3�"
D0c��[RS:XdS5e[RR	5 [RU5 g)z�Clear out the state of the profiler.  Do not call while the
profiler is running.

The optional frequency argument specifies the number of samples to
collect per second.rs'Can't reset() while statprof is runningN)r�r6rPrcr�r
)r+s rr
r
�s:�����!�#�O�%O�O�#��N�N����	�K�K�	�r!c#�# �[5 Sv� [5 [5 g![5 [5 f=f7fr?)rr	rrNr!rrr�s)���	�G��
����	��	
���	�s�A�'�A�=�Ac�N�\rSrSrSrSrSrSrSrSr	Sr
\S	5rS
r
g)�	SiteStatsi�c�,�XlSUlSUlgr�)�site�	selfcount�
totalcount�r*r�s  rr,�SiteStats.__init__�s���	������r!c�.�U=RS-
slg�Nr)r�rBs r�addself�SiteStats.addself�s�����!��r!c�.�U=RS-
slgr�)r�rBs r�addtotal�SiteStats.addtotal�s�����1��r!c�T�UR[[R5-S-$�N�d)r�rAr�r%rBs r�selfpercent�SiteStats.selfpercent�s���~�~��E�M�M� 2�2�S�8�8r!c�T�UR[[R5-S-$r�)r�rAr�r%rBs r�totalpercent�SiteStats.totalpercent�s������U�]�]�!3�3�c�9�9r!c�D�UR[R5-$r?)r�r�rCrBs r�selfseconds�SiteStats.selfseconds�s���~�~�� 8� 8� :�:�:r!c�D�UR[R5-$r?)r�r�rCrBs r�totalseconds�SiteStats.totalseconds�s������!9�!9�!;�;�;r!c�<�0nUHpn[UR5HTupEURU5nU(d[U5nXbU'UR	5 US:XdMDUR5 MV Mr UR
5Vs/sHowPM sn$s snfr�)rnr�rhr�r�r��values)rer%�statsr�rrr��sitestatr�s        r�
buildstats�SiteStats.buildstats�s������F�$�V�\�\�2��� �9�9�T�?���(���H�"*�$�K��!�!�#���6��$�$�&�3��!�<�<�>�*�>�a��>�*�*��*s�B)r�r�r�N)rGrHrIrJr,r�r�r�r�r�r�rr�rMrNr!rr�r��s9���
��9�:�;�<��+��+r!r�c�0�\rSrSrSrSrSrSrSrSr	Sr
S	rg
)�DisplayFormatsi�rrr�rlr��rNN)rGrHrIrJ�ByLine�ByMethod�AboutMethod�Hotpath�
FlameGraph�Json�ChromerMrNr!rr�r��s%��
�F��H��K��G��J��D�
�Fr!r�c�j�Uc[nUcSSKJn URn[	UR
5S:XaUR
S5 gU[R:Xa[X 5 O�U[R:Xa[X 5 O�U[R:Xa
[X 40UD6 O�U[R:Xa
[X 40UD6 OmU[R :Xa
[#X 40UD6 OLU[R$:Xa['X 5 O,U[R(:Xa
[+X 40UD6 O[-S5eU[R$[R(4;aWUR
S5 UR
S[	UR
5-5 UR
S	UR.-5 gg)
z<Print statistics, either to stdout or the given file object.Nr)�procutilrsNo samples recorded.
zInvalid display formats---
sSample count: %d
s!Total time: %f seconds (%f wall)
)r��utilsr�stdoutrAr%r�r�r�display_by_liner�display_by_methodr�display_about_methodr�display_hotpathr�write_to_flamer�
write_to_jsonr�write_to_chrome�	Exceptionr2)rq�format�data�kwargsrs     rrr�sV���|���	�z�#�
�_�_��
�4�<�<��A��
���*�+��
��&�&�&���!�	�>�*�*�	*��$�#�	�>�-�-�	-��T�0��0�	�>�)�)�	)���+�F�+�	�>�,�,�	,��t�*�6�*�	�>�&�&�	&��d��	�>�(�(�	(���+�F�+��0�1�1�
�n�)�)�>�+@�+@�A�A�
�����
���&��T�\�\�):�:�;�
���6��9N�9N�N�O�Br!c���[RUR5nURSSS9 UR	SS-5 UR	SS-5 UH�nUR
nSUR
5UR=(d S	UR4-nUR	S
UR5UR5UR5U4-5 M� g)zoPrint the profiler data with each sample line represented
as one row in a table.  Sorted by self-time per line.Tc�"�UR5$r?�r���xs r�<lambda>�!display_by_line.<locals>.<lambda>s
��1�=�=�?r!��reverse�key�%5.5s %10.10s   %7.7s  %-8.8s
�s%  s
cumulativesselfr!�%5.5s  %9.9s  %8.8s  %-8.8s
�stime�secondsr$snames%s:%d:%sr��%6.2f %9.2f %9.2f  %s
N)r�r�r%�sortr�r�rxrSrTr�r�r�)rrqr��statr��	sitelabels      rrrs���
� � ����.�E�	�J�J�t�!:�J�;��H�H�*�
/�	0���H�H�(�
4�	5��
���y�y����M�M�O��K�K��2��M�M�#
�
�	�
	���&�� � �"��!�!�#�� � �"��	�
�	
�r!c	�h�URSS-5 URSS-5 [RUR5n[	[
5nUHHnX4RR5S-URR-RU5 MJ /nUR5H^upgSnSn	Sn
UH9nX�R5-
nX�R5-
n	X�R5-
n
M; URXhX�U45 M` URSSS	9 UGHnUS
S:aMURSUS
US
USUS4-5 USRSSS	9 USH�nUR5S
:�dMURRS5n[!U["5(d[$R&"U5nUR5UR5URR(=(d SU4n
URSU
-5 M� GM g)z�Print the profiler data with each sample function represented
as one row in a table.  Important lines within that function are
output as nested rows.  Sorted by self-time per line.r r!r"r#�:rTc��US$)Nr�rNrs rr�#display_by_method.<locals>.<lambda>Ys��!�A�$r!rrl皙�����?r%rr�rc�"�UR5$r?r)rrs rrr,hs
��Q�]�]�_r!�r�s%33.0f%% %6.2f   line %d: %s
N)r�r�r�r%�defaultdict�listr�rxrTr�r�r�r�r�r&rtrWrXr�bytestrrS)rrqr��groupedr'�functiondata�fname�	sitestats�
total_cum_sec�total_self_sec�
total_percentrTrU�	stattuples              rrr6s'���H�H�*�
/�	0���H�H�(�
4�	5��

� � ����.�E��$��G����	�	�"�"�$�t�+�d�i�i�.@�.@�@�A�H�H��N���L�#�M�M�O����
����
��D��.�.�0�0�M��.�.�0�0�N��-�-�/�/�M��
	���
�>�)�L�	
�,����d���7� ���A�;����
���&�������������	�
�	
�	������+D��E��Q�K�D����!�A�%����,�,�R�0��!�&�%�0�0�%�-�-�f�5�F��$�$�&��$�$�&��I�I�$�$�*���	�	����:�Y�F�G� �!r!c
��Uc[S5eSnSU;aURS5upBSn0n0nURH�n[UR5H�up�U
R
U:XdMU(aU
R
5U:XdM4US-
nU	[UR5S-
:wa%URU	S-nX�;a
XkS-Xk'OSXk'X�;aXzS-Xz'M�SXz'M� M� UR5VVs/sHup�X�4PM
 nnnURSSS9 UH�up�URSX�-S	-[R"UR
55[R"UR
5UR=(d S
[R"URS554-5 M� [ R#UR5n
U
Vs/sHHnUR$R
U:XdMU(a UR$R
5U:XdMFUPMJ n
nSnSnSnSnU
HOnUUR'5-
nUUR)5-
nUUR+5-
nUUR-5-
nMQ URS[R"U=(d S
5[R"U5UUUU4-5 UR5VVs/sH
unnUU4PM nnnURSSS9 UHXunnURSX�-S	-UR=(d S
[R"URS554-5 MZ gs snnfs snfs snnf)NzInvalid functionr*rrTc��US$r�rNrs rr�&display_about_method.<locals>.<lambda>�s��Q�q�Tr!rs%6.2f%%   %s:%s   line %s: %s
r�r��2sA
    %s:%s    Total: %0.2fs (%0.2f%%)    Self: %0.2fs (%0.2f%%)

s___c��US$r�rNrs rrr=�s��a��dr!s        %6.2f%%   line %s: %s
)rr�r%rnr�rTrxrAr�r&r�r�fsencoder�rSrtr�r�r�r�r�r�r�)rrqrTrrx�relevant_samples�parents�childrenr�rrr��parent�countr�r�r7r8�total_self_percent�total_cum_percentr'�childs                     rr
r
zsP�����*�+�+��H��x��%�^�^�D�1������G��H��,�,�� ����.�G�A��}�}��(���
�
��8� ;� �A�%� ���F�L�L�)�A�-�-�#�\�\�!�a�%�0�F��(�*1�/�A�*=���*+����#�%-�^�a�%7�H�N�%&�H�N�/��$5<�M�M�O�D�O�=�6���O�G�D��L�L��>�L�2� �
��
���.��(�3�.��!�!�&�/�/�"3�4��!�!�&�/�/�2��
�
�#���!�!�&�"2�"2�2�"6�7��
�		
�!�
� � ����.�E��
��A��6�6�?�?�h�&�	
��Q�V�V�_�_�.�(�:�	
��
�
��M��N���������*�*�,�,�
��$�*�*�,�,���d�.�.�0�0���T�.�.�0�0��	��H�H�O����h�0�&�1����h�'�����

�	
�
�4<�>�>�3C�D�3C�<�5�%����3C�H�D��M�M�$�N�M�3� ���u�
���.��(�3�.����"���!�!�%�/�/�"�"5�6��
�	
�!��]E��
��:Es�=M2�"M8�#M8�+M8�.M=c�v^^^^^^	�"U4SjS5mT"S5mURSRnURH>nTRURSSS2URU-
5 URnM@ UR	SS5m	UUUUU	4SjmTR
S:�aT"TSS5 gg)	Nc�(>�\rSrSrSrU4SjrSrg)� display_hotpath.<locals>.HotNodei�c�,�XlSUl0Ulgr�)r�rErCr�s  rr,�)display_hotpath.<locals>.HotNode.__init__�s���I��D�J��D�Mr!c��>�U=RU-
slUSnURRU5nU(dT"U5nX@RU'[U5S:�a�SnU[U5:aJXR	5[
;a0US-
nU[U5:aXR	5[
;aM0U[U5:aUR
XSU5 ggU=RU-
slgr9)rErCrhrAr|�skips�add)r*r�r�r�rHrr�HotNodes      �rrP�$display_hotpath.<locals>.HotNode.add�s�����J�J�$��J���8�D��M�M�%�%�d�+�E����
��&+�
�
�d�#��5�z�A�~����#�e�*�n���):�):�)<��)E���F�A��#�e�*�n���):�):�)<��)E��s�5�z�>��I�I�e�B�i��.�"����t�#�r!)rCrEr�N)rGrHrIrJr,rPrM)rQs�rrQrK�s���	�
	$�	$r!rQrr��showtimeTc�>�URnURR5Vs/sH#oDRTTR-:�dM!UPM% nnU(Ga�US-S-
nUR	5S-RS5nURnSRU5U(aSOS-S-T(aS	UR-OS-S
-n	U	URTR-S-UU4-n
[SS
[U
5-
5nSnUS:XaSnSn
U
USRU5URbUROSSR[SS[[UR55-
55URS54-nX�-n[URR5Vs/sHoDRPM sn5nURU-
STR-:�a	SU-S-nOURU-
S:XaSU-S-nTRUS-5 Un[U5S:�dU(aUS-
nURSSS9 UHnT"UU[U5S:�5 M gs snfs snf)Nr�rr*�r!�\�|s %4.1f%%s %5.2fss  %s %sr�r�7s, s
%s%s %d: %s%ssliner�r�g�������?sss�
Tc��UR$r?)rErs rr�1display_hotpath.<locals>._write.<locals>.<lambda>&s����r!r)r�rCr�rErx�ljustrT�maxrA�rjustrS�strrt�sumr�r&)�node�depth�multiple_siblingsr��c�visiblechildren�indentrxrT�listpattern�
liststring�spacing_len�prefix�codepattern�
codestring�finalstring�childrensamples�newdepthrH�_writerq�limit�rootrSs                   �����rrq�display_hotpath.<locals>._write�sp����y�y���}�}�+�+�-�
�-�!���U�T�Z�Z�=O�1P�A�-�	�
���Q�Y��]�F��
�
��$�.�5�5�b�9�H��}�}�H��	�	�&�!�-�5�4�9���/7�:��
�
�*�C�A��	�
�%��
�
�T�Z�Z�'�#�-���(��J��a��c�*�o�!5�6�K��F��a����*�K�$���
�
�k�*�#�{�{�6����B��	�	�#�a��S��T�[�[�)9�%:�!:�;�<����r�"�(��J�%�1�K�!�D�M�M�4H�4H�4J�"K�4J�q�7�7�4J�"K�L�O��z�z�O�+�s�T�Z�Z�/?�@�)�K�7�*�D�����o�-��2�)�K�7�*�D���H�H�[�5�(�)������!�#�'8���M�H����T�/@��A�$�E��5�(�C��$8�1�$<�=�%��g
��J#Ls� I6�I6�4I;F)r%r�rPr�rhrE)
rrqrrr�lasttimer�rQrqrsrSs
 ``   @@@@rrr�s����$�$�2�4�=�D��|�|�A��#�#�H��,�,��������d��d�#�V�[�[�8�%;�<��;�;����z�z�*�d�+�H�6>�6>�p�z�z�A�~��t�Q���r!c���Uc[RSS-n[RR	U5(d&URSU-5 URS5 g0nURH]nURVs/sHowRPM nnUR5 SRU5n	X�;aXYS-XY'MYSXY'M_ [R"5up�[US5nUR5Hup�URSX�4-5 M SSS5 UcS	n[R"S
X�4-5 URSU-5 gs snf!,(df   NG=f)NsHOMEs/flamegraph.plserror: missing %s
s8get it here: https://github.com/brendangregg/FlameGraph
�;rr�s%s %d
s~/flamegraph.svgsperl ~/flamegraph.pl %s > %ssWritten to %s
)rr�rrR�existsr�r%r�rTrr�r�mkstemprmr��system)rrq�
scriptpath�
outputfilerr�r�r�r�rs�fdrRr�rEs              rrr.s:�����%�%�g�.�1B�B�
�
�7�7�>�>�*�%�%�
���'�*�4�5�
���M�N���E��,�,��%+�\�\�2�\����\��2�
�
�
���y�y�����=��+��/�E�K��E�K�����!�H�B�	
�d�E�	�d� �;�;�=�K�D��J�J�z�T�M�1�2�)�
���(�
��I�I�-��0B�B�C��H�H�
�*�
,�-��%3�
�	�s�E!�6/E&�&
E4c�H�U[;a	[U$[RR[R
S5SnU/[R-H<nU[R
-nURU5(dM.U[U5Sn O U[U'U$)zAttempt to make the path to a Python module easier to read by
removing whatever part of the Python search path it was found
on.r�rN)
�
_pathcacher�__file__�rsplitr�sepr�rR�
startswithrA)rR�hgpath�prks    r�simplifypathr�Ps���
�z���$���
�
�
�
%�
%�b�f�f�a�
0��
3�F��X����
 ���R�V�V����?�?�6�"�"���F��
�&�D��	!�
�J�t���Kr!c	���/nURH�n/nURHfnUR[R"UR
5UR=(d S[R"UR545 Mh URURU45 M� [R"U5n[U[5(dURS5nURU5 g)Nr��utf-8)r%r�r�r�sysstrrRrSrTr��json�dumpsrWrX�encoder�)rrqr%r�r�r�s      rrras����G��,�,�����\�\�E��L�L��O�O�E�J�J�/��L�L�&�B��O�O�E�N�N�3��
�"�	������U�+�,���:�:�g��D��d�E�"�"��{�{�7�#���H�H�T�Nr!c
�^^^
^^^^^^^^�/m[R"5m[R"5m0m/mUUU4SjmSm[5mURSRURSR-
nUT-m[UT-T5mUUUUUUU
UU4	SjnURGHIm
[
ST
R55n[R"U5nTU:XaM>T(aOU(aHTSUS:Xa<TR5 UR5 T(aU(aTSUS:XaM<T(aU"5 T(aM[U5HynTRT
R[T545 TRU5 Uup�T"[
T55nTR[SU
U	T
RS-USS	95 M{ [R"U5mGML T(aU"5 T(aM[T5VV
s/sHup�UT;dM
U
PM nnn
[R"S
[T555n[ R""[X�S9SS
9n[%U[&5(dUR)S5nUR+U5 UR+S5 gs sn
nf)Nc��>�U(dgUT;aTU$T"USS5n[T5nUTU'TR[USSSUS-S95 UbTSRUS9 U$)Nrrz%s %s)�categoryr�r�)rD)rAr��dict�update)r�rD�myid�id2stack�stack2id�stackids   ���rr�� write_to_chrome.<locals>.stackid�s�������H���E�?�"���q�r��#���8�}����������e�A�h�q�k��%��(�8J�K�L����R�L���v��.��r!r1r�rc�D>	�T"[T
55nT
R5upT	R5up4T
RU-
nTUs=::aT::a=O O:[UT-T
R5nTR	[SUUUUS-SS95 gTR
U5 g)N�E���.Ar)�phr��cat�sf�ts�pid)�tuple�popleftr�r^r�r�rP)�oldsid�oldcat�oldfunc�oldtime�oldidx�duration�
sampletime�	blacklist�clamp�lastseen�	laststack�maxthreshold�minthresholdr�r%r�s       ���������r�poplast� write_to_chrome.<locals>.poplast�s������y�)�*��#�+�+�-���"�*�*�,����;�;��(���8�3�|�3��W�u�_�f�k�k�:�J��N�N��� ���!�C�'��
�	
�
�M�M�&�!r!c3��# �UHfnS[[R"UR55UR=(d S4-[R"UR
54v� Mh g7f)z%s:%dr�N)r�rr�rRrSrT)�.0r�s  r�	<genexpr>�"write_to_chrome.<locals>.<genexpr>�s]���

�&��� �������!<�=��L�L�&�B���
������/�

�&�s�A.A0�Br�)r�r�r�r�r�r�c3�@# �UHup[U5U4v� M g7fr?)r`)r�rfrgs   rr�r��s���%�"5����Q����"5�s�)�traceEvents�stackFramesr)rgr�rZ)�collections�dequer�r%r�r^r�r��pop�reversed�
appendleftrAr�r�rn�OrderedDictr�r�rWrXr�r�)rrqr�r��	totaltimer�r��qstackr�rRr��sid�idxr��events�framesr�r�r�r�r�r%r�r�s  ``         `  @@@@@@@@rrrysi�����G��!�!�#�I�� � �"�H�
�H��H��&
�E���I����R� �%�%����Q��(<�(<�<�I��|�+�L��y�<�/��7�L�"�"�0�,�,���

� ���

�

���"�"�5�)�������F�y��}��r�
�'B��M�M�O��J�J�L��F�y��}��r�
�'B���I��i��&�!�A�������c�'�l� ;�<�� � ��#��J�D��%�	�*�+�C��N�N������{�{�S�(���
�	
�"� �%�%�e�,�	�G�H��	��)�#,�G�"4��"4�;�3��9�8L��"4����
$�
$�%�"+�H�"5�%��F��:�:�d�v�B�1�M�D��d�E�"�"��{�{�7�#���H�H�T�N��H�H�U�O��s�$K�4Kc��[S5 g)Na�
The statprof command line allows you to inspect the last profile's results in
the following forms:

usage:
    hotpath [-l --limit percent]
        Shows a graph of calls with the percent of time each takes.
        Red calls take over 10%% of the total time themselves.
    lines
        Shows the actual sampled lines.
    functions
        Shows the samples grouped by function.
    function [filename:]functionname
        Shows the callers and callees of a particular function.
    flame [-s --script-path] [-o --output-file path]
        Writes out a flamegraph to output-file (defaults to ~/flamegraph.svg)
        Requires that ~/flamegraph.pl exist.
        (Specify alternate script path with --script-path.))�printrNr!r�
printusager��s��	�	?�r!c���Uc[Rn[U5S:Xa[5 g0nSnSUS'USS:Xa[R
US'O�USS:Xa[RUS'OlUSS:Xa[RUS'OOUSS	:Xa[RUS'USUS'S
nO(USS:Xa[RUS'O[5 g[R"[RUSS/S
Q5up4SUS'SnUHWupxUS;a[!U5US'MUS;aUnM%US;aX�S'M1US;aX�S'M=US;a[5  gSU-5e U(d[S5 g[#US9 [%S0[R&"U5D6 g![Ran[U5 [5 SnAgSnAff=f)Nrrr�sfunction�hotpathsformatr��	functionsrTrl�flames	hl:f:o:p:)shelpslimit=sfile=soutput-file=sscript-path=r-slimit)z-lz--limit)z-fz--file)z-oz
--output-files
outputfile)z-pz
--script-paths
scriptpath)z-h�helpzunhandled option %szmust specify --file to load)rRrN)r��argvrAr�r�rrrrrr�getoptb�sysargv�getopt�errorr�r�r�r�	strkwargs)	r��displayargs�optstart�optsr��msgrR�or�s	         r�mainr�	s����|��x�x��
�4�y�A�~�����K��H�#�K����A�w�)��!/�!7�!7��I��	
�a��G�	�!/�!6�!6��I��	
�a��K�	�!/�!8�!8��I��	
�a��J�	�!/�!;�!;��I��#'��7��K� ���	
�a��G�	�!/�!:�!:��I�����	��%�%����X�Y�'��L�
�
��!�K����D�����!�!�$)�%�L�K��!�
�"�
"��D�
�)�
)�).�
�&�
�)�
)�).�
�&�
�.�
 ��L��3�/�!�3�3�5���
�+�,��
�4���.�h� � ��-�.���=�<�<��
�c�
������s�-F+�+G�?G�G�__main__)r�r'r?)NrlN)r-)NN)g{�G�zt?g+����?)7�__doc__�
__future__rr��
contextlibr�r�r�rr�r�r�r��typingr�rrr0�contextmanager�__all__rOr r#r�rPr�r��Eventr�r�r�r�rr	r�r�r
rr�r�rrrr
rrrr�rrr�r�rG�exitrNr!r�<module>r�s[��0N�`#���
���	�
�
�����
�%�%���*�*��
:��	��*+�,�,�^	���7:�7:�t#�#�8	$��_�_�
�
�
�(#��
�!�4�*
@�2�(�����(+�(+�V��!P�H
�BAH�HT
�nZ�z.�>�
��"�0v�r�.A
�H�z���H�H�T�V��r!