%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyc

�
;�Pc@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z
yddlZWnek
r�nXddl
Z
ddlZddlTddlmZddlmZddlmZddlmZdejfd��YZd	�Zd
d�ZdZd
ejfd��YZdejfd��YZ ddd��YZ!d�Z"e#dkr�e"�ndS(i����N(t*(tConsole(t
mutnodeset(tptable(tcmdtServercBseZRS((t__name__t
__module__(((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRscCs.tj|ggg|�\}}}t|�S(N(tselecttlen(tfdtwaittrtwtx((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytioreadys$icCs@x9y|jdd�SWqtjk
r7|r8Pq8qXqWdS(Nttimeoutg�������?(tgettQueuetEmpty(tqtnoblock((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytqueue_get_interruptiblestCLOSEDtHandlercBsSeZdZd�Zd�Zd�Zddd�Zd�Zd�Zd�Z	RS(	icCsY|jjd�sU|jjj|�|jjt�|jj	d�|jj
�ndS(Nii(tisclosedttastservertmonitortremove_connectiontdataqtputtCONN_CLOSEDtrequesttshutdowntclose(tself((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR#)s
cCs0|jd�s|d7}n|jj|�dS(Ns
(tendswithR!tsend(R$R((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytsend_cmd0s
cCs]|jdkr%|jddd�n|jdkrJ|jddd�n|j|dd�S(Ns>>> Rtretdatais<Annex> tcont(tprompttexec_cmd(R$R((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytbrowser_cmd5s
icCs7|dk	r%|j|�t|_ng}x�t|j|�}|dkrl|jrYPqltjd�q.n|tkr�t	�n|ddkr�t|_|r�|j
|d�qtjj
|d�q.|ddkr|d|_|jj�rt|_Pqt|_q.ds.t�q.W|r3dj|�SdS(NiitDATAtPROMPTt(tNoneR'tFalsetpromptstateRRttimetsleepR tEOFErrortappendtsyststdouttwriteR*temptytTruetAssertionErrortjoin(R$RR(Rtdatastp((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR+<s6
	
		
	cCsfx_|jjd�D]K}|j|�rd|krZ|jd�}||dj�}n|SqWdS(Ns
t=iR/(t	firstdatatsplitt
startswithtindextstrip(R$tnametlinetix((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytget_ps]scCs |jd|�}tj|�S(Nsdump %s(R,tpickletloads(R$texprtdata((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytget_valfscCs/d|_t|_t�|_tj�|_|jj	j
|�x�y@|jj�}|sgt
d�n|jt�r�t
d�nWnt
tjfk
r�PnX|jt�r|tt� }|jjd|f�|jdkr|jdddd�|_qqC|jjd|f�qCW|j�dS(NsEnd of filetDONER.RR(iR-(R0R*R1R2RRRRRRtadd_connectiontrfiletreadlineR5R%ROtsocketterrortREADLINER	RR+RAR#(R$RMR*((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythandleks*		!(
RRtallow_reuse_addressR#R'R,R+RIRNRV(((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR&s			!			tMonitorConnectioncBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zej
jZd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(icCs�i|_tjj|�d|_d|_d|_d|_||_t	t
tft�|_
}||j
_tjd|jdd�|_|jj�dS(Nis
<Monitor> ttargettargs((taliasesRtCmdt__init__thnoRt	forceexitR*RRt	LOCALHOSTt	HEAPYPORTRRt	threadingtThreadt
run_servertsttstart(R$Rts((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR]�s						cCs<d|_|jjjd�|jj�d�|j_dS(NiicSsdS(Ni((Rty((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyt<lambda>�s(RRRSR"tserver_closetverify_request(R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR#�s	
cCs*tjj||�tjj|d�dS(NR/(RR\tdefaulttdo_help(R$RG((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRl�scCs1|j}x|js"|j�qW|j�dS(N(RRthandle_requestRj(R$Rg((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRd�s	cCsc|s
dS|}y8|j|�}|j|�}|j||�}|SWn|j|�nXdS(N(tprecmdtonecmdtpostcmdthandle_error(R$RRGtstop((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR+�scCs\tjddIJtjdItjt|�IJddl}|j�tjddIJdS(sfHandle an error gracefully.  May be overridden.

	The default is to print a traceback and continue.

	t-i(s0Exception happened during processing the commandi����N(R7tstderrtreprt	tracebackt	print_exc(R$tcmdlineRw((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRr�s

cCsu||_|s|S|j�}x�|jj|d�r|j|d}d|kr�d}xa|dD]U}|jdt|�|�}|jdt|�dj||��}|d}qfW|jddj|d��}n|ddj|d�}|j�}q"W|ddkrq|jd�}|dkrq||d	j�}|j	j
|�|| j�}qqn|S(
s*Handle alias expansion and ';;' separator.it%is%>=t s%*taliass;;i(tcurlineRBR[thas_keytreplacetstrR=tfindtlstriptcmdqueueR6trstrip(R$RGRZtiittmpArgtmarkertnext((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRo�s0		"cCs
d|_dS(Ni(R_(R$targ((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytdo_exit�s	cCs	dGHdS(Ns�exit
-----
Exit from the monitor and from the Python process that started it. 
This makes sure to exit without waiting for the server thread to terminate.
See also the q command.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyt	help_exit�scCs	dGHdS(Ns�h(elp)
-----
Without argument, print the list of available commands.
With a command name as argument, print help about that command.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythelp_h�scCs|j�dS(N(R�(R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyt	help_help�scCsDz<td|jd|jd|j�}|jd|j�WdXdS(NtstdinR8tlocalss9Local interactive console. To return to Monitor, type %r.(RR�R8t__dict__tinteracttEOF_key_sequence(R$R�tcon((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytdo_int�scCs	dGHdS(Ns�int
-----
Local interactive console.
This will bring up a Python console locally in
the same interpreter process that the Monitor itself.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythelp_intscCs_|s|j}nt|�}|jj|}|jd�rEdGHnd|GH|jt�dS(NtnoninterruptiblesCError: Can not interrupt this remote connection (uses Python < 2.4)s+Sending KeyboardInterrupt to connection %s.(tconidtintRtconnectionsRIR'tKEYBOARDINTERRUPT(R$R�tc((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytdo_kis	cCs	dGHdS(Ns\ki <connection ID>
-----
Keyboard Interrupt

Send a command to interrupt the remote thread on the specified
connection (default is the last one connected to).

Notes:

It currently only works with Python >= 2.4.  The remote thread will
not always be awakened, for example if it is waiting in
time.sleep(). Sometimes using several ki commands helps.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythelp_kiscCsqdddgg}xH|jjj�D]4\}}|j||jd�|jd�g�q%Wt||j�dS(NtCIDtPIDtARGVs
target.pidstarget.sys.argv(RR�titemsR6RIRR8(R$R�ttabletcidR�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytdo_lc*s	cCs	dGHdS(Ns�lc
-----
List Connections.
List the currently open connections.
The table printed has one line per connection in this form:

CID PID   ARGV
  1 17999 ['/home/nilsson/bin/solitaire.py']

CID is the connection ID, which may be used as argument to the sc
command.

PID is the process ID of the target interpreter process.  In Linux,
this is the parent of the remote control interpreter thread that runs
the Annex that the connection is talking to.

ARGV is the argument vector in the target Python interpereter.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythelp_lc3scCsE|rt|�|_nd|jGH|jj|jj|j�dS(NsFRemote connection %d. To return to Monitor, type <Ctrl-C> or .<RETURN>(R�R�Rtset_connectionR�(R$R�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytdo_scGscCs	dGHdS(Nspsc <connection ID>
-----
Set connection to communicate with a remote thread.

With an argument, set current connection to the number specified.
Without argument, use the same connection as last time.  You will then
be talking to a remote process via that connection.  You can return to
Monitor at any time by <Ctrl-C>. You may also use the '.' command
(followed by <Return>), if the remote process is waiting for input.
The '.' character may be followed by a monitor command, to execute it
directly instead of returning to the monitor. For example, when
talking to a connection, '.sc 1' will directly change to connection 1.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythelp_scMscCsdS(Ni((R$R�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytdo_q[scCs	dGHdS(Ns�q
-----
Quit from the monitor.
This will not exit from Python itself if called from an interactive
interpreter. To make sure to exit from Python, use the exit command.((R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pythelp_q^s(RRt
use_raw_inputR]R#RlRdR+RrRoR�R�RR\Rmtdo_hR�R�R�R�R�R�R�R�R�R�R�R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRX�s.							 														tMonitorcBsVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	icCs5t|�|_|_i|_d|_d|_dS(Ni(RXt
connectiontmonitor_connectionR�tidsR0R*(R$((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR]hs		cCsa|js$d|_|j|j_n6tdgg|jj�D]}|^q=�d|_|jS(Ni(R�R�R�R�tmaxtkeys(R$R�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytnewidns
		6cCs7|j�}||j|<||_|jd|�dS(Ns*** Connection %s opened ***(R�R�t
monitor_idtprint_async(R$R�thid((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyRPvs
	cCs?|jdk	r;d|GHtjj|j�tjj�ndS(sL Print text only if we are waiting for input,
	and then restore the prompt. s
N(R*R0R7R8R9tflush(R$ttext((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR�}s	cCsG|j|j=||jkr/|j|j�n|jd|j�dS(Ns*** Connection %s closed ***(R�R�R�R�R�R�(R$R�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR�s
cCs�ztd}xg|sry	x|s|j}|j|_||jk	r[|jdddd�nt|j�}d|_d}|jd�r�|dkr�|j|_q�|d}|j}n	|j}|ry|j|�}Wntk
r�d}nX||jkr|rd}qqqWWqtk
rEdGH|j|_d}qtk
rndGHdGH|j|_qqXqWWdd|_|j	�XdS(	NiRRit.s%*** End Of File - Exiting Monitor ***tKeyboardInterrupts1Use the ki command to interrupt a remote process.(
R�R*R�R+R0t	raw_inputRCR5R�R#(R$RstconnRR((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pytrun�sH				
	


	
	cCs�x<|jj�D]+}y|j�Wqtjk
r:qXqWy|jj�Wntjk
rfnX|jjr�tjd�ndS(Ni(	R�tvaluesR#RSRTR�R_tost_exit(R$R�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR#�scCs||_|j|_dS(N(R�R*(R$R�((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR��s	(RRR�R]R�RPR�RR�R#R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR�es						1	cCs1ddlm}|j�t�}|j�dS(s�monitor() [0]

Start an interactive remote monitor.

This can be used to get information about the state, in
particular the memory usage, of separately running Python
processes. 

References
    [0] heapy_Use.html#heapykinds.Use.monitori����(tRemoteN(tguppy.heapyR�toffR�R�(R�tm((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyR�s
	t__main__(R(($R�tpprinttsignalRStSocketServerR7RbR3RwtcPickleRJRRtImportErrorRRtguppy.heapy.RemoteConstantstguppy.heapy.ConsoleRt
guppy.setsRt
guppy.etc.etcRt	guppy.etcRtThreadingTCPServerRRRR tStreamRequestHandlerRR\RXR�RR(((sF/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Monitor.pyt<module>s*l

	
_�j	

Zerion Mini Shell 1.0