Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/rads/__pycache__/_sa.cpython-39.pyc
Ðазад
a � hE � @ s^ d Z ddlZddlZddlZddlmZmZ G dd� d�Zd eeeef d�dd�Z d e _ dS )zSA data functions� N)�datetime� timedeltac @ s, e Zd ZdZdZe�d�Zed�dd�ZdS )�SaUsagead Holds a record from sadatarunner.sh or sa -cm as an object with attributes for each column Args: line (str): line from sa -cm to parse Hint: Use vars() on this to get a dict of the columns Attributes: user (str): username procs (int): num of processes executed perc_procs (float): percent of total processes real (float): real execution time perc_real (float): percent of real execution time from total cpu (float): cpu time in cp avg_iops (int): average iops per process iops (int): total iops (units of 1000) �radsz�(?P<user>[^\s]+)\s+(?P<procs>\d+)\s+(?P<perc_procs>\d+\.?\d*)%\s+(?P<real>\d+\.?\d*)re\s+(?P<perc_real>\d+\.?\d*)%\s+(?P<cpu>\d+\.?\d*)cp\s+(?P<perc_cp>\d+\.?\d*)%\s+(?P<avg_iops>\d+)avio\s+(?P<iops>\d+)k\s*$)�linec C s� t j�|�}|std��|�� }|d | _t|d �| _t|d �| _ t|d �| _ t|d �| _t|d �| _t|d �| _ t|d �| _t|d �| _d S )NzInvalid sa line�user�procs� perc_procs�real� perc_real�cpu�perc_cp�avg_iops�iops)r �sa_re�match� ValueError� groupdictr �intr �floatr r r r r r r )�selfr r Zgdict� r �7/opt/imh-python/lib/python3.9/site-packages/rads/_sa.py�__init__* s zSaUsage.__init__N) �__name__� __module__�__qualname__�__doc__�re�compiler �strr r r r r r s �r )�offset�returnc sB | d7 } t �� t| d� }|�d��� \}}tj�d||�� z� fdd�t�� �D �}W n t yn i Y S 0 zt |tjjdd�d }W n ty� i Y S 0 z@t j|d dd��}|�� �� }W d � n1 s�0 Y W n t� y� i Y S 0 i }|D ]8} zt| �} W n t�y. Y �qY n0 | || j<