%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/modules/ |
Current File : //usr/lib/python2.7/site-packages/salt/modules/sysbench.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d S( 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 ( t absolute_importt unicode_literalst print_functionN( t zipc C@ s# t j j j d � r d St d f S( u9 loads the module, if only sysbench is installed u sysbenchuU The sysbench execution module failed to load: the sysbench binary is not in the path.( t saltt utilst patht whicht False( ( ( s9 /usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt __virtual__ s c C@ s? t j d � } t j d � } t j d � } t j d � } t j d � } t j d � } t j | | � j d � } t j | | � j d � } t j | | � j d � } t j | | � j d � } t j | | � j d � } t j | | � } | d k r| j d � } n i | d 6| d 6| d 6| d 6| d 6| d 6S( u- parses the output into a dictionary u total time:\s*(\d*.\d*s)u event execution:\s*(\d*.\d*s?)u min:\s*(\d*.\d*ms)u max:\s*(\d*.\d*ms)u avg:\s*(\d*.\d*ms)u 95 percentile:\s*(\d*.\d*ms)i u total timeu total execution timeu minimum response timeu maximum response timeu average response timeu 95 percentileN( t ret compilet searcht groupt None( t resultt _total_timet _total_executiont _min_response_timet _max_response_timet _avg_response_timet _per_response_timet total_timet total_executiont min_response_timet max_response_timet avg_response_timet per_response_time( ( s9 /usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt _parser s* c C@ sw d d d d g } d } d } i } xL | D]D } d j | � } | j | � } t d | � } 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} runu Prime numbers limit: {0}u cmd.runN( R t formatt __salt__R ( t max_primest test_commandR t ret_valt primest keyt run_command( ( s9 /usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt cpu; s c C@ s� d d d d g } d d d d g } d } | d 7} d } i } xa t | | � D]P \ } } d j | | � } | j | | � } t d | � } t | � | | <qP W| S( u� This tests the performance of the processor's scheduler CLI Example: .. code-block:: bash salt '*' sysbench.threads id i� i� i� i i i i u) sysbench --num-threads=64 --test=threads u+ --thread-yields={0} --thread-locks={1} run u Yields: {0} Locks: {1}u cmd.runN( R R R R R ( t thread_yieldst thread_locksR R R! t yieldst locksR# R$ ( ( s9 /usr/lib/python2.7/site-packages/salt/modules/sysbench.pyt threadsX s c C@ s d d d d d d d d d g } d d d d d d d d d g } g } | j | � d d d d d d d d d g } d } | d 7} d } i } xm t | | | � D]Y \ } } } d j | | | � } | j | | | � } t d | � } t | � | | <q� W| S( uy Tests the implementation of mutex CLI Examples: .. code-block:: bash salt '*' sysbench.mutex i2 i� i� i'