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: //usr/lib/python3.6/site-packages/glances/plugins/__pycache__/glances_diskio.cpython-36.opt-1.pyc
3

Eo�c�"�@sldZddlmZddlmZmZddlmZddlm	Z	ddl
Z
ddd	d
�ddd	d
�gZGd
d�de	�ZdS)zDisk I/O plugin.�)�unicode_literals)�	nativestr�n)�getTimeSinceLastUpdate)�
GlancesPluginN�
read_byteszBytes read per secondzB/s)�name�descriptionZy_unit�write_byteszBytes write per secondcsTeZdZdZd
�fdd�	Zdd�Zejejdd���Z	�fd	d
�Z
ddd�Z�ZS)�Pluginz3Glances disks I/O plugin.

    stats is a list
    Ncsdtt|�j||tgd�d|_|dk	r<|j|jddd�|_nd|_ddg|_|j	�|j
jd	�dS)
zInit the plugin.)�args�config�items_history_listZstats_init_valueTN�	hide_zeroF)�defaultrr
r)�superr�__init__rZ
display_curseZget_bool_valueZplugin_namer�hide_zero_fields�updateZ
refresh_timer�set)�selfrr
)�	__class__��$/usr/lib/python3.6/glances_diskio.pyr!s

zPlugin.__init__cCsdS)zReturn the key of the list.�	disk_namer)rrrr�get_key5szPlugin.get_keycCs�|j�}|jdk�rrytjdd�}Wntk
r8|SXtd�}|}�x|D]�}|jdk	rr|jjrr|jd�rrqN|j	|�s~qNyb|t
|�||j|j|j||j
|j|j
||j|j|j||j|j|jd�}Wn0ttfk
�r|t
|�ddddd�}YnX|j|�dk	�r0|j|�|d	<|j�|d
<|j|�qNWy
||_Wnttfk
�rnYnXn|jdk�r~||_|jS)z-Update disk I/O stats using the input method.ZlocalT)Zperdisk�diskNZram)�time_since_updater�
read_count�write_countrr
r�alias�keyZsnmp)Zget_init_valueZinput_method�psutilZdisk_io_counters�	ExceptionrrZdiskio_show_ramfs�
startswithZ
is_displayrrZ
diskio_oldrrr
�KeyError�AttributeError�	has_aliasr�append�IOError�UnboundLocalError�stats)rr+ZdiskiorrZdiskstatrrrr9sL	

z
Plugin.updatecs�tt|�j�|j�x�|j�D]|}|d}|jt|d|d�|dd�|j||j�dd<|jt|d|d�|dd�|j||j�dd<q Wd	S)
zUpdate stats views.rrrZ_rx)�header�
decorationr
Z_txN)	rr�update_viewsZupdate_views_hiddenZget_rawZ	get_alert�intZviewsr)r�iZdisk_real_name)rrrr.�s4zPlugin.update_viewsc		s�g}�js�j�r|S|d}djd|d�}|j�j|d��|jr|djd�}|j�j|��djd	�}|j�j|��n4djd
�}|j�j|��djd�}|j�j|���x܈j�D�]Ήt��fdd
��jD��r�q��j	�d�r��j	�d�n�d}|j�j
��t|�|k�r4d||dd�}djt|�|dd�}|j�j|��|j�r��j
t�d�d��}�j
t�d�d��}dj|�}|j�j|�j��j�ddd���dj|�}|j�j|�j��j�ddd���q��j
t�d�d��}�j
t�d�d��}dj|�}|j�j|�j��j�ddd���dj|�}|j�j|�j��j�ddd���q�W|S)z2Return the dict to display in the curse interface.�
z
{:{width}}zDISK I/O)�widthZTITLEz{:>8}zIOR/sz{:>7}zIOW/szR/szW/scs$g|]}�j��j�|dd��qS)Zhidden)�itemr!�option)�	get_viewsr)�.0�f)r0rrr�
<listcomp>�sz$Plugin.msg_curse.<locals>.<listcomp>r�_�Nrrrr-)r3r!r4rr
)r+Zis_disabled�formatr(Zcurse_add_lineZdiskio_iopsZsorted_stats�allrr'Zcurse_new_line�lenrZ	auto_unitr/r5r)	rrZ	max_width�retZname_max_width�msgrZtxpsZrxpsr)r0rr�	msg_curse�s\



$

 

"zPlugin.msg_curse)NN)NN)
�__name__�
__module__�__qualname__�__doc__rrrZ_check_decoratorZ_log_result_decoratorrr.r@�
__classcell__rr)rrrsQr)
rDZ
__future__rZglances.compatrrZ
glances.timerrZglances.plugins.glances_pluginrr"rrrrrr�<module>
s