HEX
Server: LiteSpeed
System: Linux baran.dnsprotection.me 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: ddir12 (3618)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/glances/plugins/__pycache__/glances_memswap.cpython-36.opt-1.pyc
3

Eo�c��	@s�dZddlmZddlmZddlmZddlZdddd	�d
ddd	�dddd	�dd
d�dddd	�dddd	�ddd�d�Zddd�ddddd�d�Z	d
ddd�gZ
Gd d!�d!e�ZdS)"zSwap memory plugin.�)�iterkeys)�getTimeSinceLastUpdate)�
GlancesPluginNzTotal swap memory.�bytes�K)�description�unitZ
min_symbolzUsed swap memory.zFree swap memory.zUsed swap memory in percentage.�percent)rrzEThe number of bytes the system has swapped in from disk (cumulative).zFThe number of bytes the system has swapped out from disk (cumulative).z$Number of seconds since last update.Zseconds)�total�used�freer	�sin�sout�time_since_updatez1.3.6.1.4.1.2021.4.3.0z1.3.6.1.4.1.2021.4.4.0)r
rz1.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�windowszSwap memory usage�%)�namerZy_unitcsLeZdZdZd�fdd�	Zejejdd���Z�fdd�Z	dd	d
�Z
�ZS)
�Pluginz5Glances swap memory plugin.

    stats is a dict
    Ncs"tt|�j||ttd�d|_dS)zInit the plugin.)�args�config�items_history_list�fields_descriptionTN)�superr�__init__rrZ
display_curse)�selfrr)�	__class__��%/usr/lib/python3.6/glances_memswap.pyr=s
zPlugin.__init__cCs�|j�}|jdkrjytj�}Wntk
r2Yn4Xx$dD]}t||�r:t||�||<q:Wtd�|d	<�nx|jd
k�r�|jdk�rJy|j	t
|jdd
�}Wntk
r�|j�Yn�Xx�|D]�}|dkr�t
||d�t
||d�|d<t
||d�t
||d�|d<t|dd|d�|d<|d|d|d<Pq�Wn�|j	t
dd�}|ddk�rt|j�|Sx4t|�D](}||dk�r~t||�d||<�q~W|d|d|d<t|d|d|dd�|d<||_|jS)z0Update swap memory stats using the input method.Zlocalr
rrr	r
rZmemswaprZsnmprT)�snmp_oidZbulkzVirtual Memoryrr�dr)r!�i)r
rrr	r
r)Zget_init_valueZinput_method�psutilZswap_memory�RuntimeError�hasattr�getattrrZshort_system_nameZget_stats_snmpr!�KeyError�reset�int�floatr�stats)rr,Zsm_statsZswapZfs_statZfs�keyrrr �updateFsD
	


$$$z
Plugin.updatecsTtt|�j�d|jkrPd|jkrPd|jkrP|j|jd|jdd�|jdd<dS)zUpdate stats views.rr
r	)Zmaximum�
decorationN)rr�update_viewsr,Z
get_alert_logZviews)r)rrr r0�szPlugin.update_viewscCs�g}|js|j�r|Sdjd�}|j|j|d��dj|j|jd���}|j|j|��dj|jdd�}|j|j||jddd	���|j|j��|j	|j
d
dd��|j|j��|j	|j
d
dd��|j|j��|j	|j
ddd��|S)z2Return the dict to display in the curse interface.z{:4}ZSWAPZTITLEz {:2}r	z{:>6.1%}r"r/)r-Zoptionr
�)�widthrr)r,Zis_disabled�format�appendZcurse_add_lineZ	trend_msgZ	get_trendZ	get_viewsZcurse_new_line�extendZcurse_add_stat)rrZ	max_width�ret�msgrrr �	msg_curse�s 
zPlugin.msg_curse)NN)NN)�__name__�
__module__�__qualname__�__doc__rrZ_check_decoratorZ_log_result_decoratorr.r0r8�
__classcell__rr)rr r7s	I
r)r<Zglances.compatrZ
glances.timerrZglances.plugins.glances_pluginrr$rr!rrrrrr �<module>
s,