????

Your IP : 3.19.208.67


Current Path : /proc/self/root/lib/python3.6/site-packages/glances/plugins/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.6/site-packages/glances/plugins/__pycache__/glances_mem.cpython-36.pyc

3

Eo�c�+�@s�dZddlmZddlmZddlZdddd�d	ddd�d
dd�d
ddd�dddd�dddd�ddddd�ddddd�dddd�dddd�dddd�d�Zdddddd�dd d!d"d#�dd d!d"d#�d$�Zdd%d&d'�gZGd(d)�d)e�Z	dS)*zVirtual memory plugin.�)�iterkeys)�
GlancesPluginNz Total physical memory available.�bytes�K)�description�unit�
min_symbolaCThe actual amount of available memory that can be given instantly to processes that request more memory in bytes; this is calculated by summing different memory values depending on the platform (e.g. free + buffers + cached on Linux) and it is supposed to be used to monitor actual memory usage in a cross platform fashion.zEThe percentage usage calculated as (total - available) / total * 100.�percent)rrzkMemory used, calculated differently depending on the platform and designed for informational purposes only.z�Memory not being used at all (zeroed) that is readily available; note that this doesn't reflect the actual memory available (use 'available' instead).zM*(UNIX)*: memory currently in use or very recently used, and so it is in RAM.z,*(UNIX)*: memory that is marked as not used.Zinacti)rrrZ
short_namez;*(Linux, BSD)*: cache for things like file system metadata.�bufferz)*(Linux, BSD)*: cache for various things.zW*(BSD, macOS)*: memory that is marked to always stay in RAM. It is never moved to disk.zJ*(BSD)*: memory that may be simultaneously accessed by multiple processes.)�total�	availabler	�used�free�active�inactive�buffers�cached�wired�sharedz1.3.6.1.4.1.2021.4.5.0z1.3.6.1.4.1.2021.4.11.0z1.3.6.1.4.1.2021.4.13.0z1.3.6.1.4.1.2021.4.14.0z1.3.6.1.4.1.2021.4.15.0)rrrrrz1.3.6.1.2.1.25.2.3.1.3z1.3.6.1.2.1.25.2.3.1.4z1.3.6.1.2.1.25.2.3.1.5z1.3.6.1.2.1.25.2.3.1.6)Z	mnt_point�
alloc_unit�sizer
)�default�windows�esxizRAM memory usage�%)�namerZy_unitcsLeZdZdZd�fdd�	Zejejdd���Z�fdd�Z	dd	d
�Z
�ZS)
�Pluginz1Glances' memory plugin.

    stats is a dict
    Ncs"tt|�j||ttd�d|_dS)zInit the plugin.)�args�config�items_history_list�fields_descriptionTN)�superr�__init__rr Z
display_curse)�selfrr)�	__class__��!/usr/lib/python3.6/glances_mem.pyr"ss
zPlugin.__init__c
CsX|j�}|jdkr�tj�}|j�x$dD]}t||�r(t||�||<q(W|d|d<t|d	�rr|d|d	7<t|d
�r�|d|d
7<|d|d|d<�n�|jd
k�rL|jdk�r�y|jt	|jdd�}Wnt
k
�r�|j�Yn�Xx�|D]�}|dk�r�t||d�t||d�|d<t||d�t||d�|d<t|dd|d�|d<|d|d|d<P�q�Wn�|jt	dd�}|ddk�r�|j�|j
Sx4t|�D](}||dk�r�t||�d||<�q�W|d|d|d	|d
|d<|d|d|d<t|d|d|dd�|d<||_
|j
S)z/Update RAM memory stats using the input method.Zlocalrrr	r
rrrrrrrZsnmprrT)�snmp_oidZbulk�Physical Memory�Real Memoryrr�dr)r'�i)rrr	r
rrrrrrr)rr)r(r))Zget_init_valueZinput_method�psutilZvirtual_memory�reset�hasattr�getattrZshort_system_nameZget_stats_snmpr'�KeyError�int�float�statsr)r#r3Zvm_statsZmemZfs_statZfs�keyr%r%r&�update|sb





$$
$$z
Plugin.updatecs\tt|�j�|j|jd|jdd�|jdd<x$d
D]}||jkr8d
|j|d<q8WdS)zUpdate stats views.r
r)Zmaximumr	�
decorationrrrrTZoptionalN)rrrr)r!r�update_viewsZ
get_alert_logr3Zviews)r#r4)r$r%r&r7�s
$

zPlugin.update_viewscCsLg}|js|j�r|Sdjd�}|j|j|d��dj|j|jd���}|j|j|��dj|jdd�}|j|j||jddd	���|j|j	d
ddd
��|j|j
��|j|j	ddd��|j|j	dddd
��|j|j
��|j|j	ddd��|j|j	dddd
��|j|j
��|j|j	ddd��|j|j	dddd
��|S)z2Return the dict to display in the curse interface.z{}ZMEMZTITLEz {:2}r	z{:>7.1%}r*r6)r4Zoptionr�z  )�width�headerr�)r9rr
rrr)r3Zis_disabled�format�appendZcurse_add_lineZ	trend_msgZ	get_trendZ	get_views�extendZcurse_add_statZcurse_new_line)r#rZ	max_width�ret�msgr%r%r&�	msg_curse�s(
zPlugin.msg_curse)NN)NN)�__name__�
__module__�__qualname__�__doc__r"rZ_check_decoratorZ_log_result_decoratorr5r7rA�
__classcell__r%r%)r$r&rms	c
r)
rEZglances.compatrZglances.plugins.glances_pluginrr,r r'rrr%r%r%r&�<module>
s`