Your IP : 216.73.216.86


Current Path : /lib/fm-agent/dependencies/psutil/__pycache__/
Upload File :
Current File : //lib/fm-agent/dependencies/psutil/__pycache__/_common.cpython-36.pyc

3

q��i��@s4dZddlmZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
rhddlZ	YnXddlmZm
Z
mZddlmZmZeedd�Zeedd�ZdZd	Zd
ZdZdZd
ZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dqd d!�Z-d"d#�Z.drd$d%�Z/d&d'�Z0d(d)�Z1eeege
egfeege
gfege
gfeegegfegegfeege
egfege
egfege
egfd*�Z2edk	�r�e2j3ege
gfegegfd+��edk	�r�e2j3d,ege
egfi�[[[[
[[ed-d.d/d0d1d2d3g�Z4ed4d.d/d0d1g�Z5ed5d6d7d8d9d:d;g�Z6ed<d=d>d?d@g�Z7edAdBdCdDdEdFdGdHdIg�Z8edJdKdLdMdNg�Z9edOdPdQdRdSdTdUdVg�Z:edWdXdYg�Z;edZd[d\g�Z<ed]d^dPg�Z=ed_d`dadbg�Z>edcdddedfg�Z?edgdddedfg�Z@edhd6d7d8d9g�ZAedidjdkg�ZBedldmdng�ZCGdodp�dpedpdPdQdRdSdTdUg��ZDdS)sz*Common objects shared by all _ps* modules.�)�divisionN)�AF_INET�SOCK_STREAM�
SOCK_DGRAM)�
namedtuple�wraps�AF_INET6�AF_UNIXZrunningZsleepingz
disk-sleep�stoppedztracing-stopZzombieZdeadz	wake-killZwaking�idle�lockedZwaitingZESTABLISHEDZSYN_SENTZSYN_RECVZ	FIN_WAIT1Z	FIN_WAIT2Z	TIME_WAITZCLOSEZ
CLOSE_WAITZLAST_ACKZLISTENZCLOSINGZNONEcCsDy||d}Wntk
r(d}YnX|dk	r<t||�S|SdS)z5Calculate percentage usage of 'used' against 'total'.�drN)�ZeroDivisionError�round)�used�totalZ_round�ret�r�0/usr/lib/fm-agent/dependencies/psutil/_common.py�
usage_percent;s

rcs<t�����fdd��}��fdd�}tj��i�||_|S)aA simple memoize decorator for functions supporting (hashable)
    positional arguments.
    It also provides a cache_clear() function for clearing the cache:

    >>> @memoize
    ... def foo()
    ...     return 1
    ...
    >>> foo()
    1
    >>> foo.cache_clear()
    >>>
    cs`|tt|j���f}�j�z4y�|Stk
rL�||�}�|<YnXWd�j�X|S)N)�	frozenset�sorted�items�acquire�KeyError�release)�args�kwargs�keyr)�cache�fun�lockrr�wrapperUs
zmemoize.<locals>.wrapperc
s$�j�z�j�Wd�j�XdS)zClear cache.N)r�clearrr)rr!rr�cache_clearbszmemoize.<locals>.cache_clear)r�	threading�RLockr$)r r"r$r)rr r!r�memoizeGs
r'cs�fdd�}|S)z>A decorator which can be used to mark functions as deprecated.csHd�j��dk	r�d�7��jdkr.��_t����fdd��}|S)Nzpsutil.%s is deprecatedz; use %s insteadcstj�tdd��||�S)N�)�category�
stacklevel)�warnings�warn�DeprecationWarning)rr)r �msgrr�innerzsz(deprecated.<locals>.outer.<locals>.inner)�__name__�__doc__r)r r/)�replacement)r r.r�outerss

zdeprecated.<locals>.outerr)r2r3r)r2r�
deprecatedqs
r4cs�fdd�}|S)z�A decorator which can be used to mark a method as deprecated
    'replcement' is the method name which will be called instead.
    cs8d|j�f�|jdkr�|_t|���fdd��}|S)Nz$%s() is deprecated; use %s() insteadcs tj�tdd�t|��||�S)Nr()r)r*)r+r,r-�getattr)�selfrr)r.r2rrr/�sz/deprecated_method.<locals>.outer.<locals>.inner)r0r1r)r r/)r2)r.rr3�s
z deprecated_method.<locals>.outerr)r2r3r)r2r�deprecated_method�sr7cCsTytj|�}Wn4tk
rBtj�d}|jtjtjfkr>�dSXtj|j	�SdS)z�Same as os.path.isfile() but does not swallow EACCES / EPERM
    exceptions, see:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html
    �FN)
�os�stat�OSError�sys�exc_info�errno�EPERMZEACCES�S_ISREG�st_mode)�path�st�errrrr�
isfile_strict�srE)�allZtcpZtcp4ZudpZudp4�inetZinet4Zinet6)Ztcp6Zudp6Zunix�sswaprr�free�percent�sinZsout�
sdiskusage�sdiskioZ
read_countZwrite_countZ
read_bytesZwrite_bytesZ	read_timeZ
write_time�	sdiskpartZdeviceZ
mountpointZfstype�opts�snetioZ
bytes_sentZ
bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropout�suser�name�terminal�host�started�sconn�fd�family�type�laddr�raddr�status�pid�pmem�rss�vms�	pcputimes�user�system�	popenfilerB�pthread�idZ	user_timeZsystem_time�puids�realZ	effectiveZsaved�pgids�pio�pionice�ioclass�value�pctxswZ	voluntaryZinvoluntaryc@s(eZdZfZedd��Zedd��ZdS)�pconncCstjdtdd�|jS)Nz7'local_address' field is deprecated; use 'laddr'insteadr()r)r*)r+r,r-rZ)r6rrr�
local_address�s
zpconn.local_addresscCstjdtdd�|jS)Nz8'remote_address' field is deprecated; use 'raddr'insteadr()r)r*)r+r,r-r[)r6rrr�remote_address�s
zpconn.remote_addressN)r0�
__module__�__qualname__�	__slots__�propertyrprqrrrrro�sro)N)N)Er1�
__future__rr>r9�socketr:r<r+r%�ImportError�dummy_threadingrrr�psutil._compatrrr5rr	�STATUS_RUNNING�STATUS_SLEEPING�STATUS_DISK_SLEEP�STATUS_STOPPED�STATUS_TRACING_STOP�
STATUS_ZOMBIE�STATUS_DEADZSTATUS_WAKE_KILL�
STATUS_WAKING�STATUS_IDLE�
STATUS_LOCKED�STATUS_WAITING�CONN_ESTABLISHED�
CONN_SYN_SENT�
CONN_SYN_RECV�CONN_FIN_WAIT1�CONN_FIN_WAIT2�CONN_TIME_WAIT�
CONN_CLOSE�CONN_CLOSE_WAIT�
CONN_LAST_ACK�CONN_LISTEN�CONN_CLOSING�	CONN_NONErr'r4r7rEZ	conn_tmap�updaterHrLrMrNrPrQrVr^rardrergrirjrkrnrorrrr�<module>s�
*