%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/sysbench.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlm	Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�ZdS(
u�
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.
i(tabsolute_importtunicode_literalstprint_functionN(tzipcC@s#tjjjd�rdStdfS(u9
    loads the module, if only sysbench is installed
    usysbenchuUThe sysbench execution module failed to load: the sysbench binary is not in the path.(tsalttutilstpathtwhichtFalse(((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt__virtual__sc
C@s?tjd�}tjd�}tjd�}tjd�}tjd�}tjd�}tj||�jd�}tj||�jd�}tj||�jd�}	tj||�jd�}
tj||�jd�}tj||�}|dk	r|jd�}ni|d6|d	6|	d
6|
d6|d6|d
6S(u-
    parses the output into a dictionary
    utotal time:\s*(\d*.\d*s)uevent execution:\s*(\d*.\d*s?)umin:\s*(\d*.\d*ms)umax:\s*(\d*.\d*ms)uavg:\s*(\d*.\d*ms)u95 percentile:\s*(\d*.\d*ms)iu
total timeutotal execution timeuminimum response timeumaximum response timeuaverage response timeu
95 percentileN(tretcompiletsearchtgrouptNone(
tresultt_total_timet_total_executiont_min_response_timet_max_response_timet_avg_response_timet_per_response_timet
total_timettotal_executiontmin_response_timetmax_response_timetavg_response_timetper_response_time((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt_parsers*cC@swddddg}d}d}i}xL|D]D}dj|�}|j|�}td|�}t|�||<q+W|S(	u
    Tests for the CPU performance of minions.

    CLI Examples:

    .. code-block:: bash

        salt '*' sysbench.cpu
    i�i�i�	i�u+sysbench --test=cpu --cpu-max-prime={0} runuPrime numbers limit: {0}ucmd.runN(Rtformatt__salt__R(t
max_primesttest_commandRtret_valtprimestkeytrun_command((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pytcpu;s
c	C@s�ddddg}ddddg}d	}|d
7}d
}i}xat||�D]P\}}dj||�}|j||�}td|�}t|�||<qPW|S(u�
    This tests the performance of the processor's scheduler

    CLI Example:

    .. code-block:: bash

        salt '*' sysbench.threads
    idi�i�i�iiiiu)sysbench --num-threads=64 --test=threads u+--thread-yields={0} --thread-locks={1} run uYields: {0} Locks: {1}ucmd.runN(RRRRR(	t
thread_yieldstthread_locksR RR!tyieldstlocksR#R$((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pytthreadsXs
c	C@sdddddddddg	}dddddddddg	}g}|j|�dddddddddg	}d	}|d
7}d
}i}xmt|||�D]Y\}}}dj|||�}	|j|||�}
td|
�}t|�||	<q�W|S(uy
    Tests the implementation of mutex

    CLI Examples:

    .. code-block:: bash

        salt '*' sysbench.mutex
    i2i�i�i'i�aiP�i�	i�u(sysbench --num-threads=250 --test=mutex u8--mutex-num={0} --mutex-locks={1} --mutex-loops={2} run u Mutex: {0} Locks: {1} Loops: {2}ucmd.runN(textendRRRRR(t	mutex_numR)tmutex_lockstmutex_loopsR RR!tnumtloopsR#R$((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pytmutexws!!
!
"c	C@s�ddg}ddg}d}|d7}|d7}d
}i}xc|D][}xR|D]J}dj||�}|j||�}td	|�}t|�||<qRWqEW|S(u�
    This tests the memory for read and write operations.

    CLI Examples:

    .. code-block:: bash

        salt '*' sysbench.memory
    ureaduwriteulocaluglobalu(sysbench --num-threads=64 --test=memory u%--memory-oper={0} --memory-scope={1} u3--memory-block-size=1K --memory-total-size=32G run uOperation: {0} Scope: {1}ucmd.runN(RRRR(	tmemory_opertmemory_scopeR RR!topertscopeR#R$((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pytmemory�s



cC@s�ddddddg}d}|d7}d}i}x�|D]�}d	j|�}|d
j|�}td|�|dj|�}td|�}t|�||<|d
j|�}td|�q;W|S(u�
    This tests for the file read and write operations
    Various modes of operations are

    * sequential write
    * sequential rewrite
    * sequential read
    * random read
    * random write
    * random read and write

    The test works with 32 files with each file being 1Gb in size
    The test consumes a lot of time. Be patient!

    CLI Examples:

    .. code-block:: bash

        salt '*' sysbench.fileio
    useqwruseqrewruseqrdurndrdurndwrurndrwu(sysbench --num-threads=16 --test=fileio u8--file-num=32 --file-total-size=1G --file-test-mode={0} u	Mode: {0}uprepareucmd.runurunucleanupN(RRRR(t
test_modesR RR!tmodeR#R$((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pytfileio�s

cC@stS(N(tTrue(((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pytping�s(t__doc__t
__future__RRRR
tsalt.utils.pathRtsalt.ext.six.movesRR	RR%R*R1R6R9R;(((s9/usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt<module>s	
	"			'	&	3

Zerion Mini Shell 1.0