File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/sysbench.cpython-310.pyc
o
�N�gJ � @ sX d Z ddlZddlZdd� Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
dd� ZdS )z�
The 'sysbench' module is used to analyze the
performance of the minions, right from the master!
It measures various system parameters such as
CPU, Memory, File I/O, Threads and Mutex.
� Nc C s t jj�d�r dS dS )z9
loads the module, if only sysbench is installed
Zsysbench)FzUThe sysbench execution module failed to load: the sysbench binary is not in the path.)�salt�utils�path�which� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/sysbench.py�__virtual__
s r c
C s� t �d�}t �d�}t �d�}t �d�}t �d�}t �d�}t �|| ��d�}t �|| ��d�}t �|| ��d�} t �|| ��d�}
t �|| ��d�}t �|| �}|durZ|�d�}||| |
||d �S )
z-
parses the output into a dictionary
ztotal time:\s*(\d*.\d*s)zevent execution:\s*(\d*.\d*s?)zmin:\s*(\d*.\d*ms)zmax:\s*(\d*.\d*ms)zavg:\s*(\d*.\d*ms)z95 percentile:\s*(\d*.\d*ms)� N)z
total timeztotal execution timezminimum response timezmaximum response timezaverage response timez
95 percentile)�re�compile�search�group)
�resultZ_total_timeZ_total_executionZ_min_response_timeZ_max_response_timeZ_avg_response_timeZ_per_response_timeZ
total_timeZtotal_executionZmin_response_timeZmax_response_timeZavg_response_timeZper_response_timer r r �_parser s*
�r c C sN g d�} d}d}i }| D ]}d|� �}|� |�}td |�}t|�||<